").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("
").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery);;
/* NUGET: BEGIN LICENSE TEXT
*
* Microsoft grants you the right to use these script files for the sole
* purpose of either: (i) interacting through your browser with the Microsoft
* website or online service, subject to the applicable licensing or use
* terms; or (ii) using the files as included with a Microsoft product subject
* to that product's license terms. Microsoft reserves all other rights to the
* files not expressly granted by Microsoft, whether by implication, estoppel
* or otherwise. Insofar as a script file is dual licensed under GPL,
* Microsoft neither took the code under GPL nor distributes it thereunder but
* under the terms set out in this paragraph. All notices and licenses
* below are for informational purposes only.
*
* NUGET: END LICENSE TEXT */
/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation
* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("
").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("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){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),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){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):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(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}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 i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),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",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),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;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),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)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){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 0===this.size()},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&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&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(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!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 i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!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;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"
Warning: No message defined for "+e.name+" ")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):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){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[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);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):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){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),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},dependTypes:{"boolean":function(t){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){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&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){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;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)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){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]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},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))},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 i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},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)||s>=r},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]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):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);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);;
/*!
* Bootstrap v5.1.3 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e(t.Popper)}(this,(function(t){"use strict";function e(t){if(t&&t.__esModule)return t;const e=Object.create(null);if(t)for(const i in t)if("default"!==i){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const i=e(t),s="transitionend",n=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return e},o=t=>{const e=n(t);return e&&document.querySelector(e)?e:null},r=t=>{const e=n(t);return e?document.querySelector(e):null},a=t=>{t.dispatchEvent(new Event(s))},l=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),c=t=>l(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(t):null,h=(t,e,i)=>{Object.keys(i).forEach((s=>{const n=i[s],o=e[s],r=o&&l(o)?"element":null==(a=o)?`${a}`:{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase();var a;if(!new RegExp(n).test(r))throw new TypeError(`${t.toUpperCase()}: Option "${s}" provided type "${r}" but expected type "${n}".`)}))},d=t=>!(!l(t)||0===t.getClientRects().length)&&"visible"===getComputedStyle(t).getPropertyValue("visibility"),u=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),g=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?g(t.parentNode):null},_=()=>{},f=t=>{t.offsetHeight},p=()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},m=[],b=()=>"rtl"===document.documentElement.dir,v=t=>{var e;e=()=>{const e=p();if(e){const i=t.NAME,s=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=s,t.jQueryInterface)}},"loading"===document.readyState?(m.length||document.addEventListener("DOMContentLoaded",(()=>{m.forEach((t=>t()))})),m.push(e)):e()},y=t=>{"function"==typeof t&&t()},E=(t,e,i=!0)=>{if(!i)return void y(t);const n=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const s=Number.parseFloat(e),n=Number.parseFloat(i);return s||n?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(e)+5;let o=!1;const r=({target:i})=>{i===e&&(o=!0,e.removeEventListener(s,r),y(t))};e.addEventListener(s,r),setTimeout((()=>{o||a(e)}),n)},w=(t,e,i,s)=>{let n=t.indexOf(e);if(-1===n)return t[!i&&s?t.length-1:0];const o=t.length;return n+=i?1:-1,s&&(n=(n+o)%o),t[Math.max(0,Math.min(n,o-1))]},A=/[^.]*(?=\..*)\.|.*/,T=/\..*/,C=/::\d+$/,k={};let L=1;const S={mouseenter:"mouseover",mouseleave:"mouseout"},O=/^(mouseenter|mouseleave)/i,N=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function D(t,e){return e&&`${e}::${L++}`||t.uidEvent||L++}function I(t){const e=D(t);return t.uidEvent=e,k[e]=k[e]||{},k[e]}function P(t,e,i=null){const s=Object.keys(t);for(let n=0,o=s.length;n
function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};s?s=t(s):i=t(i)}const[o,r,a]=x(e,i,s),l=I(t),c=l[a]||(l[a]={}),h=P(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&n);const d=D(r,e.replace(A,"")),u=o?function(t,e,i){return function s(n){const o=t.querySelectorAll(e);for(let{target:r}=n;r&&r!==this;r=r.parentNode)for(let a=o.length;a--;)if(o[a]===r)return n.delegateTarget=r,s.oneOff&&$.off(t,n.type,e,i),i.apply(r,[n]);return null}}(t,i,s):function(t,e){return function i(s){return s.delegateTarget=t,i.oneOff&&$.off(t,s.type,e),e.apply(t,[s])}}(t,i);u.delegationSelector=o?i:null,u.originalHandler=r,u.oneOff=n,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function j(t,e,i,s,n){const o=P(e[i],s,n);o&&(t.removeEventListener(i,o,Boolean(n)),delete e[i][o.uidEvent])}function H(t){return t=t.replace(T,""),S[t]||t}const $={on(t,e,i,s){M(t,e,i,s,!1)},one(t,e,i,s){M(t,e,i,s,!0)},off(t,e,i,s){if("string"!=typeof e||!t)return;const[n,o,r]=x(e,i,s),a=r!==e,l=I(t),c=e.startsWith(".");if(void 0!==o){if(!l||!l[r])return;return void j(t,l,r,o,n?i:null)}c&&Object.keys(l).forEach((i=>{!function(t,e,i,s){const n=e[i]||{};Object.keys(n).forEach((o=>{if(o.includes(s)){const s=n[o];j(t,e,i,s.originalHandler,s.delegationSelector)}}))}(t,l,i,e.slice(1))}));const h=l[r]||{};Object.keys(h).forEach((i=>{const s=i.replace(C,"");if(!a||e.includes(s)){const e=h[i];j(t,l,r,e.originalHandler,e.delegationSelector)}}))},trigger(t,e,i){if("string"!=typeof e||!t)return null;const s=p(),n=H(e),o=e!==n,r=N.has(n);let a,l=!0,c=!0,h=!1,d=null;return o&&s&&(a=s.Event(e,i),s(t).trigger(a),l=!a.isPropagationStopped(),c=!a.isImmediatePropagationStopped(),h=a.isDefaultPrevented()),r?(d=document.createEvent("HTMLEvents"),d.initEvent(n,l,!0)):d=new CustomEvent(e,{bubbles:l,cancelable:!0}),void 0!==i&&Object.keys(i).forEach((t=>{Object.defineProperty(d,t,{get:()=>i[t]})})),h&&d.preventDefault(),c&&t.dispatchEvent(d),d.defaultPrevented&&void 0!==a&&a.preventDefault(),d}},B=new Map,z={set(t,e,i){B.has(t)||B.set(t,new Map);const s=B.get(t);s.has(e)||0===s.size?s.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(s.keys())[0]}.`)},get:(t,e)=>B.has(t)&&B.get(t).get(e)||null,remove(t,e){if(!B.has(t))return;const i=B.get(t);i.delete(e),0===i.size&&B.delete(t)}};class R{constructor(t){(t=c(t))&&(this._element=t,z.set(this._element,this.constructor.DATA_KEY,this))}dispose(){z.remove(this._element,this.constructor.DATA_KEY),$.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach((t=>{this[t]=null}))}_queueCallback(t,e,i=!0){E(t,e,i)}static getInstance(t){return z.get(c(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.1.3"}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}}const F=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,s=t.NAME;$.on(document,i,`[data-bs-dismiss="${s}"]`,(function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),u(this))return;const n=r(this)||this.closest(`.${s}`);t.getOrCreateInstance(n)[e]()}))};class q extends R{static get NAME(){return"alert"}close(){if($.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,t)}_destroyElement(){this._element.remove(),$.trigger(this._element,"closed.bs.alert"),this.dispose()}static jQueryInterface(t){return this.each((function(){const e=q.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}F(q,"close"),v(q);const W='[data-bs-toggle="button"]';class U extends R{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){const e=U.getOrCreateInstance(this);"toggle"===t&&e[t]()}))}}function K(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function V(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}$.on(document,"click.bs.button.data-api",W,(t=>{t.preventDefault();const e=t.target.closest(W);U.getOrCreateInstance(e).toggle()})),v(U);const X={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${V(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${V(e)}`)},getDataAttributes(t){if(!t)return{};const e={};return Object.keys(t.dataset).filter((t=>t.startsWith("bs"))).forEach((i=>{let s=i.replace(/^bs/,"");s=s.charAt(0).toLowerCase()+s.slice(1,s.length),e[s]=K(t.dataset[i])})),e},getDataAttribute:(t,e)=>K(t.getAttribute(`data-bs-${V(e)}`)),offset(t){const e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}},position:t=>({top:t.offsetTop,left:t.offsetLeft})},Y={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let s=t.parentNode;for(;s&&s.nodeType===Node.ELEMENT_NODE&&3!==s.nodeType;)s.matches(e)&&i.push(s),s=s.parentNode;return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(", ");return this.find(e,t).filter((t=>!u(t)&&d(t)))}},Q="carousel",G={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},Z={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},J="next",tt="prev",et="left",it="right",st={ArrowLeft:it,ArrowRight:et},nt="slid.bs.carousel",ot="active",rt=".active.carousel-item";class at extends R{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=Y.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return G}static get NAME(){return Q}next(){this._slide(J)}nextWhenVisible(){!document.hidden&&d(this._element)&&this.next()}prev(){this._slide(tt)}pause(t){t||(this._isPaused=!0),Y.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(a(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(t){this._activeElement=Y.findOne(rt,this._element);const e=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void $.one(this._element,nt,(()=>this.to(t)));if(e===t)return this.pause(),void this.cycle();const i=t>e?J:tt;this._slide(i,this._items[t])}_getConfig(t){return t={...G,...X.getDataAttributes(this._element),..."object"==typeof t?t:{}},h(Q,t,Z),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e&&this._slide(e>0?it:et)}_addEventListeners(){this._config.keyboard&&$.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&($.on(this._element,"mouseenter.bs.carousel",(t=>this.pause(t))),$.on(this._element,"mouseleave.bs.carousel",(t=>this.cycle(t)))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const t=t=>this._pointerEvent&&("pen"===t.pointerType||"touch"===t.pointerType),e=e=>{t(e)?this.touchStartX=e.clientX:this._pointerEvent||(this.touchStartX=e.touches[0].clientX)},i=t=>{this.touchDeltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this.touchStartX},s=e=>{t(e)&&(this.touchDeltaX=e.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((t=>this.cycle(t)),500+this._config.interval))};Y.find(".carousel-item img",this._element).forEach((t=>{$.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()))})),this._pointerEvent?($.on(this._element,"pointerdown.bs.carousel",(t=>e(t))),$.on(this._element,"pointerup.bs.carousel",(t=>s(t))),this._element.classList.add("pointer-event")):($.on(this._element,"touchstart.bs.carousel",(t=>e(t))),$.on(this._element,"touchmove.bs.carousel",(t=>i(t))),$.on(this._element,"touchend.bs.carousel",(t=>s(t))))}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=st[t.key];e&&(t.preventDefault(),this._slide(e))}_getItemIndex(t){return this._items=t&&t.parentNode?Y.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByOrder(t,e){const i=t===J;return w(this._items,e,i,this._config.wrap)}_triggerSlideEvent(t,e){const i=this._getItemIndex(t),s=this._getItemIndex(Y.findOne(rt,this._element));return $.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:e,from:s,to:i})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=Y.findOne(".active",this._indicatorsElement);e.classList.remove(ot),e.removeAttribute("aria-current");const i=Y.find("[data-bs-target]",this._indicatorsElement);for(let e=0;e{$.trigger(this._element,nt,{relatedTarget:o,direction:d,from:n,to:r})};if(this._element.classList.contains("slide")){o.classList.add(h),f(o),s.classList.add(c),o.classList.add(c);const t=()=>{o.classList.remove(c,h),o.classList.add(ot),s.classList.remove(ot,h,c),this._isSliding=!1,setTimeout(u,0)};this._queueCallback(t,s,!0)}else s.classList.remove(ot),o.classList.add(ot),this._isSliding=!1,u();a&&this.cycle()}_directionToOrder(t){return[it,et].includes(t)?b()?t===et?tt:J:t===et?J:tt:t}_orderToDirection(t){return[J,tt].includes(t)?b()?t===tt?et:it:t===tt?it:et:t}static carouselInterface(t,e){const i=at.getOrCreateInstance(t,e);let{_config:s}=i;"object"==typeof e&&(s={...s,...e});const n="string"==typeof e?e:s.slide;if("number"==typeof e)i.to(e);else if("string"==typeof n){if(void 0===i[n])throw new TypeError(`No method named "${n}"`);i[n]()}else s.interval&&s.ride&&(i.pause(),i.cycle())}static jQueryInterface(t){return this.each((function(){at.carouselInterface(this,t)}))}static dataApiClickHandler(t){const e=r(this);if(!e||!e.classList.contains("carousel"))return;const i={...X.getDataAttributes(e),...X.getDataAttributes(this)},s=this.getAttribute("data-bs-slide-to");s&&(i.interval=!1),at.carouselInterface(e,i),s&&at.getInstance(e).to(s),t.preventDefault()}}$.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",at.dataApiClickHandler),$.on(window,"load.bs.carousel.data-api",(()=>{const t=Y.find('[data-bs-ride="carousel"]');for(let e=0,i=t.length;et===this._element));null!==s&&n.length&&(this._selector=s,this._triggerArray.push(e))}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return ct}static get NAME(){return lt}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t,e=[];if(this._config.parent){const t=Y.find(ft,this._config.parent);e=Y.find(".collapse.show, .collapse.collapsing",this._config.parent).filter((e=>!t.includes(e)))}const i=Y.findOne(this._selector);if(e.length){const s=e.find((t=>i!==t));if(t=s?mt.getInstance(s):null,t&&t._isTransitioning)return}if($.trigger(this._element,"show.bs.collapse").defaultPrevented)return;e.forEach((e=>{i!==e&&mt.getOrCreateInstance(e,{toggle:!1}).hide(),t||z.set(e,"bs.collapse",null)}));const s=this._getDimension();this._element.classList.remove(ut),this._element.classList.add(gt),this._element.style[s]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const n=`scroll${s[0].toUpperCase()+s.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(gt),this._element.classList.add(ut,dt),this._element.style[s]="",$.trigger(this._element,"shown.bs.collapse")}),this._element,!0),this._element.style[s]=`${this._element[n]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if($.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,f(this._element),this._element.classList.add(gt),this._element.classList.remove(ut,dt);const e=this._triggerArray.length;for(let t=0;t{this._isTransitioning=!1,this._element.classList.remove(gt),this._element.classList.add(ut),$.trigger(this._element,"hidden.bs.collapse")}),this._element,!0)}_isShown(t=this._element){return t.classList.contains(dt)}_getConfig(t){return(t={...ct,...X.getDataAttributes(this._element),...t}).toggle=Boolean(t.toggle),t.parent=c(t.parent),h(lt,t,ht),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=Y.find(ft,this._config.parent);Y.find(pt,this._config.parent).filter((e=>!t.includes(e))).forEach((t=>{const e=r(t);e&&this._addAriaAndCollapsedClass([t],this._isShown(e))}))}_addAriaAndCollapsedClass(t,e){t.length&&t.forEach((t=>{e?t.classList.remove(_t):t.classList.add(_t),t.setAttribute("aria-expanded",e)}))}static jQueryInterface(t){return this.each((function(){const e={};"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1);const i=mt.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}}$.on(document,"click.bs.collapse.data-api",pt,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=o(this);Y.find(e).forEach((t=>{mt.getOrCreateInstance(t,{toggle:!1}).toggle()}))})),v(mt);const bt="dropdown",vt="Escape",yt="Space",Et="ArrowUp",wt="ArrowDown",At=new RegExp("ArrowUp|ArrowDown|Escape"),Tt="click.bs.dropdown.data-api",Ct="keydown.bs.dropdown.data-api",kt="show",Lt='[data-bs-toggle="dropdown"]',St=".dropdown-menu",Ot=b()?"top-end":"top-start",Nt=b()?"top-start":"top-end",Dt=b()?"bottom-end":"bottom-start",It=b()?"bottom-start":"bottom-end",Pt=b()?"left-start":"right-start",xt=b()?"right-start":"left-start",Mt={offset:[0,2],boundary:"clippingParents",reference:"toggle",display:"dynamic",popperConfig:null,autoClose:!0},jt={offset:"(array|string|function)",boundary:"(string|element)",reference:"(string|element|object)",display:"string",popperConfig:"(null|object|function)",autoClose:"(boolean|string)"};class Ht extends R{constructor(t,e){super(t),this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar()}static get Default(){return Mt}static get DefaultType(){return jt}static get NAME(){return bt}toggle(){return this._isShown()?this.hide():this.show()}show(){if(u(this._element)||this._isShown(this._menu))return;const t={relatedTarget:this._element};if($.trigger(this._element,"show.bs.dropdown",t).defaultPrevented)return;const e=Ht.getParentFromElement(this._element);this._inNavbar?X.setDataAttribute(this._menu,"popper","none"):this._createPopper(e),"ontouchstart"in document.documentElement&&!e.closest(".navbar-nav")&&[].concat(...document.body.children).forEach((t=>$.on(t,"mouseover",_))),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(kt),this._element.classList.add(kt),$.trigger(this._element,"shown.bs.dropdown",t)}hide(){if(u(this._element)||!this._isShown(this._menu))return;const t={relatedTarget:this._element};this._completeHide(t)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(t){$.trigger(this._element,"hide.bs.dropdown",t).defaultPrevented||("ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>$.off(t,"mouseover",_))),this._popper&&this._popper.destroy(),this._menu.classList.remove(kt),this._element.classList.remove(kt),this._element.setAttribute("aria-expanded","false"),X.removeDataAttribute(this._menu,"popper"),$.trigger(this._element,"hidden.bs.dropdown",t))}_getConfig(t){if(t={...this.constructor.Default,...X.getDataAttributes(this._element),...t},h(bt,t,this.constructor.DefaultType),"object"==typeof t.reference&&!l(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError(`${bt.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(t){if(void 0===i)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let e=this._element;"parent"===this._config.reference?e=t:l(this._config.reference)?e=c(this._config.reference):"object"==typeof this._config.reference&&(e=this._config.reference);const s=this._getPopperConfig(),n=s.modifiers.find((t=>"applyStyles"===t.name&&!1===t.enabled));this._popper=i.createPopper(e,this._menu,s),n&&X.setDataAttribute(this._menu,"popper","static")}_isShown(t=this._element){return t.classList.contains(kt)}_getMenuElement(){return Y.next(this._element,St)[0]}_getPlacement(){const t=this._element.parentNode;if(t.classList.contains("dropend"))return Pt;if(t.classList.contains("dropstart"))return xt;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?Nt:Ot:e?It:Dt}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return"static"===this._config.display&&(t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}_selectMenuItem({key:t,target:e}){const i=Y.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter(d);i.length&&w(i,e,t===wt,!i.includes(e)).focus()}static jQueryInterface(t){return this.each((function(){const e=Ht.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}static clearMenus(t){if(t&&(2===t.button||"keyup"===t.type&&"Tab"!==t.key))return;const e=Y.find(Lt);for(let i=0,s=e.length;ie+t)),this._setElementAttributes($t,"paddingRight",(e=>e+t)),this._setElementAttributes(Bt,"marginRight",(e=>e-t))}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const s=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+s)return;this._saveInitialAttribute(t,e);const n=window.getComputedStyle(t)[e];t.style[e]=`${i(Number.parseFloat(n))}px`}))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes($t,"paddingRight"),this._resetElementAttributes(Bt,"marginRight")}_saveInitialAttribute(t,e){const i=t.style[e];i&&X.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=X.getDataAttribute(t,e);void 0===i?t.style.removeProperty(e):(X.removeDataAttribute(t,e),t.style[e]=i)}))}_applyManipulationCallback(t,e){l(t)?e(t):Y.find(t,this._element).forEach(e)}isOverflowing(){return this.getWidth()>0}}const Rt={className:"modal-backdrop",isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},Ft={className:"string",isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},qt="show",Wt="mousedown.bs.backdrop";class Ut{constructor(t){this._config=this._getConfig(t),this._isAppended=!1,this._element=null}show(t){this._config.isVisible?(this._append(),this._config.isAnimated&&f(this._getElement()),this._getElement().classList.add(qt),this._emulateAnimation((()=>{y(t)}))):y(t)}hide(t){this._config.isVisible?(this._getElement().classList.remove(qt),this._emulateAnimation((()=>{this.dispose(),y(t)}))):y(t)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_getConfig(t){return(t={...Rt,..."object"==typeof t?t:{}}).rootElement=c(t.rootElement),h("backdrop",t,Ft),t}_append(){this._isAppended||(this._config.rootElement.append(this._getElement()),$.on(this._getElement(),Wt,(()=>{y(this._config.clickCallback)})),this._isAppended=!0)}dispose(){this._isAppended&&($.off(this._element,Wt),this._element.remove(),this._isAppended=!1)}_emulateAnimation(t){E(t,this._getElement(),this._config.isAnimated)}}const Kt={trapElement:null,autofocus:!0},Vt={trapElement:"element",autofocus:"boolean"},Xt=".bs.focustrap",Yt="backward";class Qt{constructor(t){this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}activate(){const{trapElement:t,autofocus:e}=this._config;this._isActive||(e&&t.focus(),$.off(document,Xt),$.on(document,"focusin.bs.focustrap",(t=>this._handleFocusin(t))),$.on(document,"keydown.tab.bs.focustrap",(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,$.off(document,Xt))}_handleFocusin(t){const{target:e}=t,{trapElement:i}=this._config;if(e===document||e===i||i.contains(e))return;const s=Y.focusableChildren(i);0===s.length?i.focus():this._lastTabNavDirection===Yt?s[s.length-1].focus():s[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?Yt:"forward")}_getConfig(t){return t={...Kt,..."object"==typeof t?t:{}},h("focustrap",t,Vt),t}}const Gt="modal",Zt="Escape",Jt={backdrop:!0,keyboard:!0,focus:!0},te={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean"},ee="hidden.bs.modal",ie="show.bs.modal",se="resize.bs.modal",ne="click.dismiss.bs.modal",oe="keydown.dismiss.bs.modal",re="mousedown.dismiss.bs.modal",ae="modal-open",le="show",ce="modal-static";class he extends R{constructor(t,e){super(t),this._config=this._getConfig(e),this._dialog=Y.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollBar=new zt}static get Default(){return Jt}static get NAME(){return Gt}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||$.trigger(this._element,ie,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._scrollBar.hide(),document.body.classList.add(ae),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),$.on(this._dialog,re,(()=>{$.one(this._element,"mouseup.dismiss.bs.modal",(t=>{t.target===this._element&&(this._ignoreBackdropClick=!0)}))})),this._showBackdrop((()=>this._showElement(t))))}hide(){if(!this._isShown||this._isTransitioning)return;if($.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),this._focustrap.deactivate(),this._element.classList.remove(le),$.off(this._element,ne),$.off(this._dialog,re),this._queueCallback((()=>this._hideModal()),this._element,t)}dispose(){[window,this._dialog].forEach((t=>$.off(t,".bs.modal"))),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new Ut({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Qt({trapElement:this._element})}_getConfig(t){return t={...Jt,...X.getDataAttributes(this._element),..."object"==typeof t?t:{}},h(Gt,t,te),t}_showElement(t){const e=this._isAnimated(),i=Y.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,i&&(i.scrollTop=0),e&&f(this._element),this._element.classList.add(le),this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,$.trigger(this._element,"shown.bs.modal",{relatedTarget:t})}),this._dialog,e)}_setEscapeEvent(){this._isShown?$.on(this._element,oe,(t=>{this._config.keyboard&&t.key===Zt?(t.preventDefault(),this.hide()):this._config.keyboard||t.key!==Zt||this._triggerBackdropTransition()})):$.off(this._element,oe)}_setResizeEvent(){this._isShown?$.on(window,se,(()=>this._adjustDialog())):$.off(window,se)}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(ae),this._resetAdjustments(),this._scrollBar.reset(),$.trigger(this._element,ee)}))}_showBackdrop(t){$.on(this._element,ne,(t=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:t.target===t.currentTarget&&(!0===this._config.backdrop?this.hide():"static"===this._config.backdrop&&this._triggerBackdropTransition())})),this._backdrop.show(t)}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if($.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const{classList:t,scrollHeight:e,style:i}=this._element,s=e>document.documentElement.clientHeight;!s&&"hidden"===i.overflowY||t.contains(ce)||(s||(i.overflowY="hidden"),t.add(ce),this._queueCallback((()=>{t.remove(ce),s||this._queueCallback((()=>{i.overflowY=""}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;(!i&&t&&!b()||i&&!t&&b())&&(this._element.style.paddingLeft=`${e}px`),(i&&!t&&!b()||!i&&t&&b())&&(this._element.style.paddingRight=`${e}px`)}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const i=he.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}}))}}$.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=r(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),$.one(e,ie,(t=>{t.defaultPrevented||$.one(e,ee,(()=>{d(this)&&this.focus()}))}));const i=Y.findOne(".modal.show");i&&he.getInstance(i).hide(),he.getOrCreateInstance(e).toggle(this)})),F(he),v(he);const de="offcanvas",ue={backdrop:!0,keyboard:!0,scroll:!1},ge={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"},_e="show",fe=".offcanvas.show",pe="hidden.bs.offcanvas";class me extends R{constructor(t,e){super(t),this._config=this._getConfig(e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get NAME(){return de}static get Default(){return ue}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||$.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._element.style.visibility="visible",this._backdrop.show(),this._config.scroll||(new zt).hide(),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(_e),this._queueCallback((()=>{this._config.scroll||this._focustrap.activate(),$.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t})}),this._element,!0))}hide(){this._isShown&&($.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.remove(_e),this._backdrop.hide(),this._queueCallback((()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.scroll||(new zt).reset(),$.trigger(this._element,pe)}),this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_getConfig(t){return t={...ue,...X.getDataAttributes(this._element),..."object"==typeof t?t:{}},h(de,t,ge),t}_initializeBackDrop(){return new Ut({className:"offcanvas-backdrop",isVisible:this._config.backdrop,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:()=>this.hide()})}_initializeFocusTrap(){return new Qt({trapElement:this._element})}_addEventListeners(){$.on(this._element,"keydown.dismiss.bs.offcanvas",(t=>{this._config.keyboard&&"Escape"===t.key&&this.hide()}))}static jQueryInterface(t){return this.each((function(){const e=me.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}$.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=r(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),u(this))return;$.one(e,pe,(()=>{d(this)&&this.focus()}));const i=Y.findOne(fe);i&&i!==e&&me.getInstance(i).hide(),me.getOrCreateInstance(e).toggle(this)})),$.on(window,"load.bs.offcanvas.data-api",(()=>Y.find(fe).forEach((t=>me.getOrCreateInstance(t).show())))),F(me),v(me);const be=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),ve=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,ye=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,Ee=(t,e)=>{const i=t.nodeName.toLowerCase();if(e.includes(i))return!be.has(i)||Boolean(ve.test(t.nodeValue)||ye.test(t.nodeValue));const s=e.filter((t=>t instanceof RegExp));for(let t=0,e=s.length;t{Ee(t,r)||i.removeAttribute(t.nodeName)}))}return s.body.innerHTML}const Ae="tooltip",Te=new Set(["sanitize","allowList","sanitizeFn"]),Ce={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(array|string|function)",container:"(string|element|boolean)",fallbackPlacements:"array",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",allowList:"object",popperConfig:"(null|object|function)"},ke={AUTO:"auto",TOP:"top",RIGHT:b()?"left":"right",BOTTOM:"bottom",LEFT:b()?"right":"left"},Le={animation:!0,template:'',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},Se={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},Oe="fade",Ne="show",De="show",Ie="out",Pe=".tooltip-inner",xe=".modal",Me="hide.bs.modal",je="hover",He="focus";class $e extends R{constructor(t,e){if(void 0===i)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this._config=this._getConfig(e),this.tip=null,this._setListeners()}static get Default(){return Le}static get NAME(){return Ae}static get Event(){return Se}static get DefaultType(){return Ce}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(t){if(this._isEnabled)if(t){const e=this._initializeOnDelegatedTarget(t);e._activeTrigger.click=!e._activeTrigger.click,e._isWithActiveTrigger()?e._enter(null,e):e._leave(null,e)}else{if(this.getTipElement().classList.contains(Ne))return void this._leave(null,this);this._enter(null,this)}}dispose(){clearTimeout(this._timeout),$.off(this._element.closest(xe),Me,this._hideModalHandler),this.tip&&this.tip.remove(),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this.isWithContent()||!this._isEnabled)return;const t=$.trigger(this._element,this.constructor.Event.SHOW),e=g(this._element),s=null===e?this._element.ownerDocument.documentElement.contains(this._element):e.contains(this._element);if(t.defaultPrevented||!s)return;"tooltip"===this.constructor.NAME&&this.tip&&this.getTitle()!==this.tip.querySelector(Pe).innerHTML&&(this._disposePopper(),this.tip.remove(),this.tip=null);const n=this.getTipElement(),o=(t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t})(this.constructor.NAME);n.setAttribute("id",o),this._element.setAttribute("aria-describedby",o),this._config.animation&&n.classList.add(Oe);const r="function"==typeof this._config.placement?this._config.placement.call(this,n,this._element):this._config.placement,a=this._getAttachment(r);this._addAttachmentClass(a);const{container:l}=this._config;z.set(n,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(l.append(n),$.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=i.createPopper(this._element,n,this._getPopperConfig(a)),n.classList.add(Ne);const c=this._resolvePossibleFunction(this._config.customClass);c&&n.classList.add(...c.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>{$.on(t,"mouseover",_)}));const h=this.tip.classList.contains(Oe);this._queueCallback((()=>{const t=this._hoverState;this._hoverState=null,$.trigger(this._element,this.constructor.Event.SHOWN),t===Ie&&this._leave(null,this)}),this.tip,h)}hide(){if(!this._popper)return;const t=this.getTipElement();if($.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented)return;t.classList.remove(Ne),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>$.off(t,"mouseover",_))),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1;const e=this.tip.classList.contains(Oe);this._queueCallback((()=>{this._isWithActiveTrigger()||(this._hoverState!==De&&t.remove(),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),$.trigger(this._element,this.constructor.Event.HIDDEN),this._disposePopper())}),this.tip,e),this._hoverState=""}update(){null!==this._popper&&this._popper.update()}isWithContent(){return Boolean(this.getTitle())}getTipElement(){if(this.tip)return this.tip;const t=document.createElement("div");t.innerHTML=this._config.template;const e=t.children[0];return this.setContent(e),e.classList.remove(Oe,Ne),this.tip=e,this.tip}setContent(t){this._sanitizeAndSetContent(t,this.getTitle(),Pe)}_sanitizeAndSetContent(t,e,i){const s=Y.findOne(i,t);e||!s?this.setElementContent(s,e):s.remove()}setElementContent(t,e){if(null!==t)return l(e)?(e=c(e),void(this._config.html?e.parentNode!==t&&(t.innerHTML="",t.append(e)):t.textContent=e.textContent)):void(this._config.html?(this._config.sanitize&&(e=we(e,this._config.allowList,this._config.sanitizeFn)),t.innerHTML=e):t.textContent=e)}getTitle(){const t=this._element.getAttribute("data-bs-original-title")||this._config.title;return this._resolvePossibleFunction(t)}updateAttachment(t){return"right"===t?"end":"left"===t?"start":t}_initializeOnDelegatedTarget(t,e){return e||this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return"function"==typeof t?t.call(this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"onChange",enabled:!0,phase:"afterWrite",fn:t=>this._handlePopperPlacementChange(t)}],onFirstUpdate:t=>{t.options.placement!==t.placement&&this._handlePopperPlacementChange(t)}};return{...e,..."function"==typeof this._config.popperConfig?this._config.popperConfig(e):this._config.popperConfig}}_addAttachmentClass(t){this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(t)}`)}_getAttachment(t){return ke[t.toUpperCase()]}_setListeners(){this._config.trigger.split(" ").forEach((t=>{if("click"===t)$.on(this._element,this.constructor.Event.CLICK,this._config.selector,(t=>this.toggle(t)));else if("manual"!==t){const e=t===je?this.constructor.Event.MOUSEENTER:this.constructor.Event.FOCUSIN,i=t===je?this.constructor.Event.MOUSELEAVE:this.constructor.Event.FOCUSOUT;$.on(this._element,e,this._config.selector,(t=>this._enter(t))),$.on(this._element,i,this._config.selector,(t=>this._leave(t)))}})),this._hideModalHandler=()=>{this._element&&this.hide()},$.on(this._element.closest(xe),Me,this._hideModalHandler),this._config.selector?this._config={...this._config,trigger:"manual",selector:""}:this._fixTitle()}_fixTitle(){const t=this._element.getAttribute("title"),e=typeof this._element.getAttribute("data-bs-original-title");(t||"string"!==e)&&(this._element.setAttribute("data-bs-original-title",t||""),!t||this._element.getAttribute("aria-label")||this._element.textContent||this._element.setAttribute("aria-label",t),this._element.setAttribute("title",""))}_enter(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusin"===t.type?He:je]=!0),e.getTipElement().classList.contains(Ne)||e._hoverState===De?e._hoverState=De:(clearTimeout(e._timeout),e._hoverState=De,e._config.delay&&e._config.delay.show?e._timeout=setTimeout((()=>{e._hoverState===De&&e.show()}),e._config.delay.show):e.show())}_leave(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusout"===t.type?He:je]=e._element.contains(t.relatedTarget)),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=Ie,e._config.delay&&e._config.delay.hide?e._timeout=setTimeout((()=>{e._hoverState===Ie&&e.hide()}),e._config.delay.hide):e.hide())}_isWithActiveTrigger(){for(const t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1}_getConfig(t){const e=X.getDataAttributes(this._element);return Object.keys(e).forEach((t=>{Te.has(t)&&delete e[t]})),(t={...this.constructor.Default,...e,..."object"==typeof t&&t?t:{}}).container=!1===t.container?document.body:c(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),h(Ae,t,this.constructor.DefaultType),t.sanitize&&(t.template=we(t.template,t.allowList,t.sanitizeFn)),t}_getDelegateConfig(){const t={};for(const e in this._config)this.constructor.Default[e]!==this._config[e]&&(t[e]=this._config[e]);return t}_cleanTipClass(){const t=this.getTipElement(),e=new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`,"g"),i=t.getAttribute("class").match(e);null!==i&&i.length>0&&i.map((t=>t.trim())).forEach((e=>t.classList.remove(e)))}_getBasicClassPrefix(){return"bs-tooltip"}_handlePopperPlacementChange(t){const{state:e}=t;e&&(this.tip=e.elements.popper,this._cleanTipClass(),this._addAttachmentClass(this._getAttachment(e.placement)))}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null)}static jQueryInterface(t){return this.each((function(){const e=$e.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}v($e);const Be={...$e.Default,placement:"right",offset:[0,8],trigger:"click",content:"",template:''},ze={...$e.DefaultType,content:"(string|element|function)"},Re={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class Fe extends $e{static get Default(){return Be}static get NAME(){return"popover"}static get Event(){return Re}static get DefaultType(){return ze}isWithContent(){return this.getTitle()||this._getContent()}setContent(t){this._sanitizeAndSetContent(t,this.getTitle(),".popover-header"),this._sanitizeAndSetContent(t,this._getContent(),".popover-body")}_getContent(){return this._resolvePossibleFunction(this._config.content)}_getBasicClassPrefix(){return"bs-popover"}static jQueryInterface(t){return this.each((function(){const e=Fe.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}v(Fe);const qe="scrollspy",We={offset:10,method:"auto",target:""},Ue={offset:"number",method:"string",target:"(string|element)"},Ke="active",Ve=".nav-link, .list-group-item, .dropdown-item",Xe="position";class Ye extends R{constructor(t,e){super(t),this._scrollElement="BODY"===this._element.tagName?window:this._element,this._config=this._getConfig(e),this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,$.on(this._scrollElement,"scroll.bs.scrollspy",(()=>this._process())),this.refresh(),this._process()}static get Default(){return We}static get NAME(){return qe}refresh(){const t=this._scrollElement===this._scrollElement.window?"offset":Xe,e="auto"===this._config.method?t:this._config.method,i=e===Xe?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),Y.find(Ve,this._config.target).map((t=>{const s=o(t),n=s?Y.findOne(s):null;if(n){const t=n.getBoundingClientRect();if(t.width||t.height)return[X[e](n).top+i,s]}return null})).filter((t=>t)).sort(((t,e)=>t[0]-e[0])).forEach((t=>{this._offsets.push(t[0]),this._targets.push(t[1])}))}dispose(){$.off(this._scrollElement,".bs.scrollspy"),super.dispose()}_getConfig(t){return(t={...We,...X.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}}).target=c(t.target)||document.documentElement,h(qe,t,Ue),t}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),i=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=i){const t=this._targets[this._targets.length-1];this._activeTarget!==t&&this._activate(t)}else{if(this._activeTarget&&t0)return this._activeTarget=null,void this._clear();for(let e=this._offsets.length;e--;)this._activeTarget!==this._targets[e]&&t>=this._offsets[e]&&(void 0===this._offsets[e+1]||t`${e}[data-bs-target="${t}"],${e}[href="${t}"]`)),i=Y.findOne(e.join(","),this._config.target);i.classList.add(Ke),i.classList.contains("dropdown-item")?Y.findOne(".dropdown-toggle",i.closest(".dropdown")).classList.add(Ke):Y.parents(i,".nav, .list-group").forEach((t=>{Y.prev(t,".nav-link, .list-group-item").forEach((t=>t.classList.add(Ke))),Y.prev(t,".nav-item").forEach((t=>{Y.children(t,".nav-link").forEach((t=>t.classList.add(Ke)))}))})),$.trigger(this._scrollElement,"activate.bs.scrollspy",{relatedTarget:t})}_clear(){Y.find(Ve,this._config.target).filter((t=>t.classList.contains(Ke))).forEach((t=>t.classList.remove(Ke)))}static jQueryInterface(t){return this.each((function(){const e=Ye.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}$.on(window,"load.bs.scrollspy.data-api",(()=>{Y.find('[data-bs-spy="scroll"]').forEach((t=>new Ye(t)))})),v(Ye);const Qe="active",Ge="fade",Ze="show",Je=".active",ti=":scope > li > .active";class ei extends R{static get NAME(){return"tab"}show(){if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&this._element.classList.contains(Qe))return;let t;const e=r(this._element),i=this._element.closest(".nav, .list-group");if(i){const e="UL"===i.nodeName||"OL"===i.nodeName?ti:Je;t=Y.find(e,i),t=t[t.length-1]}const s=t?$.trigger(t,"hide.bs.tab",{relatedTarget:this._element}):null;if($.trigger(this._element,"show.bs.tab",{relatedTarget:t}).defaultPrevented||null!==s&&s.defaultPrevented)return;this._activate(this._element,i);const n=()=>{$.trigger(t,"hidden.bs.tab",{relatedTarget:this._element}),$.trigger(this._element,"shown.bs.tab",{relatedTarget:t})};e?this._activate(e,e.parentNode,n):n()}_activate(t,e,i){const s=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?Y.children(e,Je):Y.find(ti,e))[0],n=i&&s&&s.classList.contains(Ge),o=()=>this._transitionComplete(t,s,i);s&&n?(s.classList.remove(Ze),this._queueCallback(o,t,!0)):o()}_transitionComplete(t,e,i){if(e){e.classList.remove(Qe);const t=Y.findOne(":scope > .dropdown-menu .active",e.parentNode);t&&t.classList.remove(Qe),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}t.classList.add(Qe),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),f(t),t.classList.contains(Ge)&&t.classList.add(Ze);let s=t.parentNode;if(s&&"LI"===s.nodeName&&(s=s.parentNode),s&&s.classList.contains("dropdown-menu")){const e=t.closest(".dropdown");e&&Y.find(".dropdown-toggle",e).forEach((t=>t.classList.add(Qe))),t.setAttribute("aria-expanded",!0)}i&&i()}static jQueryInterface(t){return this.each((function(){const e=ei.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}$.on(document,"click.bs.tab.data-api",'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),u(this)||ei.getOrCreateInstance(this).show()})),v(ei);const ii="toast",si="hide",ni="show",oi="showing",ri={animation:"boolean",autohide:"boolean",delay:"number"},ai={animation:!0,autohide:!0,delay:5e3};class li extends R{constructor(t,e){super(t),this._config=this._getConfig(e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get DefaultType(){return ri}static get Default(){return ai}static get NAME(){return ii}show(){$.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(si),f(this._element),this._element.classList.add(ni),this._element.classList.add(oi),this._queueCallback((()=>{this._element.classList.remove(oi),$.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()}),this._element,this._config.animation))}hide(){this._element.classList.contains(ni)&&($.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(oi),this._queueCallback((()=>{this._element.classList.add(si),this._element.classList.remove(oi),this._element.classList.remove(ni),$.trigger(this._element,"hidden.bs.toast")}),this._element,this._config.animation)))}dispose(){this._clearTimeout(),this._element.classList.contains(ni)&&this._element.classList.remove(ni),super.dispose()}_getConfig(t){return t={...ai,...X.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}},h(ii,t,this.constructor.DefaultType),t}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){$.on(this._element,"mouseover.bs.toast",(t=>this._onInteraction(t,!0))),$.on(this._element,"mouseout.bs.toast",(t=>this._onInteraction(t,!1))),$.on(this._element,"focusin.bs.toast",(t=>this._onInteraction(t,!0))),$.on(this._element,"focusout.bs.toast",(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=li.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return F(li),v(li),{Alert:q,Button:U,Carousel:at,Collapse:mt,Dropdown:Ht,Modal:he,Offcanvas:me,Popover:Fe,ScrollSpy:Ye,Tab:ei,Toast:li,Tooltip:$e}}));
//# sourceMappingURL=bootstrap.min.js.map;
$(document).ready(function () {
$('.package-slider').owlCarousel({
loop: true,
margin: 15,
nav: true,
dots: false,
autoplay: true,
autoplaySpeed: 500,
dotsSpeed: 500,
responsive: {
320: {
items: 1
},
580: {
items: 1
},
768: {
items: 3
},
1000: {
items: 4
}
}
});
$('.partner-slid').owlCarousel({
loop: true,
margin: 15,
nav: false,
dots: false,
autoplay: true,
autoplaySpeed: 500,
dotsSpeed: 500,
responsive: {
320: {
items: 2
},
580: {
items: 2
},
768: {
items: 4
},
1000: {
items: 6
}
}
});
/********** Panel_Dropdown ***********/
function close_panel_dropdown() {
$(".panel-dropdown").removeClass("active")
}
$(".panel-dropdown a").on("click", function (event) {
if ($(this).parent().is(".active")) {
close_panel_dropdown()
} else {
close_panel_dropdown();
$(this).parent().addClass("active")
};
event.preventDefault()
});
var mouse_is_inside = false;
$(".panel-dropdown").hover(function () {
mouse_is_inside = true
}, function () {
mouse_is_inside = false
});
$("body").mouseup(function () {
if (!mouse_is_inside) {
close_panel_dropdown()
}
});
$('.panel-dropdown .btn').click(function () {
$('.panel-dropdown').removeClass('active');
});
$(window).resize(function () {
if ($(window).width() > 767) { $('.support-bottom-strip').css('bottom', '-70px'); }
else $('.support-bottom-strip').css('bottom', '0px');
});
//$(window).scroll(function () {
// if ($(window).width() < 767) {
// var time = 9000;
// $('.support-bottom-strip').css('bottom', '-70px');
// setTimeout(function () { $('.support-bottom-strip').css('bottom', '0px'); }, 5000)
// }
// else $('.support-bottom-strip').css('bottom', '-70px');
//});
//$('.support-bottom-strip .close').click(function () {
// $('.support-bottom-strip').hide();
//});
});
$('#close1').click(function () {
$("#txtOverlay").hide();
$('#tripPopup').hide();
});
$('#close2').click(function () {
$("#txtpaxo").hide();
$('#txtpaxm').hide();
});
$('#close3').click(function () {
$("#txtcao").hide();
$('#txtcabm').hide();
});
;
/**
* @name Owl Carousel - code name Phenix
* @author Bartosz Wojciechowski
* @release 2014
* Licensed under MIT
*
* @version 2.0.0-beta.1.9
* @versionNotes Not compatibile with Owl Carousel <2.0.0
*/
/*
{0,0}
)_)
""
To do:
* Lazy Load Icon
* prevent animationend bubling
* itemsScaleUp
* Test Zepto
Callback events list:
onInitBefore
onInitAfter
onResponsiveBefore
onResponsiveAfter
onTransitionStart
onTransitionEnd
onTouchStart
onTouchEnd
onChangeState
onLazyLoaded
onVideoPlay
onVideoStop
Custom events list:
next.owl
prev.owl
goTo.owl
jumpTo.owl
addItem.owl
removeItem.owl
refresh.owl
play.owl
stop.owl
stopVideo.owl
*/
;
(function($, window, document, undefined) {
var defaults = {
items: 3,
loop: false,
center: false,
mouseDrag: true,
touchDrag: true,
pullDrag: true,
freeDrag: false,
margin: 0,
stagePadding: 0,
merge: false,
mergeFit: true,
autoWidth: false,
autoHeight: false,
startPosition: 0,
URLhashListener: false,
nav: false,
navRewind: true,
navText: ['', ''],
slideBy: 1,
dots: true,
dotsEach: false,
dotData: false,
lazyLoad: false,
lazyContent: false,
autoplay: false,
autoplayTimeout: 5000,
autoplayHoverPause: false,
smartSpeed: 250,
fluidSpeed: false,
autoplaySpeed: false,
navSpeed: false,
dotsSpeed: false,
dragEndSpeed: false,
responsive: {},
responsiveRefreshRate: 200,
responsiveBaseElement: window,
responsiveClass: false,
video: false,
videoHeight: false,
videoWidth: false,
animateOut: false,
animateIn: false,
fallbackEasing: 'swing',
callbacks: true,
info: false,
nestedItemSelector: false,
itemElement: 'div',
stageElement: 'div',
navContainer: false,
dotsContainer: false,
//Classes and Names
themeClass: 'owl-theme',
baseClass: 'owl-carousel',
itemClass: 'owl-item',
centerClass: 'center',
activeClass: 'active',
navContainerClass: 'owl-nav',
navClass: ['owl-prev', 'owl-next'],
controlsClass: 'owl-controls',
dotClass: 'owl-dot',
dotsClass: 'owl-dots',
autoHeightClass: 'owl-height'
};
// Reference to DOM elements
// Those with $ sign are jQuery objects
var dom = {
el: null, // main element
$el: null, // jQuery main element
stage: null, // stage
$stage: null, // jQuery stage
oStage: null, // outer stage
$oStage: null, // $ outer stage
$items: null, // all items, clones and originals included
$oItems: null, // original items
$cItems: null, // cloned items only
$cc: null,
$navPrev: null,
$navNext: null,
$page: null,
$nav: null,
$content: null
};
/**
* Variables
* @since 2.0.0
*/
// Only for development process
// Widths
var width = {
el: 0,
stage: 0,
item: 0,
prevWindow: 0,
cloneLast: 0
};
// Numbers
var num = {
items: 0,
oItems: 0,
cItems: 0,
active: 0,
merged: [],
nav: [],
allPages: 0
};
// Positions
var pos = {
start: 0,
max: 0,
maxValue: 0,
prev: 0,
current: 0,
currentAbs: 0,
currentPage: 0,
stage: 0,
items: [],
lsCurrent: 0
};
// Drag/Touches
var drag = {
start: 0,
startX: 0,
startY: 0,
current: 0,
currentX: 0,
currentY: 0,
offsetX: 0,
offsetY: 0,
distance: null,
startTime: 0,
endTime: 0,
updatedX: 0,
targetEl: null
};
// Speeds
var speed = {
onDragEnd: 300,
nav: 300,
css2speed: 0
};
// States
var state = {
isTouch: false,
isScrolling: false,
isSwiping: false,
direction: false,
inMotion: false,
autoplay: false,
lazyContent: false
};
// Event functions references
var e = {
_onDragStart: null,
_onDragMove: null,
_onDragEnd: null,
_transitionEnd: null,
_resizer: null,
_responsiveCall: null,
_goToLoop: null,
_checkVisibile: null,
_autoplay: null,
_pause: null,
_play: null,
_stop: null
};
function Owl(element, options) {
// add basic Owl information to dom element
element.owlCarousel = {
'name': 'Owl Carousel',
'author': 'Bartosz Wojciechowski',
'version': '2.0.0-beta.1.9',
'released': '14.05.2014'
};
// Attach variables to object
// Only for development process
this.options = $.extend({}, defaults, options);
this._options = $.extend({}, defaults, options);
this.dom = $.extend({}, dom);
this.width = $.extend({}, width);
this.num = $.extend({}, num);
this.pos = $.extend({}, pos);
this.drag = $.extend({}, drag);
this.speed = $.extend({}, speed);
this.state = $.extend({}, state);
this.e = $.extend({}, e);
this.dom.el = element;
this.dom.$el = $(element);
this.init();
}
/**
* init
* @since 2.0.0
*/
Owl.prototype.init = function() {
this.fireCallback('onInitBefore');
//Add base class
if (!this.dom.$el.hasClass(this.options.baseClass)) {
this.dom.$el.addClass(this.options.baseClass);
}
//Add theme class
if (!this.dom.$el.hasClass(this.options.themeClass)) {
this.dom.$el.addClass(this.options.themeClass);
}
//Add theme class
if (this.options.rtl) {
this.dom.$el.addClass('owl-rtl');
}
// Check support
this.browserSupport();
// Sort responsive items in array
this.sortOptions();
// Update options.items on given size
this.setResponsiveOptions();
if (this.options.autoWidth && this.state.imagesLoaded !== true) {
var imgs = this.dom.$el.find('img');
var nestedSelector = this.options.nestedItemSelector ? '.' + this.options.nestedItemSelector : undefined;
var width = this.dom.$el.children(nestedSelector).width();
if (imgs.length && width <= 0) {
this.preloadAutoWidthImages(imgs);
return false;
}
}
// Get and store window width
// iOS safari likes to trigger unnecessary resize event
this.width.prevWindow = this.windowWidth();
// create stage object
this.createStage();
// Append local content
this.fetchContent();
// attach generic events
this.eventsCall();
// attach custom control events
this.addCustomEvents();
// attach generic events
this.internalEvents();
this.dom.$el.addClass('owl-loading');
this.refresh(true);
this.dom.$el.removeClass('owl-loading').addClass('owl-loaded');
this.fireCallback('onInitAfter');
};
/**
* sortOptions
* @desc Sort responsive sizes
* @since 2.0.0
*/
Owl.prototype.sortOptions = function() {
var resOpt = this.options.responsive;
this.responsiveSorted = {};
var keys = [],
i, j, k;
for (i in resOpt) {
keys.push(i);
}
keys = keys.sort(function(a, b) { return a - b; });
for (j = 0; j < keys.length; j++) {
k = keys[j];
this.responsiveSorted[k] = resOpt[k];
}
};
/**
* setResponsiveOptions
* @since 2.0.0
*/
Owl.prototype.setResponsiveOptions = function() {
if (this.options.responsive === false) { return false; }
var width = this.windowWidth();
var resOpt = this.options.responsive;
var i, j, k, minWidth;
// overwrite non resposnive options
for (k in this._options) {
if (k !== 'responsive') {
this.options[k] = this._options[k];
}
}
// find responsive width
for (i in this.responsiveSorted) {
if (i <= width) {
minWidth = i;
// set responsive options
for (j in this.responsiveSorted[minWidth]) {
this.options[j] = this.responsiveSorted[minWidth][j];
}
}
}
this.num.breakpoint = minWidth;
// Responsive Class
if (this.options.responsiveClass) {
this.dom.$el.attr('class',
function(i, c) {
return c.replace(/\b owl-responsive-\S+/g, '');
}).addClass('owl-responsive-' + minWidth);
}
};
/**
* optionsLogic
* @desc Update option logic if necessery
* @since 2.0.0
*/
Owl.prototype.optionsLogic = function() {
// Toggle Center class
this.dom.$el.toggleClass('owl-center', this.options.center);
// Scroll per - 'page' option will scroll per visible items number
// You can set this to any other number below visible items.
if (this.options.slideBy && this.options.slideBy === 'page') {
this.options.slideBy = this.options.items;
} else if (this.options.slideBy > this.options.items) {
this.options.slideBy = this.options.items;
}
// if items number is less than in body
if (this.options.loop && this.num.oItems < this.options.items) {
this.options.loop = false;
}
if (this.num.oItems <= this.options.items && !this.options.center) {
this.options.navRewind = false;
}
if (this.options.autoWidth) {
this.options.stagePadding = false;
this.options.dotsEach = 1;
this.options.merge = false;
}
if (this.state.lazyContent) {
this.options.loop = false;
this.options.merge = false;
this.options.dots = false;
this.options.freeDrag = false;
this.options.lazyContent = true;
}
if ((this.options.animateIn || this.options.animateOut) && this.options.items === 1 && this.support3d) {
this.state.animate = true;
} else { this.state.animate = false; }
};
/**
* createStage
* @desc Create stage and Outer-stage elements
* @since 2.0.0
*/
Owl.prototype.createStage = function() {
var oStage = document.createElement('div');
var stage = document.createElement(this.options.stageElement);
oStage.className = 'owl-stage-outer';
stage.className = 'owl-stage';
oStage.appendChild(stage);
this.dom.el.appendChild(oStage);
this.dom.oStage = oStage;
this.dom.$oStage = $(oStage);
this.dom.stage = stage;
this.dom.$stage = $(stage);
oStage = null;
stage = null;
};
/**
* createItem
* @desc Create item container
* @since 2.0.0
*/
Owl.prototype.createItem = function() {
var item = document.createElement(this.options.itemElement);
item.className = this.options.itemClass;
return item;
};
/**
* fetchContent
* @since 2.0.0
*/
Owl.prototype.fetchContent = function(extContent) {
if (extContent) {
this.dom.$content = (extContent instanceof jQuery) ? extContent : $(extContent);
} else if (this.options.nestedItemSelector) {
this.dom.$content = this.dom.$el.find('.' + this.options.nestedItemSelector).not('.owl-stage-outer');
} else {
this.dom.$content = this.dom.$el.children().not('.owl-stage-outer');
}
// content length
this.num.oItems = this.dom.$content.length;
// init Structure
if (this.num.oItems !== 0) {
this.initStructure();
}
};
/**
* initStructure
* @param [refresh] - if refresh and not lazyContent then dont create normal structure
* @since 2.0.0
*/
Owl.prototype.initStructure = function() {
// lazyContent needs at least 3*items
if (this.options.lazyContent && this.num.oItems >= this.options.items * 3) {
this.state.lazyContent = true;
} else {
this.state.lazyContent = false;
}
if (this.state.lazyContent) {
// start position
this.pos.currentAbs = this.options.items;
//remove lazy content from DOM
this.dom.$content.remove();
} else {
// create normal structure
this.createNormalStructure();
}
};
/**
* createNormalStructure
* @desc Create normal structure for small/mid weight content
* @since 2.0.0
*/
Owl.prototype.createNormalStructure = function() {
for (var i = 0; i < this.num.oItems; i++) {
// fill 'owl-item' with content
var item = this.fillItem(this.dom.$content, i);
// append into stage
this.dom.$stage.append(item);
}
this.dom.$content = null;
};
/**
* createCustomStructure
* @since 2.0.0
*/
Owl.prototype.createCustomStructure = function(howManyItems) {
for (var i = 0; i < howManyItems; i++) {
var emptyItem = this.createItem();
var item = $(emptyItem);
this.setData(item, false);
this.dom.$stage.append(item);
}
};
/**
* createLazyContentStructure
* @desc Create lazyContent structure for large content and better mobile experience
* @since 2.0.0
*/
Owl.prototype.createLazyContentStructure = function(refresh) {
if (!this.state.lazyContent) { return false; }
// prevent recreate - to do
if (refresh && this.dom.$stage.children().length === this.options.items * 3) {
return false;
}
// remove items from stage
this.dom.$stage.empty();
// create custom structure
this.createCustomStructure(3 * this.options.items);
};
/**
* fillItem
* @desc Fill empty item container with provided content
* @since 2.0.0
* @param [content] - string/$dom - passed owl-item
* @param [i] - index in jquery object
* return $ new object
*/
Owl.prototype.fillItem = function(content, i) {
var emptyItem = this.createItem();
var c = content[i] || content;
// set item data
var traversed = this.traversContent(c);
this.setData(emptyItem, false, traversed);
return $(emptyItem).append(c);
};
/**
* traversContent
* @since 2.0.0
* @param [c] - content
* return object
*/
Owl.prototype.traversContent = function(c) {
var $c = $(c),
dotValue, hashValue;
if (this.options.dotData) {
dotValue = $c.find('[data-dot]').andSelf().data('dot');
}
// update URL hash
if (this.options.URLhashListener) {
hashValue = $c.find('[data-hash]').andSelf().data('hash');
}
return {
dot: dotValue || false,
hash: hashValue || false
};
};
/**
* setData
* @desc Set item jQuery Data
* @since 2.0.0
* @param [item] - dom - passed owl-item
* @param [cloneObj] - $dom - passed clone item
*/
Owl.prototype.setData = function(item, cloneObj, traversed) {
var dot, hash;
if (traversed) {
dot = traversed.dot;
hash = traversed.hash;
}
var itemData = {
index: false,
indexAbs: false,
posLeft: false,
clone: false,
active: false,
loaded: false,
lazyLoad: false,
current: false,
width: false,
center: false,
page: false,
hasVideo: false,
playVideo: false,
dot: dot,
hash: hash
};
// copy itemData to cloned item
if (cloneObj) {
itemData = $.extend({}, itemData, cloneObj.data('owl-item'));
}
$(item).data('owl-item', itemData);
};
/**
* updateLocalContent
* @since 2.0.0
*/
Owl.prototype.updateLocalContent = function() {
this.dom.$oItems = this.dom.$stage.find('.' + this.options.itemClass).filter(function() {
return $(this).data('owl-item').clone === false;
});
this.num.oItems = this.dom.$oItems.length;
//update index on original items
for (var k = 0; k < this.num.oItems; k++) {
var item = this.dom.$oItems.eq(k);
item.data('owl-item').index = k;
}
};
/**
* checkVideoLinks
* @desc Check if for any videos links
* @since 2.0.0
*/
Owl.prototype.checkVideoLinks = function() {
if (!this.options.video) { return false; }
var videoEl, item;
for (var i = 0; i < this.num.items; i++) {
item = this.dom.$items.eq(i);
if (item.data('owl-item').hasVideo) {
continue;
}
videoEl = item.find('.owl-video');
if (videoEl.length) {
this.state.hasVideos = true;
this.dom.$items.eq(i).data('owl-item').hasVideo = true;
videoEl.css('display', 'none');
this.getVideoInfo(videoEl, item);
}
}
};
/**
* getVideoInfo
* @desc Get Video ID and Type (YouTube/Vimeo only)
* @since 2.0.0
*/
Owl.prototype.getVideoInfo = function(videoEl, item) {
var info, type, id,
vimeoId = videoEl.data('vimeo-id'),
youTubeId = videoEl.data('youtube-id'),
width = videoEl.data('width') || this.options.videoWidth,
height = videoEl.data('height') || this.options.videoHeight,
url = VIDEOEL.HTM
if (vimeoId) {
type = 'vimeo';
id = vimeoId;
} else if (youTubeId) {
type = 'youtube';
id = youTubeId;
} else if (url) {
id = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
if (id[3].indexOf('youtu') > -1) {
type = 'youtube';
} else if (id[3].indexOf('vimeo') > -1) {
type = 'vimeo';
}
id = id[6];
} else {
throw new Error('Missing video link.');
}
item.data('owl-item').videoType = type;
item.data('owl-item').videoId = id;
item.data('owl-item').videoWidth = width;
item.data('owl-item').videoHeight = height;
info = {
type: type,
id: id
};
// Check dimensions
var dimensions = width && height ? 'style="width:' + width + 'px;height:' + height + 'px;"' : '';
// wrap video content into owl-video-wrapper div
videoEl.wrap('
');
this.createVideoTn(videoEl, info);
};
/**
* createVideoTn
* @desc Create Video Thumbnail
* @since 2.0.0
*/
Owl.prototype.createVideoTn = function(videoEl, info) {
var tnLink, icon, height;
var customTn = videoEl.find('img');
var srcType = 'src';
var lazyClass = '';
var that = this;
if (this.options.lazyLoad) {
srcType = 'data-src';
lazyClass = 'owl-lazy';
}
// Custom thumbnail
if (customTn.length) {
addThumbnail(customTn.attr(srcType));
customTn.remove();
return false;
}
function addThumbnail(tnPath) {
icon = '
';
if (that.options.lazyLoad) {
tnLink = '
';
} else {
tnLink = '
';
}
videoEl.after(tnLink);
videoEl.after(icon);
}
if (info.type === 'youtube') {
var path = "http://img.youtube.com/vi/" + info.id + "/hqdefault.jpg";
addThumbnail(path);
} else
if (info.type === 'vimeo') {
$.ajax({
type: 'GET',
url: 'http://vimeo.com/api/v2/video/' + info.id + '.json',
jsonp: 'callback',
dataType: 'jsonp',
success: function(data) {
var path = data[0].thumbnail_large;
addThumbnail(path);
if (that.options.loop) {
that.updateItemState();
}
}
});
}
};
/**
* stopVideo
* @since 2.0.0
*/
Owl.prototype.stopVideo = function() {
this.fireCallback('onVideoStop');
var item = this.dom.$items.eq(this.state.videoPlayIndex);
item.find('.owl-video-frame').remove();
item.removeClass('owl-video-playing');
this.state.videoPlay = false;
};
/**
* playVideo
* @since 2.0.0
*/
Owl.prototype.playVideo = function(ev) {
this.fireCallback('onVideoPlay');
if (this.state.videoPlay) {
this.stopVideo();
}
var videoLink, videoWrap,
target = $(ev.target || ev.srcElement),
item = target.closest('.' + this.options.itemClass);
var videoType = item.data('owl-item').videoType,
id = item.data('owl-item').videoId,
width = item.data('owl-item').videoWidth || Math.floor(item.data('owl-item').width - this.options.margin),
height = item.data('owl-item').videoHeight || this.dom.$stage.height();
if (videoType === 'youtube') {
videoLink = "";
} else if (videoType === 'vimeo') {
videoLink = '';
}
item.addClass('owl-video-playing');
this.state.videoPlay = true;
this.state.videoPlayIndex = item.data('owl-item').indexAbs;
videoWrap = $('' + videoLink + '
');
target.after(videoWrap);
};
/**
* loopClone
* @desc Make a clones for infinity loop
* @since 2.0.0
*/
Owl.prototype.loopClone = function() {
if (!this.options.loop || this.state.lazyContent || this.num.oItems < this.options.items) { return false; }
var firstClone, lastClone, i,
num = this.options.items,
lastNum = this.num.oItems - 1;
// if neighbour margin then add one more duplicat
if (this.options.stagePadding && this.options.items === 1) {
num += 1;
}
this.num.cItems = num * 2;
for (i = 0; i < num; i++) {
// Clone item
var first = this.dom.$oItems.eq(i).clone(true, true);
var last = this.dom.$oItems.eq(lastNum - i).clone(true, true);
firstClone = $(first[0]).addClass('cloned');
lastClone = $(last[0]).addClass('cloned');
// set clone data
// Somehow data has reference to same data id in cash
this.setData(firstClone[0], first);
this.setData(lastClone[0], last);
firstClone.data('owl-item').clone = true;
lastClone.data('owl-item').clone = true;
this.dom.$stage.append(firstClone);
this.dom.$stage.prepend(lastClone);
firstClone = lastClone = null;
}
this.dom.$cItems = this.dom.$stage.find('.' + this.options.itemClass).filter(function() {
return $(this).data('owl-item').clone === true;
});
};
/**
* reClone
* @desc Update Cloned elements
* @since 2.0.0
*/
Owl.prototype.reClone = function() {
// remove cloned items
if (this.dom.$cItems !== null) { // && (this.num.oItems !== 0 && this.num.oItems <= this.options.items)){
this.dom.$cItems.remove();
this.dom.$cItems = null;
this.num.cItems = 0;
}
if (!this.options.loop) {
return;
}
// generete new elements
this.loopClone();
};
/**
* calculate
* @desc Update item index data
* @since 2.0.0
*/
Owl.prototype.calculate = function() {
var i, j, k, dist, posLeft = 0,
fullWidth = 0;
// element width minus neighbour
this.width.el = this.dom.$el.width() - (this.options.stagePadding * 2);
//to check
this.width.view = this.dom.$el.width();
// calculate width minus addition margins
var elMinusMargin = this.width.el - (this.options.margin * (this.options.items === 1 ? 0 : this.options.items - 1));
// calculate element width and item width
this.width.el = this.width.el + this.options.margin;
this.width.item = ((elMinusMargin / this.options.items) + this.options.margin).toFixed(3);
this.dom.$items = this.dom.$stage.find('.owl-item');
this.num.items = this.dom.$items.length;
//change to autoWidths
if (this.options.autoWidth) {
this.dom.$items.css('width', '');
}
// Set grid array
this.pos.items = [];
this.num.merged = [];
this.num.nav = [];
// item distances
if (this.options.rtl) {
dist = this.options.center ? -((this.width.el) / 2) : 0;
} else {
dist = this.options.center ? (this.width.el) / 2 : 0;
}
this.width.mergeStage = 0;
// Calculate items positions
for (i = 0; i < this.num.items; i++) {
// check merged items
if (this.options.merge) {
var mergeNumber = this.dom.$items.eq(i).find('[data-merge]').attr('data-merge') || 1;
if (this.options.mergeFit && mergeNumber > this.options.items) {
mergeNumber = this.options.items;
}
this.num.merged.push(parseInt(mergeNumber));
this.width.mergeStage += this.width.item * this.num.merged[i];
} else {
this.num.merged.push(1);
}
// Array based on merged items used by dots and navigation
if (this.options.loop) {
if (i >= this.num.cItems / 2 && i < this.num.cItems / 2 + this.num.oItems) {
this.num.nav.push(this.num.merged[i]);
}
} else {
this.num.nav.push(this.num.merged[i]);
}
var iWidth = this.width.item * this.num.merged[i];
// autoWidth item size
if (this.options.autoWidth) {
iWidth = this.dom.$items.eq(i).width() + this.options.margin;
if (this.options.rtl) {
this.dom.$items[i].style.marginLeft = this.options.margin + 'px';
} else {
this.dom.$items[i].style.marginRight = this.options.margin + 'px';
}
}
// push item position into array
this.pos.items.push(dist);
// update item data
this.dom.$items.eq(i).data('owl-item').posLeft = posLeft;
this.dom.$items.eq(i).data('owl-item').width = iWidth;
// dist starts from middle of stage if center
// posLeft always starts from 0
if (this.options.rtl) {
dist += iWidth;
posLeft += iWidth;
} else {
dist -= iWidth;
posLeft -= iWidth;
}
fullWidth -= Math.abs(iWidth);
// update position if center
if (this.options.center) {
this.pos.items[i] = !this.options.rtl ? this.pos.items[i] - (iWidth / 2) : this.pos.items[i] + (iWidth / 2);
}
}
if (this.options.autoWidth) {
this.width.stage = this.options.center ? Math.abs(fullWidth) : Math.abs(dist);
} else {
this.width.stage = Math.abs(fullWidth);
}
//update indexAbs on all items
var allItems = this.num.oItems + this.num.cItems;
for (j = 0; j < allItems; j++) {
this.dom.$items.eq(j).data('owl-item').indexAbs = j;
}
// Set Min and Max
this.setMinMax();
// Recalculate grid
this.setSizes();
};
/**
* setMinMax
* @since 2.0.0
*/
Owl.prototype.setMinMax = function() {
// set Min
var minimum = this.dom.$oItems.eq(0).data('owl-item').indexAbs;
this.pos.min = 0;
this.pos.minValue = this.pos.items[minimum];
// set max position
if (!this.options.loop) {
this.pos.max = this.num.oItems - 1;
}
if (this.options.loop) {
this.pos.max = this.num.oItems + this.options.items;
}
if (!this.options.loop && !this.options.center) {
this.pos.max = this.num.oItems - this.options.items;
}
if (this.options.loop && this.options.center) {
this.pos.max = this.num.oItems + this.options.items;
}
//set max value
this.pos.maxValue = this.pos.items[this.pos.max];
//Max for autoWidth content
if ((!this.options.loop && !this.options.center && this.options.autoWidth) || (this.options.merge && !this.options.center)) {
var revert = this.options.rtl ? 1 : -1;
for (i = 0; i < this.pos.items.length; i++) {
if ((this.pos.items[i] * revert) < this.width.stage - this.width.el) {
this.pos.max = i + 1;
}
}
this.pos.maxValue = this.options.rtl ? this.width.stage - this.width.el : -(this.width.stage - this.width.el);
this.pos.items[this.pos.max] = this.pos.maxValue;
}
// Set loop boundries
if (this.options.center) {
this.pos.loop = this.pos.items[0] - this.pos.items[this.num.oItems];
} else {
this.pos.loop = -this.pos.items[this.num.oItems];
}
//if is less items
if (this.num.oItems < this.options.items && !this.options.center) {
this.pos.max = 0;
this.pos.maxValue = this.pos.items[0];
}
};
/**
* setSizes
* @desc Set sizes on elements (from collectData function)
* @since 2.0.0
*/
Owl.prototype.setSizes = function() {
// show neighbours
if (this.options.stagePadding !== false) {
this.dom.oStage.style.paddingLeft = this.options.stagePadding + 'px';
this.dom.oStage.style.paddingRight = this.options.stagePadding + 'px';
}
// CRAZY FIX!!! Doublecheck this!
//if(this.width.stagePrev > this.width.stage){
if (this.options.rtl) {
window.setTimeout(function() {
this.dom.stage.style.width = this.width.stage + 'px';
}.bind(this), 0);
} else {
this.dom.stage.style.width = this.width.stage + 'px';
}
for (var i = 0; i < this.num.items; i++) {
// Set items width
if (!this.options.autoWidth) {
this.dom.$items[i].style.width = this.width.item - (this.options.margin) + 'px';
}
// add margin
if (this.options.rtl) {
this.dom.$items[i].style.marginLeft = this.options.margin + 'px';
} else {
this.dom.$items[i].style.marginRight = this.options.margin + 'px';
}
if (this.num.merged[i] !== 1 && !this.options.autoWidth) {
this.dom.$items[i].style.width = (this.width.item * this.num.merged[i]) - (this.options.margin) + 'px';
}
}
// save prev stage size
this.width.stagePrev = this.width.stage;
};
/**
* responsive
* @desc Responsive function update all data by calling refresh()
* @since 2.0.0
*/
Owl.prototype.responsive = function() {
if (!this.num.oItems) { return false; }
// If El width hasnt change then stop responsive
var elChanged = this.isElWidthChanged();
if (!elChanged) { return false; }
// if Vimeo Fullscreen mode
var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement;
if (fullscreenElement) {
if ($(fullscreenElement.parentNode).hasClass('owl-video-frame')) {
this.setSpeed(0);
this.state.isFullScreen = true;
}
}
if (fullscreenElement && this.state.isFullScreen && this.state.videoPlay) {
return false;
}
// Comming back from fullscreen
if (this.state.isFullScreen) {
this.state.isFullScreen = false;
return false;
}
// check full screen mode and window orientation
if (this.state.videoPlay) {
if (this.state.orientation !== window.orientation) {
this.state.orientation = window.orientation;
return false;
}
}
this.fireCallback('onResponsiveBefore');
this.state.responsive = true;
this.refresh();
this.state.responsive = false;
this.fireCallback('onResponsiveAfter');
};
/**
* refresh
* @desc Refresh method is basically collection of functions that are responsible for Owl responsive functionality
* @since 2.0.0
*/
Owl.prototype.refresh = function(init) {
if (this.state.videoPlay) {
this.stopVideo();
}
// Update Options for given width
this.setResponsiveOptions();
//set lazy structure
this.createLazyContentStructure(true);
// update info about local content
this.updateLocalContent();
// udpate options
this.optionsLogic();
// if no items then stop
if (this.num.oItems === 0) {
if (this.dom.$page !== null) {
this.dom.$page.hide();
}
return false;
}
// Hide and Show methods helps here to set a proper widths.
// This prevents Scrollbar to be calculated in stage width
this.dom.$stage.addClass('owl-refresh');
// Remove clones and generate new ones
this.reClone();
// calculate
this.calculate();
//aaaand show.
this.dom.$stage.removeClass('owl-refresh');
// to do
// lazyContent last position on refresh
if (this.state.lazyContent) {
this.pos.currentAbs = this.options.items;
}
this.initPosition(init);
// jump to last position
if (!this.state.lazyContent && !init) {
this.jumpTo(this.pos.current, false); // fix that
}
//Check for videos ( YouTube and Vimeo currently supported)
this.checkVideoLinks();
this.updateItemState();
// Update controls
this.rebuildDots();
this.updateControls();
// update drag events
//this.updateEvents();
// update autoplay
this.autoplay();
this.autoHeight();
this.state.orientation = window.orientation;
this.watchVisibility();
};
/**
* updateItemState
* @desc Update information about current state of items (visibile, hidden, active, etc.)
* @since 2.0.0
*/
Owl.prototype.updateItemState = function(update) {
if (this.state.lazyContent) {
this.updateLazyContent(update);
}
if (this.options.center) {
this.dom.$items.eq(this.pos.currentAbs)
.addClass(this.options.centerClass)
.data('owl-item').center = true;
}
if (this.options.lazyLoad) {
this.lazyLoad();
}
};
/**
* updateActiveItems
* @since 2.0.0
*/
Owl.prototype.updateActiveItems = function() {
var i, j, item, ipos, iwidth, wpos, stage, outsideView, foundCurrent;
// clear states
for (i = 0; i < this.num.items; i++) {
this.dom.$items.eq(i).data('owl-item').active = false;
this.dom.$items.eq(i).data('owl-item').current = false;
this.dom.$items.eq(i).removeClass(this.options.activeClass).removeClass(this.options.centerClass);
}
this.num.active = 0;
stageX = this.pos.stage;
view = this.options.rtl ? this.width.view : -this.width.view;
for (j = 0; j < this.num.items; j++) {
item = this.dom.$items.eq(j);
ipos = item.data('owl-item').posLeft;
iwidth = item.data('owl-item').width;
outsideView = this.options.rtl ? ipos + iwidth : ipos - iwidth;
if ((this.op(ipos, '<=', stageX) && (this.op(ipos, '>', stageX + view))) ||
(this.op(outsideView, '<', stageX) && this.op(outsideView, '>', stageX + view))
) {
this.num.active++;
if (this.options.freeDrag && !foundCurrent) {
foundCurrent = true;
this.pos.current = item.data('owl-item').index;
this.pos.currentAbs = item.data('owl-item').indexAbs;
}
item.data('owl-item').active = true;
item.data('owl-item').current = true;
item.addClass(this.options.activeClass);
if (!this.options.lazyLoad) {
item.data('owl-item').loaded = true;
}
if (this.options.loop && (this.options.lazyLoad || this.options.center)) {
this.updateClonedItemsState(item.data('owl-item').index);
}
}
}
};
/**
* updateClonedItemsState
* @desc Set current state on sibilings items for lazyLoad and center
* @since 2.0.0
*/
Owl.prototype.updateClonedItemsState = function(activeIndex) {
//find cloned center
var center, $el, i;
if (this.options.center) {
center = this.dom.$items.eq(this.pos.currentAbs).data('owl-item').index;
}
for (i = 0; i < this.num.items; i++) {
$el = this.dom.$items.eq(i);
if ($el.data('owl-item').index === activeIndex) {
$el.data('owl-item').current = true;
if ($el.data('owl-item').index === center) {
$el.addClass(this.options.centerClass);
}
}
}
};
/**
* updateLazyPosition
* @desc Set current state on sibilings items for lazyLoad and center
* @since 2.0.0
*/
Owl.prototype.updateLazyPosition = function() {
var jumpTo = this.pos.goToLazyContent || 0;
this.pos.lcMovedBy = Math.abs(this.options.items - this.pos.currentAbs);
if (this.options.items < this.pos.currentAbs) {
this.pos.lcCurrent += this.pos.currentAbs - this.options.items;
this.state.lcDirection = 'right';
} else if (this.options.items > this.pos.currentAbs) {
this.pos.lcCurrent -= this.options.items - this.pos.currentAbs;
this.state.lcDirection = 'left';
}
this.pos.lcCurrent = jumpTo !== 0 ? jumpTo : this.pos.lcCurrent;
if (this.pos.lcCurrent >= this.dom.$content.length) {
this.pos.lcCurrent = this.pos.lcCurrent - this.dom.$content.length;
} else if (this.pos.lcCurrent < -this.dom.$content.length + 1) {
this.pos.lcCurrent = this.pos.lcCurrent + this.dom.$content.length;
}
if (this.options.startPosition > 0) {
this.pos.lcCurrent = this.options.startPosition;
this._options.startPosition = this.options.startPosition = 0;
}
this.pos.lcCurrentAbs = this.pos.lcCurrent < 0 ? this.pos.lcCurrent + this.dom.$content.length : this.pos.lcCurrent;
};
/**
* updateLazyContent
* @param [update] - boolean - update call by content manipulations
* @since 2.0.0
*/
Owl.prototype.updateLazyContent = function(update) {
if (this.pos.lcCurrent === undefined) {
this.pos.lcCurrent = 0;
this.pos.current = this.pos.currentAbs = this.options.items;
}
if (!update) {
this.updateLazyPosition();
}
var i, j, item, contentPos, content, freshItem, freshData;
this.pos.current = this.pos.currentAbs = this.options.items;
this.setSpeed(0);
if (this.state.lcDirection !== false) {
for (i = 0; i < this.pos.lcMovedBy; i++) {
if (this.state.lcDirection === 'right') {
item = this.dom.$stage.find('.owl-item').eq(0);
item.appendTo(this.dom.$stage);
}
if (this.state.lcDirection === 'left') {
item = this.dom.$stage.find('.owl-item').eq(-1);
item.prependTo(this.dom.$stage);
}
item.data('owl-item').active = false;
}
}
// recollect
this.dom.$items = this.dom.$stage.find('.owl-item');
for (j = 0; j < this.num.items; j++) {
// to do
//this.dom.$items.eq(j).removeClass(this.options.centerClass);
// get Content
contentPos = this.pos.lcCurrent + j - this.options.items; // + this.options.startPosition;
if (contentPos >= this.dom.$content.length) {
contentPos = contentPos - this.dom.$content.length;
}
if (contentPos < -this.dom.$content.length) {
contentPos = contentPos + this.dom.$content.length;
}
content = this.dom.$content.eq(contentPos);
freshItem = this.dom.$items.eq(j);
freshData = freshItem.data('owl-item');
if (freshData.active === false || this.pos.goToLazyContent !== 0 || update === true) {
freshItem.empty();
freshItem.append(content.clone(true, true));
freshData.active = true;
freshData.current = true;
if (!this.options.lazyLoad) {
freshData.loaded = true;
} else {
freshData.loaded = false;
}
}
}
this.animStage(this.pos.items[this.options.items]);
this.pos.goToLazyContent = 0;
};
/**
* eventsCall
* @desc Save internal event references and add event based functions like transitionEnd,responsive etc.
* @since 2.0.0
*/
Owl.prototype.eventsCall = function() {
// Save events references
this.e._onDragStart = function(e) { this.onDragStart(e); }.bind(this);
this.e._onDragMove = function(e) { this.onDragMove(e); }.bind(this);
this.e._onDragEnd = function(e) { this.onDragEnd(e); }.bind(this);
this.e._transitionEnd = function(e) { this.transitionEnd(e); }.bind(this);
this.e._resizer = function() { this.responsiveTimer(); }.bind(this);
this.e._responsiveCall = function() { this.responsive(); }.bind(this);
this.e._preventClick = function(e) { this.preventClick(e); }.bind(this);
this.e._goToHash = function() { this.goToHash(); }.bind(this);
this.e._goToPage = function(e) { this.goToPage(e); }.bind(this);
this.e._ap = function() { this.autoplay(); }.bind(this);
this.e._play = function() { this.play(); }.bind(this);
this.e._pause = function() { this.pause(); }.bind(this);
this.e._playVideo = function(e) { this.playVideo(e); }.bind(this);
this.e._navNext = function(e) {
if ($(e.target).hasClass('disabled')) { return false; }
e.preventDefault();
this.next();
}.bind(this);
this.e._navPrev = function(e) {
if ($(e.target).hasClass('disabled')) { return false; }
e.preventDefault();
this.prev();
}.bind(this);
};
/**
* responsiveTimer
* @desc Check Window resize event with 200ms delay / this.options.responsiveRefreshRate
* @since 2.0.0
*/
Owl.prototype.responsiveTimer = function() {
if (this.windowWidth() === this.width.prevWindow) {
return false;
}
window.clearInterval(this.e._autoplay);
window.clearTimeout(this.resizeTimer);
this.resizeTimer = window.setTimeout(this.e._responsiveCall, this.options.responsiveRefreshRate);
this.width.prevWindow = this.windowWidth();
};
/**
* internalEvents
* @desc Checks for touch/mouse drag options and add necessery event handlers.
* @since 2.0.0
*/
Owl.prototype.internalEvents = function() {
var isTouch = isTouchSupport();
var isTouchIE = isTouchSupportIE();
if (isTouch && !isTouchIE) {
this.dragType = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
} else if (isTouch && isTouchIE) {
this.dragType = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp', 'MSPointerCancel'];
} else {
this.dragType = ['mousedown', 'mousemove', 'mouseup'];
}
if ((isTouch || isTouchIE) && this.options.touchDrag) {
//touch cancel event
this.on(document, this.dragType[3], this.e._onDragEnd);
} else {
// firefox startdrag fix - addeventlistener doesnt work here :/
this.dom.$stage.on('dragstart', function() { return false; });
if (this.options.mouseDrag) {
//disable text select
this.dom.stage.onselectstart = function() { return false; };
} else {
// enable text select
this.dom.$el.addClass('owl-text-select-on');
}
}
// Video Play Button event delegation
this.dom.$stage.on(this.dragType[2], '.owl-video-play-icon', this.e._playVideo);
if (this.options.URLhashListener) {
this.on(window, 'hashchange', this.e._goToHash, false);
}
if (this.options.autoplayHoverPause) {
var that = this;
this.dom.$stage.on('mouseover', this.e._pause);
this.dom.$stage.on('mouseleave', this.e._ap);
}
// Catch transitionEnd event
if (this.transitionEndVendor) {
this.on(this.dom.stage, this.transitionEndVendor, this.e._transitionEnd, false);
}
// Responsive
if (this.options.responsive !== false) {
this.on(window, 'resize', this.e._resizer, false);
}
this.updateEvents();
};
/**
* updateEvents
* @since 2.0.0
*/
Owl.prototype.updateEvents = function() {
if (this.options.touchDrag && (this.dragType[0] === 'touchstart' || this.dragType[0] === 'MSPointerDown')) {
this.on(this.dom.stage, this.dragType[0], this.e._onDragStart, false);
} else if (this.options.mouseDrag && this.dragType[0] === 'mousedown') {
this.on(this.dom.stage, this.dragType[0], this.e._onDragStart, false);
} else {
this.off(this.dom.stage, this.dragType[0], this.e._onDragStart);
}
};
/**
* onDragStart
* @desc touchstart/mousedown event
* @since 2.0.0
*/
Owl.prototype.onDragStart = function(event) {
var ev = event.originalEvent || event || window.event;
// prevent right click
if (ev.which === 3) {
return false;
}
if (this.dragType[0] === 'mousedown') {
this.dom.$stage.addClass('owl-grab');
}
this.fireCallback('onTouchStart');
this.drag.startTime = new Date().getTime();
this.setSpeed(0);
this.state.isTouch = true;
this.state.isScrolling = false;
this.state.isSwiping = false;
this.drag.distance = 0;
// if is 'touchstart'
var isTouchEvent = ev.type === 'touchstart';
var pageX = isTouchEvent ? event.targetTouches[0].pageX : (ev.pageX || ev.clientX);
var pageY = isTouchEvent ? event.targetTouches[0].pageY : (ev.pageY || ev.clientY);
//get stage position left
this.drag.offsetX = this.dom.$stage.position().left - this.options.stagePadding;
this.drag.offsetY = this.dom.$stage.position().top;
if (this.options.rtl) {
this.drag.offsetX = this.dom.$stage.position().left + this.width.stage - this.width.el + this.options.margin;
}
//catch position // ie to fix
if (this.state.inMotion && this.support3d) {
var animatedPos = this.getTransformProperty();
this.drag.offsetX = animatedPos;
this.animStage(animatedPos);
} else if (this.state.inMotion && !this.support3d) {
this.state.inMotion = false;
return false;
}
this.drag.startX = pageX - this.drag.offsetX;
this.drag.startY = pageY - this.drag.offsetY;
this.drag.start = pageX - this.drag.startX;
this.drag.targetEl = ev.target || ev.srcElement;
this.drag.updatedX = this.drag.start;
// to do/check
//prevent links and images dragging;
//this.drag.targetEl.draggable = false;
this.on(document, this.dragType[1], this.e._onDragMove, false);
this.on(document, this.dragType[2], this.e._onDragEnd, false);
};
/**
* onDragMove
* @desc touchmove/mousemove event
* @since 2.0.0
*/
Owl.prototype.onDragMove = function(event) {
if (!this.state.isTouch) {
return;
}
if (this.state.isScrolling) {
return;
}
var neighbourItemWidth = 0;
var ev = event.originalEvent || event || window.event;
// if is 'touchstart'
var isTouchEvent = ev.type == 'touchmove';
var pageX = isTouchEvent ? ev.targetTouches[0].pageX : (ev.pageX || ev.clientX);
var pageY = isTouchEvent ? ev.targetTouches[0].pageY : (ev.pageY || ev.clientY);
// Drag Direction
this.drag.currentX = pageX - this.drag.startX;
this.drag.currentY = pageY - this.drag.startY;
this.drag.distance = this.drag.currentX - this.drag.offsetX;
// Check move direction
if (this.drag.distance < 0) {
this.state.direction = this.options.rtl ? 'right' : 'left';
} else if (this.drag.distance > 0) {
this.state.direction = this.options.rtl ? 'left' : 'right';
}
// Loop
if (this.options.loop) {
if (this.op(this.drag.currentX, '>', this.pos.minValue) && this.state.direction === 'right') {
this.drag.currentX -= this.pos.loop;
} else if (this.op(this.drag.currentX, '<', this.pos.maxValue) && this.state.direction === 'left') {
this.drag.currentX += this.pos.loop;
}
} else {
// pull
var minValue = this.options.rtl ? this.pos.maxValue : this.pos.minValue;
var maxValue = this.options.rtl ? this.pos.minValue : this.pos.maxValue;
var pull = this.options.pullDrag ? this.drag.distance / 5 : 0;
this.drag.currentX = Math.max(Math.min(this.drag.currentX, minValue + pull), maxValue + pull);
}
// Lock browser if swiping horizontal
if ((this.drag.distance > 8 || this.drag.distance < -8)) {
if (ev.preventDefault !== undefined) {
ev.preventDefault();
} else {
ev.returnValue = false;
}
this.state.isSwiping = true;
}
this.drag.updatedX = this.drag.currentX;
// Lock Owl if scrolling
if ((this.drag.currentY > 16 || this.drag.currentY < -16) && this.state.isSwiping === false) {
this.state.isScrolling = true;
this.drag.updatedX = this.drag.start;
}
this.animStage(this.drag.updatedX);
};
/**
* onDragEnd
* @desc touchend/mouseup event
* @since 2.0.0
*/
Owl.prototype.onDragEnd = function(event) {
if (!this.state.isTouch) {
return;
}
if (this.dragType[0] === 'mousedown') {
this.dom.$stage.removeClass('owl-grab');
}
this.fireCallback('onTouchEnd');
//prevent links and images dragging;
//this.drag.targetEl.draggable = true;
//remove drag event listeners
this.state.isTouch = false;
this.state.isScrolling = false;
this.state.isSwiping = false;
//to check
if (this.drag.distance === 0 && this.state.inMotion !== true) {
this.state.inMotion = false;
return false;
}
// prevent clicks while scrolling
this.drag.endTime = new Date().getTime();
var compareTimes = this.drag.endTime - this.drag.startTime;
var distanceAbs = Math.abs(this.drag.distance);
//to test
if (distanceAbs > 3 || compareTimes > 300) {
this.removeClick(this.drag.targetEl);
}
var closest = this.closest(this.drag.updatedX);
this.setSpeed(this.options.dragEndSpeed, false, true);
this.animStage(this.pos.items[closest]);
//if pullDrag is off then fire transitionEnd event manually when stick to border
if (!this.options.pullDrag && this.drag.updatedX === this.pos.items[closest]) {
this.transitionEnd();
}
this.drag.distance = 0;
this.off(document, this.dragType[1], this.e._onDragMove);
this.off(document, this.dragType[2], this.e._onDragEnd);
};
/**
* removeClick
* @desc Attach preventClick function to disable link while swipping
* @since 2.0.0
* @param [target] - clicked dom element
*/
Owl.prototype.removeClick = function(target) {
this.drag.targetEl = target;
$(target).on('click.preventClick', this.e._preventClick);
// to make sure click is removed:
window.setTimeout(function() {
$(target).off('click.preventClick');
}, 300);
};
/**
* preventClick
* @desc Add preventDefault for any link and then remove removeClick event hanlder
* @since 2.0.0
*/
Owl.prototype.preventClick = function(ev) {
if (ev.preventDefault) {
ev.preventDefault();
} else {
ev.returnValue = false;
}
if (ev.stopPropagation) {
ev.stopPropagation();
}
$(ev.target).off('click.preventClick')
};
/**
* getTransformProperty
* @desc catch stage position while animate (only css3)
* @since 2.0.0
*/
Owl.prototype.getTransformProperty = function() {
var transform = window.getComputedStyle(this.dom.stage, null).getPropertyValue(this.vendorName + 'transform');
//var transform = this.dom.$stage.css(this.vendorName + 'transform')
transform = transform.replace(/matrix(3d)?\(|\)/g, '').split(',');
var matrix3d = transform.length === 16;
return matrix3d !== true ? transform[4] : transform[12];
};
/**
* closest
* @desc Get closest item after touchend/mouseup
* @since 2.0.0
* @param [x] - curent position in pixels
* return position in pixels
*/
Owl.prototype.closest = function(x) {
var newX = 0,
pull = 30;
if (!this.options.freeDrag) {
// Check closest item
for (var i = 0; i < this.num.items; i++) {
if (x > this.pos.items[i] - pull && x < this.pos.items[i] + pull) {
newX = i;
} else if (this.op(x, '<', this.pos.items[i]) && this.op(x, '>', this.pos.items[i + 1 || this.pos.items[i] - this.width.el])) {
newX = this.state.direction === 'left' ? i + 1 : i;
}
}
}
//non loop boundries
if (!this.options.loop) {
if (this.op(x, '>', this.pos.minValue)) {
newX = x = this.pos.min;
} else if (this.op(x, '<', this.pos.maxValue)) {
newX = x = this.pos.max;
}
}
if (!this.options.freeDrag) {
// set positions
this.pos.currentAbs = newX;
this.pos.current = this.dom.$items.eq(newX).data('owl-item').index;
} else {
this.updateItemState();
return x;
}
return newX;
};
/**
* animStage
* @desc animate stage position (both css3/css2) and perform onChange functions/events
* @since 2.0.0
* @param [x] - curent position in pixels
*/
Owl.prototype.animStage = function(pos) {
// if speed is 0 the set inMotion to false
if (this.speed.current !== 0 && this.pos.currentAbs !== this.pos.min) {
this.fireCallback('onTransitionStart');
this.state.inMotion = true;
}
var posX = this.pos.stage = pos,
style = this.dom.stage.style;
if (this.support3d) {
translate = 'translate3d(' + posX + 'px' + ',0px, 0px)';
style[this.transformVendor] = translate;
} else if (this.state.isTouch) {
style.left = posX + 'px';
} else {
this.dom.$stage.animate({ left: posX }, this.speed.css2speed, this.options.fallbackEasing, function() {
if (this.state.inMotion) {
this.transitionEnd();
}
}.bind(this));
}
this.onChange();
};
/**
* updatePosition
* @desc Update current positions
* @since 2.0.0
* @param [pos] - number - new position
*/
Owl.prototype.updatePosition = function(pos) {
// if no items then stop
if (this.num.oItems === 0) { return false; }
// to do
//if(pos > this.num.items){pos = 0;}
if (pos === undefined) { return false; }
//pos - new current position
var nextPos = pos;
this.pos.prev = this.pos.currentAbs;
if (this.state.revert) {
this.pos.current = this.dom.$items.eq(nextPos).data('owl-item').index;
this.pos.currentAbs = nextPos;
return;
}
if (!this.options.loop) {
if (this.options.navRewind) {
nextPos = nextPos > this.pos.max ? this.pos.min : (nextPos < 0 ? this.pos.max : nextPos);
} else {
nextPos = nextPos > this.pos.max ? this.pos.max : (nextPos <= 0 ? 0 : nextPos);
}
} else {
nextPos = nextPos >= this.num.oItems ? this.num.oItems - 1 : nextPos;
}
this.pos.current = this.dom.$oItems.eq(nextPos).data('owl-item').index;
this.pos.currentAbs = this.dom.$oItems.eq(nextPos).data('owl-item').indexAbs;
};
/**
* setSpeed
* @since 2.0.0
* @param [speed] - number
* @param [pos] - number - next position - use this param to calculate smartSpeed
* @param [drag] - boolean - if drag is true then smart speed is disabled
* return speed
*/
Owl.prototype.setSpeed = function(speed, pos, drag) {
var s = speed,
nextPos = pos;
if ((s === false && s !== 0 && drag !== true) || s === undefined) {
//Double check this
// var nextPx = this.pos.items[nextPos];
// var currPx = this.pos.stage
// var diff = Math.abs(nextPx-currPx);
// var s = diff/1
// if(s>1000){
// s = 1000;
// }
var diff = Math.abs(nextPos - this.pos.prev);
diff = diff === 0 ? 1 : diff;
if (diff > 6) { diff = 6; }
s = diff * this.options.smartSpeed;
}
if (s === false && drag === true) {
s = this.options.smartSpeed;
}
if (s === 0) { s = 0; }
if (this.support3d) {
var style = this.dom.stage.style;
style.webkitTransitionDuration = style.MsTransitionDuration = style.msTransitionDuration = style.MozTransitionDuration = style.OTransitionDuration = style.transitionDuration = (s / 1000) + 's';
} else {
this.speed.css2speed = s;
}
this.speed.current = s;
return s;
};
/**
* jumpTo
* @since 2.0.0
* @param [pos] - number - next position - use this param to calculate smartSpeed
* @param [update] - boolean - if drag is true then smart speed is disabled
*/
Owl.prototype.jumpTo = function(pos, update) {
if (this.state.lazyContent) {
this.pos.goToLazyContent = pos;
}
this.updatePosition(pos);
this.setSpeed(0);
this.animStage(this.pos.items[this.pos.currentAbs]);
if (update !== true) {
this.updateItemState();
}
};
/**
* goTo
* @since 2.0.0
* @param [pos] - number
* @param [speed] - speed in ms
* @param [speed] - speed in ms
*/
Owl.prototype.goTo = function(pos, speed) {
if (this.state.lazyContent && this.state.inMotion) {
return false;
}
this.updatePosition(pos);
if (this.state.animate) { speed = 0; }
this.setSpeed(speed, this.pos.currentAbs);
if (this.state.animate) { this.animate(); }
this.animStage(this.pos.items[this.pos.currentAbs]);
};
/**
* next
* @since 2.0.0
*/
Owl.prototype.next = function(optionalSpeed) {
var s = optionalSpeed || this.options.navSpeed;
if (this.options.loop && !this.state.lazyContent) {
this.goToLoop(this.options.slideBy, s);
} else {
this.goTo(this.pos.current + this.options.slideBy, s);
}
};
/**
* prev
* @since 2.0.0
*/
Owl.prototype.prev = function(optionalSpeed) {
var s = optionalSpeed || this.options.navSpeed;
if (this.options.loop && !this.state.lazyContent) {
this.goToLoop(-this.options.slideBy, s);
} else {
this.goTo(this.pos.current - this.options.slideBy, s);
}
};
/**
* goToLoop
* @desc Go to given position if loop is enabled - used only internal
* @since 2.0.0
* @param [distance] - number -how far to go
* @param [speed] - number - speed in ms
*/
Owl.prototype.goToLoop = function(distance, speed) {
var revert = this.pos.currentAbs,
prevPosition = this.pos.currentAbs,
newPosition = this.pos.currentAbs + distance,
direction = prevPosition - newPosition < 0 ? true : false;
this.state.revert = true;
if (newPosition < this.options.items && direction === false) {
this.state.bypass = true;
revert = this.num.items - (this.options.items - prevPosition) - this.options.items;
this.jumpTo(revert, true);
} else if (newPosition >= this.num.items - this.options.items && direction === true) {
this.state.bypass = true;
revert = prevPosition - this.num.oItems;
this.jumpTo(revert, true);
}
window.clearTimeout(this.e._goToLoop);
this.e._goToLoop = window.setTimeout(function() {
this.state.bypass = false;
this.goTo(revert + distance, speed);
this.state.revert = false;
}.bind(this), 30);
};
/**
* initPosition
* @since 2.0.0
*/
Owl.prototype.initPosition = function(init) {
if (!this.dom.$oItems || !init || this.state.lazyContent) { return false; }
var pos = this.options.startPosition;
if (this.options.startPosition === 'URLHash') {
pos = this.options.startPosition = this.hashPosition();
} else if (typeof this.options.startPosition !== Number && !this.options.center) {
this.options.startPosition = 0;
}
this.dom.oStage.scrollLeft = 0;
this.jumpTo(pos, true);
};
/**
* goToHash
* @since 2.0.0
*/
Owl.prototype.goToHash = function() {
var pos = this.hashPosition();
if (pos === false) {
pos = 0;
}
this.dom.oStage.scrollLeft = 0;
this.goTo(pos, this.options.navSpeed);
};
/**
* hashPosition
* @desc Find hash in URL then look into items to find contained ID
* @since 2.0.0
* return hashPos - number of item
*/
Owl.prototype.hashPosition = function() {
var hash = window.location.hash.substring(1),
hashPos;
if (hash === "") { return false; }
for (var i = 0; i < this.num.oItems; i++) {
if (hash === this.dom.$oItems.eq(i).data('owl-item').hash) {
hashPos = i;
}
}
return hashPos;
};
/**
* Autoplay
* @since 2.0.0
*/
Owl.prototype.autoplay = function() {
if (this.options.autoplay && !this.state.videoPlay) {
window.clearInterval(this.e._autoplay);
this.e._autoplay = window.setInterval(this.e._play, this.options.autoplayTimeout);
} else {
window.clearInterval(this.e._autoplay);
this.state.autoplay = false;
}
};
/**
* play
* @param [timeout] - Integrer
* @param [speed] - Integrer
* @since 2.0.0
*/
Owl.prototype.play = function(timeout, speed) {
// if tab is inactive - doesnt work in = this.pos.max) {
window.clearInterval(this.e._autoplay);
this.goTo(0);
} else {
this.next(this.options.autoplaySpeed);
}
this.state.autoplay = true;
};
/**
* stop
* @since 2.0.0
*/
Owl.prototype.stop = function() {
this._options.autoplay = this.options.autoplay = false;
this.state.autoplay = false;
window.clearInterval(this.e._autoplay);
};
Owl.prototype.pause = function() {
window.clearInterval(this.e._autoplay);
};
/**
* transitionEnd
* @desc event used by css3 animation end and $.animate callback like transitionEnd,responsive etc.
* @since 2.0.0
*/
Owl.prototype.transitionEnd = function(event) {
// if css2 animation then event object is undefined
if (event !== undefined) {
event.stopPropagation();
// Catch only owl-stage transitionEnd event
var eventTarget = event.target || event.srcElement || event.originalTarget;
if (eventTarget !== this.dom.stage) {
return false;
}
}
this.state.inMotion = false;
this.updateItemState();
this.autoplay();
this.fireCallback('onTransitionEnd');
};
/**
* isElWidthChanged
* @desc Check if element width has changed
* @since 2.0.0
*/
Owl.prototype.isElWidthChanged = function() {
var newElWidth = this.dom.$el.width() - this.options.stagePadding, //to check
prevElWidth = this.width.el + this.options.margin;
return newElWidth !== prevElWidth;
};
/**
* windowWidth
* @desc Get Window/responsiveBaseElement width
* @since 2.0.0
*/
Owl.prototype.windowWidth = function() {
if (this.options.responsiveBaseElement !== window) {
this.width.window = $(this.options.responsiveBaseElement).width();
} else if (window.innerWidth) {
this.width.window = window.innerWidth;
} else if (document.documentElement && document.documentElement.clientWidth) {
this.width.window = document.documentElement.clientWidth;
}
return this.width.window;
};
/**
* Controls
* @desc Calls controls container, navigation and dots creator
* @since 2.0.0
*/
Owl.prototype.controls = function() {
var cc = document.createElement('div');
cc.className = this.options.controlsClass;
this.dom.$el.append(cc);
this.dom.$cc = $(cc);
};
/**
* updateControls
* @since 2.0.0
*/
Owl.prototype.updateControls = function() {
if (this.dom.$cc === null && (this.options.nav || this.options.dots)) {
if (!this.options.navContainer || !this.options.dotsContainer) {
this.controls();
}
}
if (this.dom.$nav === null && this.options.nav) {
this.createNavigation();
}
if (this.dom.$page === null && this.options.dots) {
this.createDots();
}
if (this.dom.$nav !== null) {
if (this.options.nav) {
this.dom.$nav.show();
this.updateNavigation();
} else {
this.dom.$nav.hide();
}
}
if (this.dom.$page !== null) {
if (this.options.dots) {
this.dom.$page.show();
this.updateDots();
} else {
this.dom.$page.hide();
}
}
};
/**
* createNavigation
* @since 2.0.0
*/
Owl.prototype.createNavigation = function() {
var cc = this.options.navContainer ? $(this.options.navContainer).get(0) : this.dom.$cc.get(0);
// Create nav container
var nav = document.createElement('div');
nav.className = this.options.navContainerClass;
cc.appendChild(nav);
// Create left and right buttons
var navPrev = document.createElement('div'),
navNext = document.createElement('div');
navPrev.className = this.options.navClass[0];
navNext.className = this.options.navClass[1];
nav.appendChild(navPrev);
nav.appendChild(navNext);
this.dom.$nav = $(nav);
this.dom.$navPrev = $(navPrev).html(this.options.navText[0]);
this.dom.$navNext = $(navNext).html(this.options.navText[1]);
// add events to do
//this.on(navPrev, this.dragType[2], this.e._navPrev, false);
//this.on(navNext, this.dragType[2], this.e._navNext, false);
//FF fix?
this.dom.$nav.on(this.dragType[2], '.' + this.options.navClass[0], this.e._navPrev);
this.dom.$nav.on(this.dragType[2], '.' + this.options.navClass[1], this.e._navNext);
};
/**
* createNavigation
* @since 2.0.0
* @param [cc] - dom element - Controls Container
*/
Owl.prototype.createDots = function() {
var cc = this.options.dotsContainer ? $(this.options.dotsContainer).get(0) : this.dom.$cc.get(0);
// Create dots container
var page = document.createElement('div');
page.className = this.options.dotsClass;
cc.appendChild(page);
// save reference
this.dom.$page = $(page);
// add events
//this.on(page, this.dragType[2], this.e._goToPage, false);
// FF fix? To test!
var that = this;
this.dom.$page.on(this.dragType[2], '.' + this.options.dotClass, goToPage);
function goToPage(e) {
e.preventDefault();
var page = $(this).data('page');
that.goTo(page, that.options.dotsSpeed);
}
// build dots
this.rebuildDots();
};
/**
* rebuildDots
* @since 2.0.0
*/
Owl.prototype.rebuildDots = function() {
if (this.dom.$page === null) { return false; }
var each, dot, span, counter = 0,
last = 0,
i, page = 0,
roundPages = 0;
each = this.options.dotsEach || this.options.items;
// display full dots if center
if (this.options.center || this.options.dotData) {
each = 1;
}
// clear dots
this.dom.$page.html('');
for (i = 0; i < this.num.nav.length; i++) {
if (counter >= each || counter === 0) {
dot = document.createElement('div');
dot.className = this.options.dotClass;
span = document.createElement('span');
dot.appendChild(span);
var $dot = $(dot);
if (this.options.dotData) {
$dot.html(this.dom.$oItems.eq(i).data('owl-item').dot);
}
$dot.data('page', page);
$dot.data('goToPage', roundPages);
this.dom.$page.append(dot);
counter = 0;
roundPages++;
}
this.dom.$oItems.eq(i).data('owl-item').page = roundPages - 1;
//add merged items
counter += this.num.nav[i];
page++;
}
// find rest of dots
if (!this.options.loop && !this.options.center) {
for (var j = this.num.nav.length - 1; j >= 0; j--) {
last += this.num.nav[j];
this.dom.$oItems.eq(j).data('owl-item').page = roundPages - 1;
if (last >= each) {
break;
}
}
}
this.num.allPages = roundPages - 1;
};
/**
* updateDots
* @since 2.0.0
*/
Owl.prototype.updateDots = function() {
var dots = this.dom.$page.children();
var itemIndex = this.dom.$oItems.eq(this.pos.current).data('owl-item').page;
for (var i = 0; i < dots.length; i++) {
var dotPage = dots.eq(i).data('goToPage');
if (dotPage === itemIndex) {
this.pos.currentPage = i;
dots.eq(i).addClass('active');
} else {
dots.eq(i).removeClass('active');
}
}
};
/**
* updateNavigation
* @since 2.0.0
*/
Owl.prototype.updateNavigation = function() {
var isNav = this.options.nav;
this.dom.$navNext.toggleClass('disabled', !isNav);
this.dom.$navPrev.toggleClass('disabled', !isNav);
if (!this.options.loop && isNav && !this.options.navRewind) {
if (this.pos.current <= 0) {
this.dom.$navPrev.addClass('disabled');
}
if (this.pos.current >= this.pos.max) {
this.dom.$navNext.addClass('disabled');
}
}
};
Owl.prototype.insertContent = function(content) {
this.dom.$stage.empty();
this.fetchContent(content);
this.refresh();
};
/**
* addItem - Add an item
* @since 2.0.0
* @param [content] - dom element / string 'content
'
* @param [pos] - number - position
*/
Owl.prototype.addItem = function(content, pos) {
pos = pos || 0;
if (this.state.lazyContent) {
this.dom.$content = this.dom.$content.add($(content));
this.updateItemState(true);
} else {
// wrap content
var item = this.fillItem(content);
// if carousel is empty then append item
if (this.dom.$oItems.length === 0) {
this.dom.$stage.append(item);
} else {
// append item
var it = this.dom.$oItems.eq(pos);
if (pos !== -1) { it.before(item); } else { it.after(item); }
}
// update and calculate carousel
this.refresh();
}
};
/**
* removeItem - Remove an Item
* @since 2.0.0
* @param [pos] - number - position
*/
Owl.prototype.removeItem = function(pos) {
if (this.state.lazyContent) {
this.dom.$content.splice(pos, 1);
this.updateItemState(true);
} else {
this.dom.$oItems.eq(pos).remove();
this.refresh();
}
};
/**
* addCustomEvents
* @desc Add custom events by jQuery .on method
* @since 2.0.0
*/
Owl.prototype.addCustomEvents = function() {
this.e.next = function(e, s) { this.next(s); }.bind(this);
this.e.prev = function(e, s) { this.prev(s); }.bind(this);
this.e.goTo = function(e, p, s) { this.goTo(p, s); }.bind(this);
this.e.jumpTo = function(e, p) { this.jumpTo(p); }.bind(this);
this.e.addItem = function(e, c, p) { this.addItem(c, p); }.bind(this);
this.e.removeItem = function(e, p) { this.removeItem(p); }.bind(this);
this.e.refresh = function(e) { this.refresh(); }.bind(this);
this.e.destroy = function(e) { this.destroy(); }.bind(this);
this.e.autoHeight = function(e) { this.autoHeight(true); }.bind(this);
this.e.stop = function() { this.stop(); }.bind(this);
this.e.play = function(e, t, s) { this.play(t, s); }.bind(this);
this.e.insertContent = function(e, d) { this.insertContent(d); }.bind(this);
this.dom.$el.on('next.owl', this.e.next);
this.dom.$el.on('prev.owl', this.e.prev);
this.dom.$el.on('goTo.owl', this.e.goTo);
this.dom.$el.on('jumpTo.owl', this.e.jumpTo);
this.dom.$el.on('addItem.owl', this.e.addItem);
this.dom.$el.on('removeItem.owl', this.e.removeItem);
this.dom.$el.on('destroy.owl', this.e.destroy);
this.dom.$el.on('refresh.owl', this.e.refresh);
this.dom.$el.on('autoHeight.owl', this.e.autoHeight);
this.dom.$el.on('play.owl', this.e.play);
this.dom.$el.on('stop.owl', this.e.stop);
this.dom.$el.on('stopVideo.owl', this.e.stop);
this.dom.$el.on('insertContent.owl', this.e.insertContent);
};
/**
* on
* @desc On method for adding internal events
* @since 2.0.0
*/
Owl.prototype.on = function(element, event, listener, capture) {
if (element.addEventListener) {
element.addEventListener(event, listener, capture);
} else if (element.attachEvent) {
element.attachEvent('on' + event, listener);
}
};
/**
* off
* @desc Off method for removing internal events
* @since 2.0.0
*/
Owl.prototype.off = function(element, event, listener, capture) {
if (element.removeEventListener) {
element.removeEventListener(event, listener, capture);
} else if (element.detachEvent) {
element.detachEvent('on' + event, listener);
}
};
/**
* fireCallback
* @since 2.0.0
* @param event - string - event name
* @param data - object - additional options - to do
*/
Owl.prototype.fireCallback = function(event, data) {
if (!this.options.callbacks) { return; }
if (typeof this.options[event] === 'function') {
this.options[event].apply(this, [this.dom.el, this.info, event]);
}
if (this.dom.el.dispatchEvent) {
// dispatch event
var evt = document.createEvent('CustomEvent');
//evt.initEvent(event, false, true );
evt.initCustomEvent(event, true, true, data);
return this.dom.el.dispatchEvent(evt);
} else if (!this.dom.el.dispatchEvent) {
// There is no clean solution for custom events name in <=IE8
// But if you know better way, please let me know :)
return this.dom.$el.trigger(event);
}
};
/**
* watchVisibility
* @desc check if el is visible - handy if Owl is inside hidden content (tabs etc.)
* @since 2.0.0
*/
Owl.prototype.watchVisibility = function() {
// test on zepto
if (!isElVisible(this.dom.el)) {
this.dom.$el.addClass('owl-hidden');
window.clearInterval(this.e._checkVisibile);
this.e._checkVisibile = window.setInterval(checkVisible.bind(this), 500);
}
function isElVisible(el) {
return el.offsetWidth > 0 && el.offsetHeight > 0;
}
function checkVisible() {
if (isElVisible(this.dom.el)) {
this.dom.$el.removeClass('owl-hidden');
this.refresh();
window.clearInterval(this.e._checkVisibile);
}
}
};
/**
* onChange
* @since 2.0.0
*/
Owl.prototype.onChange = function() {
if (!this.state.isTouch && !this.state.bypass && !this.state.responsive) {
if (this.options.nav || this.options.dots) {
this.updateControls();
}
this.autoHeight();
this.fireCallback('onChangeState');
}
if (!this.state.isTouch && !this.state.bypass) {
if (!this.state.lazyContent) {
this.updateActiveItems();
}
// set Status to do
this.storeInfo();
// stopVideo
if (this.state.videoPlay) {
this.stopVideo();
}
}
};
/**
* storeInfo
* store basic information about current states
* @since 2.0.0
*/
Owl.prototype.storeInfo = function() {
var currentPosition = this.state.lazyContent ? this.pos.lcCurrentAbs || 0 : this.pos.current;
var allItems = this.state.lazyContent ? this.dom.$content.length - 1 : this.num.oItems;
this.info = {
items: this.options.items,
allItems: allItems,
currentPosition: currentPosition,
currentPage: this.pos.currentPage,
allPages: this.num.allPages,
autoplay: this.state.autoplay,
windowWidth: this.width.window,
elWidth: this.width.el,
breakpoint: this.num.breakpoint
};
if (typeof this.options.info === 'function') {
this.options.info.apply(this, [this.info, this.dom.el]);
}
};
/**
* autoHeight
* @since 2.0.0
*/
Owl.prototype.autoHeight = function(callback) {
if (this.options.autoHeight !== true && callback !== true) {
return false;
}
if (!this.dom.$oStage.hasClass(this.options.autoHeightClass)) {
this.dom.$oStage.addClass(this.options.autoHeightClass);
}
var loaded = this.dom.$items.eq(this.pos.currentAbs);
var stage = this.dom.$oStage;
var iterations = 0;
var isLoaded = window.setInterval(function() {
iterations += 1;
if (loaded.data('owl-item').loaded) {
stage.height(loaded.height() + 'px');
clearInterval(isLoaded);
} else if (iterations === 500) {
clearInterval(isLoaded);
}
}, 100);
};
/**
* preloadAutoWidthImages
* @desc still to test
* @since 2.0.0
*/
Owl.prototype.preloadAutoWidthImages = function(imgs) {
var loaded = 0;
var that = this;
imgs.each(function(i, el) {
var $el = $(el);
var img = new Image();
img.onload = function() {
loaded++;
$el.attr('src', img.src);
$el.css('opacity', 1);
if (loaded >= imgs.length) {
that.state.imagesLoaded = true;
that.init();
}
}
img.src = $el.attr('src') || $el.attr('data-src') || $el.attr('data-src-retina');;
})
};
/**
* lazyLoad
* @desc lazyLoad images
* @since 2.0.0
*/
Owl.prototype.lazyLoad = function() {
var attr = isRetina() ? 'data-src-retina' : 'data-src';
var src, img, i;
for (i = 0; i < this.num.items; i++) {
var $item = this.dom.$items.eq(i);
if ($item.data('owl-item').current === true && $item.data('owl-item').loaded === false) {
img = $item.find('.owl-lazy');
src = IMG.HTM
src = SRC.HTM || img.attr('data-src');
if (src) {
img.css('opacity', '0');
this.preload(img, $item);
}
}
}
};
/**
* preload
* @since 2.0.0
*/
Owl.prototype.preload = function(images, $item) {
var that = this; // fix this later
images.each(function(i, el) {
var $el = $(el);
var img = new Image();
var srcType = isRetina() ? $el.attr('data-src-retina') : $el.attr('data-src');
var srcType = srcType || $el.attr('data-src');
img.onload = function() {
$item.data('owl-item').loaded = true;
if ($el.is('img')) {
$el.attr('src', img.src);
} else {
$el.css('background-image', 'url(' + img.src + ')');
}
$el.css('opacity', 1);
that.fireCallback('onLazyLoaded');
};
img.src = srcType;
});
};
/**
* animate
* @since 2.0.0
*/
Owl.prototype.animate = function() {
var prevItem = this.dom.$items.eq(this.pos.prev),
prevPos = Math.abs(prevItem.data('owl-item').width) * this.pos.prev,
currentItem = this.dom.$items.eq(this.pos.currentAbs),
currentPos = Math.abs(currentItem.data('owl-item').width) * this.pos.currentAbs;
if (this.pos.currentAbs === this.pos.prev) {
return false;
}
var pos = currentPos - prevPos;
var tIn = this.options.animateIn;
var tOut = this.options.animateOut;
var that = this;
removeStyles = function() {
$(this).css({
"left": ""
})
.removeClass('animated owl-animated-out owl-animated-in')
.removeClass(tIn)
.removeClass(tOut);
that.transitionEnd();
};
if (tOut) {
prevItem
.css({
"left": pos + "px"
})
.addClass('animated owl-animated-out ' + tOut)
.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', removeStyles);
}
if (tIn) {
currentItem
.addClass('animated owl-animated-in ' + tIn)
.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', removeStyles);
}
};
/**
* destroy
* @desc Remove Owl structure and events :(
* @since 2.0.0
*/
Owl.prototype.destroy = function() {
window.clearInterval(this.e._autoplay);
if (this.dom.$el.hasClass(this.options.themeClass)) {
this.dom.$el.removeClass(this.options.themeClass);
}
if (this.options.responsive !== false) {
this.off(window, 'resize', this.e._resizer);
}
if (this.transitionEndVendor) {
this.off(this.dom.stage, this.transitionEndVendor, this.e._transitionEnd);
}
if (this.options.mouseDrag || this.options.touchDrag) {
this.off(this.dom.stage, this.dragType[0], this.e._onDragStart);
if (this.options.mouseDrag) {
this.off(document, this.dragType[3], this.e._onDragStart);
}
if (this.options.mouseDrag) {
this.dom.$stage.off('dragstart', function() { return false; });
this.dom.stage.onselectstart = function() {};
}
}
if (this.options.URLhashListener) {
this.off(window, 'hashchange', this.e._goToHash);
}
this.dom.$el.off('next.owl', this.e.next);
this.dom.$el.off('prev.owl', this.e.prev);
this.dom.$el.off('goTo.owl', this.e.goTo);
this.dom.$el.off('jumpTo.owl', this.e.jumpTo);
this.dom.$el.off('addItem.owl', this.e.addItem);
this.dom.$el.off('removeItem.owl', this.e.removeItem);
this.dom.$el.off('refresh.owl', this.e.refresh);
this.dom.$el.off('autoHeight.owl', this.e.autoHeight);
this.dom.$el.off('play.owl', this.e.play);
this.dom.$el.off('stop.owl', this.e.stop);
this.dom.$el.off('stopVideo.owl', this.e.stop);
this.dom.$stage.off('click', this.e._playVideo);
if (this.dom.$cc !== null) {
this.dom.$cc.remove();
}
if (this.dom.$cItems !== null) {
this.dom.$cItems.remove();
}
this.e = null;
this.dom.$el.data('owlCarousel', null);
delete this.dom.el.owlCarousel;
this.dom.$stage.unwrap();
this.dom.$items.unwrap();
this.dom.$items.contents().unwrap();
this.dom = null;
};
/**
* Opertators
* @desc Used to calculate RTL
* @param [a] - Number - left side
* @param [o] - String - operator
* @param [b] - Number - right side
* @since 2.0.0
*/
Owl.prototype.op = function(a, o, b) {
var rtl = this.options.rtl;
switch (o) {
case '<':
return rtl ? a > b : a < b;
case '>':
return rtl ? a < b : a > b;
case '>=':
return rtl ? a <= b : a >= b;
case '<=':
return rtl ? a >= b : a <= b;
default:
break;
}
};
/**
* Opertators
* @desc Used to calculate RTL
* @since 2.0.0
*/
Owl.prototype.browserSupport = function() {
this.support3d = isPerspective();
if (this.support3d) {
this.transformVendor = isTransform();
// take transitionend event name by detecting transition
var endVendors = ['transitionend', 'webkitTransitionEnd', 'transitionend', 'oTransitionEnd'];
this.transitionEndVendor = endVendors[isTransition()];
// take vendor name from transform name
this.vendorName = this.transformVendor.replace(/Transform/i, '');
this.vendorName = this.vendorName !== '' ? '-' + this.vendorName.toLowerCase() + '-' : '';
}
this.state.orientation = window.orientation;
};
// Pivate methods
// CSS detection;
function isStyleSupported(array) {
var p, s, fake = document.createElement('div'),
list = array;
for (p in list) {
s = list[p];
if (typeof fake.style[s] !== 'undefined') {
fake = null;
return [s, p];
}
}
return [false];
}
function isTransition() {
return isStyleSupported(['transition', 'WebkitTransition', 'MozTransition', 'OTransition'])[1];
}
function isTransform() {
return isStyleSupported(['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform'])[0];
}
function isPerspective() {
return isStyleSupported(['perspective', 'webkitPerspective', 'MozPerspective', 'OPerspective', 'MsPerspective'])[0];
}
function isTouchSupport() {
return 'ontouchstart' in window || !!(navigator.msMaxTouchPoints);
}
function isTouchSupportIE() {
return window.navigator.msPointerEnabled;
}
function isRetina() {
return window.devicePixelRatio > 1;
}
$.fn.owlCarousel = function(options) {
return this.each(function() {
if (!$(this).data('owlCarousel')) {
$(this).data('owlCarousel',
new Owl(this, options));
}
});
};
})(window.Zepto || window.jQuery, window, document);
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
//The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
};
function swapCity() {
var Dcity1 = $("#fromCity").val();
var Rcity1 = $("#toCity").val();
$("#fromCity").val(Rcity1);
$("#toCity").val(Dcity1);
//$("#txtExchange").addCss('transform', 'rotate(180deg)');
if ($("#txtExchange").hasClass('rotate1')) {
$("#txtExchange").removeClass('rotate1');
$("#txtExchange").addClass('rotate2');
}
else {
$("#txtExchange").addClass('rotate1');
$("#txtExchange").removeClass('rotate2');
}
}
function emailSubscription() {
var ctr = 0;
if ($('#txtEmailnews').val() == "") {
$('#txtEmailnews').addClass('errorClass');
$('#txtMsg').css("color", "red");
$('#txtMsg').css("font-size", "medium");
$("#txtMsg").html("Please enter valid email address.");
ctr++;
}
else {
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (!$("#txtEmailnews").val().match(mailformat)) {
$('#txtEmailnews').addClass('errorClass');
$('#txtMsg').css("color", "red");
$('#txtMsg').css("font-size", "medium");
$('#txtMsg').html("Required valid email address.");
ctr++;
}
else {
$('#txtEmail').removeClass('errorClass');
$("#txtMsg").html("");
}
}
if (ctr == 0) {
var req = {
emailID: $("#txtEmailnews").val()
}
$('#idQueryFormPBHome').show();
$.ajax({
type: "POST",
//url: "/home/contactUs",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(req),
responseType: "json",
success: function (data) {
$('#idQueryFormPBHome').hide();
if (data.status == 1) {
$('#txtMsg').css("color", "green");
$('#txtMsg').css("font-size", "medium");
$('#txtMsg').html("Thank you for sign up to our newsletter.");
$('#txtEmailnews').val("");
}
else {
$('#idQueryFormPBHome').hide();
$('#txtMsg').css("color", "green");
$('#txtMsg').css("font-size", "medium");
$('#txtMsg').html("Thank you for sign up to our newsletter.");
$('#txtEmailnews').val("");
}
},
error: function (data) {
$('#idQueryFormPBHome').hide();
$('#txtMsg').css("color", "green");
$('#txtMsg').css("font-size", "medium");
$('#txtMsg').html("Thank you for sign up to our newsletter.");
$('#txtEmailnews').val("");
},
});
}
else {
return false;
}
}
function closeCalender() {
$("#ui-datepicker-div").hide();
}
function updateDatePickerCells(dp) {
/* Wait until current callstack is finished so the datepicker
is fully rendered before attempting to modify contents */
setTimeout(function () {
var sp1 = document.createElement("div");
sp1.setAttribute("id", "nitCalendar");
// $("#Div1").val("Select Your Departure Date ");
//document.getElementById('Div1').html = "Select Your Departure Date ";
// Get a reference to the element, before we want to insert the element
var sp2 = document.getElementById("ui-datepicker-div");
// Get a reference to the parent element
//var parentDiv = sp2.parentNode;
document.getElementById('ui-datepicker-div').appendChild(sp1);
// Insert the new element into the DOM before sp2
// parentDiv.insertAfter(sp2, sp1);
//insertAfter(sp2, sp1);
$("#nitCalendar").html("
Select Your Departure Date ");
//$('.nit-nitCalendar-container').show();
//$('#nitCalendar').show();
//$('#nitCalendar').attr('data-nit', 'nitCar');
//$('.ui-datepicker td > *').each(function (idx, elem) {
// $(this).addClass("calendar_bg");
//});
}, 0);
}
function updateDatePickerCells2(dp) {
/* Wait until current callstack is finished so the datepicker
is fully rendered before attempting to modify contents */
setTimeout(function () {
var sp1 = document.createElement("div");
sp1.setAttribute("id", "nitCalendar");
// $("#Div1").val("Select Your Departure Date ");
//document.getElementById('Div1').html = "Select Your Departure Date ";
// Get a reference to the element, before we want to insert the element
var sp2 = document.getElementById("ui-datepicker-div");
// Get a reference to the parent element
//var parentDiv = sp2.parentNode;
document.getElementById('ui-datepicker-div').appendChild(sp1);
// Insert the new element into the DOM before sp2
// parentDiv.insertAfter(sp2, sp1);
//insertAfter(sp2, sp1);
$("#nitCalendar").html("
Select Your Return Date ");
//$('.nit-nitCalendar-container').show();
//$('#nitCalendar').show();
//$('#nitCalendar').attr('data-nit', 'nitCar');
//$('.ui-datepicker td > *').each(function (idx, elem) {
// $(this).addClass("calendar_bg");
//});
}, 0);
}
function insertAfter(referenceNode, newNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
$(document).ready(function () {
if ($(window).width() < 767) {
$('#departDate1').click(function () {
$("#ui-datepicker-div").toggle();
});
$('#returnDate1').click(function () {
$("#ui-datepicker-div").toggle();
});
$("#departDate1").datepicker({
numberOfMonths: $(window).width() < 767 ? 12 : 3,
dateFormat: "mm/dd/yy",
// showAnim: 'slide',
minDate: minDate,
maxDate: maxDate,
showButtonPanel: true,
beforeShow: function (input, inst) {
// $(inst.dpDiv).addClass('just-yaer');
updateDatePickerCells();
},
onSelect: function (date, dp) {
updateDatePickerCells();
},
onChangeMonthYear: function (month, year, dp) {
updateDatePickerCells();
},
onClose: function () {
updateDatePickerCells()
var dateDepMin = $('#departDate1').datepicker("getDate");
if (dateDepMin == null) {
dateDepMin = minDate;
}
var dateRetMin = $('#returnDate1').datepicker("getDate");
var dMin = new Date(dateDepMin.getFullYear(), dateDepMin.getMonth(), dateDepMin.getDate());
if (dateRetMin != null) {
$("#returnDate1").datepicker("change", {
minDate: new Date(dateDepMin)
});
var rMin = new Date(dateRetMin.getFullYear(), dateRetMin.getMonth(), dateRetMin.getDate());
if (dMin > rMin) {
$('#returnDate1').val($.datepicker.formatDate('mm/dd/yy', new Date(dMin)));
$("#returnDate1").focus();
}
}
else {
if ($('#departDate1').val() != "") {
$('#returnDate1').val($.datepicker.formatDate('mm/dd/yy', new Date(dMin)));
$("#returnDate1").focus();
}
}
}
});
$("#returnDate1").datepicker({
numberOfMonths: $(window).width() < 767 ? 12 : 3,
dateFormat: "mm/dd/yy",
// showAnim: 'slide',
minDate: minDate,
maxDate: maxDate,
showButtonPanel: true,
beforeShow: function (input, inst) {
// $(inst.dpDiv).addClass('just-yaer');
updateDatePickerCells2();
},
onSelect: function (date, dp) {
updateDatePickerCells2();
},
onChangeMonthYear: function (month, year, dp) {
updateDatePickerCells2();
},
onClose: function () {
var dateDepMin = $('#departDate1').datepicker("getDate");
if (dateDepMin == null) {
dateDepMin = minDate;
}
var dateRetMin = $('#returnDate1').datepicker("getDate");
var dMin = new Date(dateDepMin.getFullYear(), dateDepMin.getMonth(), dateDepMin.getDate());
if (dateRetMin != null) {
var rMin = new Date(dateRetMin.getFullYear(), dateRetMin.getMonth(), dateRetMin.getDate());
if (dMin > rMin) {
alert('Returning date always equal or greater than departure date!');
$("#returnDate1").val('');
}
}
}
});
}
else {
$("#departDate").datepicker({
numberOfMonths: $(window).width() < 767 ? 12 : 3,
dateFormat: "mm/dd/yy",
//showAnim: 'slide',
minDate: minDate,
maxDate: maxDate,
//showButtonPanel: true,
onClose: function () {
var dateDepMin = $('#departDate').datepicker("getDate");
if (dateDepMin == null) {
dateDepMin = minDate;
}
var dateRetMin = $('#returnDate').datepicker("getDate");
var dMin = new Date(dateDepMin.getFullYear(), dateDepMin.getMonth(), dateDepMin.getDate());
if (dateRetMin != null) {
$("#returnDate").datepicker("change", {
minDate: new Date(dateDepMin)
});
var rMin = new Date(dateRetMin.getFullYear(), dateRetMin.getMonth(), dateRetMin.getDate());
if (dMin > rMin) {
$('#returnDate').val($.datepicker.formatDate('mm/dd/yy', new Date(dMin)));
$("#returnDate").focus();
}
}
else {
if ($('#departDate').val() != "") {
$('#returnDate').val($.datepicker.formatDate('mm/dd/yy', new Date(dMin)));
$("#returnDate").focus();
}
}
}
});
$("#returnDate").datepicker({
numberOfMonths: $(window).width() < 765 ? 12 : 3,
dateFormat: "mm/dd/yy",
showAnim: 'slide',
minDate: minDate,
maxDate: maxDate,
// showButtonPanel: true,
onClose: function () {
var dateDepMin = $('#departDate').datepicker("getDate");
if (dateDepMin == null) {
dateDepMin = minDate;
}
var dateRetMin = $('#returnDate').datepicker("getDate");
var dMin = new Date(dateDepMin.getFullYear(), dateDepMin.getMonth(), dateDepMin.getDate());
if (dateRetMin != null) {
var rMin = new Date(dateRetMin.getFullYear(), dateRetMin.getMonth(), dateRetMin.getDate());
if (dMin > rMin) {
alert('Returning date always equal or greater than departure date!');
$("#returnDate").val('');
}
}
}
});
}
//setSearchEngine();
$(".aSearchEngine").click(function () {
$(".resultSearchEngine").toggle();
});
$("#txtPaxDetail").click(function () {
$(".travelar").slideDown();
});
$("#txtPaxDetail1").click(function () {
$(".travelar").slideDown();
});
$("#txtPaxDetail2").click(function () {
$(".travelar").slideDown();
});
$("#paxArrow").click(function () {
$(".travelar").slideDown();
});
$("#PaxSelectionDone").click(function () {
$(".travelar").hide();
});
$("#PaxSelectionDone1").click(function () {
$(".travelar").hide();
$('.panel-dropdown.form-control').removeClass('active');
});
$('body').click(function () {
if ($("#passengerPopup").length != 0) {
if (!$('#passengerPopup').is(':hover')) {
$('.travelar').hide();
}
}
});
$("#fromCity").blur(function () {
if (orgIndex == 0)
$('#fromCity').val("");
});
$("#toCity").blur(function () {
if (destIndex == 0)
$('#toCity').val("");
});
$("#fromCity_Mob1").blur(function () {
if (orgIndex == 0)
$('#fromCity_Mob1').val("");
});
$("#toCity_Mob1").blur(function () {
if (destIndex == 0)
$('#toCity_Mob1').val("");
});
// ddlTypejourneyChange($('#hfTripType').val());
});
function contactUs2() {
var ctr = 0;
if ($('#txtname').val() == "") {
$('#txtnamemsg').html("Please Enter Your Name.");
ctr++;
}
else {
$('#txtnamemsg').html("");
}
if ($('#txtSubject').val() == "") {
$('#txtSubjectmsg').html("Please Enter Your Subject.");
ctr++;
}
else {
$('#txtSubjectmsg').html("");
}
if ($('#txtEmail').val() == "") {
$('#txtemailmsg').html("Please enter email id!!");
ctr++;
}
else {
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (!$("#txtEmail").val().match(mailformat)) {
$('#txtemailmsg').html("Please enter valid email id\n\r");
ctr++;
}
else {
$('#txtemailmsg').html("");
}
}
if ($('#txtPhone').val() == "") {
$('#txtphonemsg').html("Please enter Phone No.");
ctr++;
}
else {
var phoneformat = /^\d{10}$/;
if (!$('#txtPhone').val().match(phoneformat)) {
$('#txtphonemsg').html("Please enter valid phone No\n\r");
ctr++;
}
else {
$('#txtphonemsg').html("");
}
}
if (ctr == 0) {
//$('#finalmsg').html("Thank you for contact us");
var req = {
Name: $("#txtname").val(),
phone: $("#txtPhone").val(),
emailID: $("#txtEmail").val(),
subject: $("#txtSubject").val(),
comments: $("#txtComments").val()
}
$('#idContactUsFormPB').show();
$.ajax({
type: "POST",
//url: "/home/contactUs",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(req),
responseType: "json",
success: function (data) {
$('#idContactUsFormPB').hide();
if (data.status == 1) {
$('#txtfinalmsg').css("color", "#a8cc1b");
$('#txtfinalmsg').css("font-size", "medium");
$('#txtfinalmsg').html("Thanking you for your query.");
$('#txtname').val("");
$('#txtEmail').val("");
$("#txtPhone").val(""),
$("#txtSubject").val("")
$('#txtComments').val("");
}
else {
$('#idContactUsFormPB').hide();
$('#txtfinalmsg').css("color", "#a8cc1b");
$('#txtfinalmsg').css("font-size", "medium");
$('#txtfinalmsg').html("Thanking you for your query.");
$('#txtname').val("");
$('#txtEmail').val("");
$("#txtPhone").val(""),
$("#txtSubject").val("")
$('#txtComments').val("");
}
},
error: function (data) {
$('#idContactUsFormPB').hide();
$('#txtfinalmsg').css("color", "#a8cc1b");
$('#txtfinalmsg').css("font-size", "medium");
$('#txtfinalmsg').html("Thanking you for your query.");
$('#txtname').val("");
$('#txtEmail').val("");
$("#txtPhone").val(""),
$("#txtSubject").val("")
$('#txtComments').val("");
},
});
}
else {
return false;
}
}
function CheckContact() {
var ctr = 0;
if ($('#txtname').val() == "") {
$('#txtname').addClass('errorClass');
//$("#txtname").parent().after("Please enter email address
");
ctr++;
}
else {
$('#txtname').removeClass('errorClass');
}
if ($('#txtEmail').val() == "") {
$('#txtEmail').addClass('errorClass');
ctr++;
}
else {
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (!$("#txtEmail").val().match(mailformat)) {
$('#txtEmail').addClass('errorClass');
$('#errormsg1').html("Required valid email address.");
ctr++;
}
else {
$('#txtEmail').removeClass('errorClass');
}
}
//if ($('#txtPhone').val() == "") {
// $('#txtPhone').addClass('errorClass');
// ctr++;
//}
//else {
// var phoneformat = /^\d{10}$/;
// if (!$('#txtPhone').val().match(phoneformat)) {
// $('#txtPhone').addClass('errorClass');
// $('#errormsg2').html("Required valid phone number.");
// ctr++;
// }
// else {
// $('#txtPhone').removeClass('errorClass');
// }
//}
if (ctr == 0) {
$('#errormsg').html("");
$('#errormsg1').html("");
//$('#errormsg2').html("");
var req = {
Name: $("#txtname").val(),
emailID: $("#txtEmail").val(),
//phone: $("#txtPhone").val(),
comments: $("#txtComments").val()
}
$('#idQueryFormPB').show();
$.ajax({
type: "POST",
url: "/service/contactUs",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(req),
responseType: "json",
success: function (data) {
$('#idQueryFormPB').hide();
if (data.status == 1) {
$('#txtfinalmsg').css("color", "green");
$('#txtfinalmsg').css("font-size", "medium");
$('#txtfinalmsg').html("Thank you for your query. Our travel executive will get back to you at the earliest.");
$('#txtname').val("");
$('#txtEmail').val("");
//$("#txtPhone").val("");
$('#txtComments').val("");
}
else {
$('#idQueryFormPB').hide();
$('#txtfinalmsg').css("color", "red");
$('#txtfinalmsg').css("font-size", "medium");
$('#txtfinalmsg').html("Please try again");
//$('#txtname').val("");
//$('#txtEmail').val("");
//$("#txtPhone").val("");
// $('#txtComments').val("");
}
},
error: function (data) {
$('#idQueryFormPB').hide();
$('#txtfinalmsg').css("color", "red");
$('#txtfinalmsg').css("font-size", "medium");
$('#txtfinalmsg').html("Unknown error occured, Please try again!!");
//$('#txtname').val("");
// $('#txtEmail').val("");
//$("#txtPhone").val("");
// $('#txtComments').val("");
},
});
}
else {
$('#errormsg').html("Highlighted Field is required.");
return false;
}
}
function ddlTypejourneyChange11(n) {
n == "1" ? ($("#hfTripType").val(1),
$("#rt").removeClass("active"),
$("#ow").addClass("active"),
$("input[name='returnDate']").prop("disabled", !0),
$("#returnDate").prop("disabled", !0)) : n == "2" ? ($("#hfTripType").val(2),
$("#rt").addClass("active"),
$("#ow").removeClass("active"),
$("input[name='returnDate']").prop("enabled", !0),
$("#returnDate").prop("disabled", !1)) : ($("#hfTripType").val(2),
$("#rt").addClass("active"),
$("#ow").removeClass("active"),
$("input[name='returnDate']").prop("enabled", !0),
$("#returnDate").prop("disabled", !1))
if (n == 1) {
}
}
function MinusPax(pax) {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
if (pax == "Adult") {
if (adult > 1) {
if ((adult * 2) == child) {
alert("Please decrease child first!!");
}
else if (adult == infant) {
alert("Please decrease infant first!!");
}
else {
$("#" + pax).val(adult - 1);
}
}
}
else if (pax == "Child") {
if (child > 0) {
$("#" + pax).val(child - 1);
}
}
else if (pax == "Infant") {
if (infant > 0) {
$("#" + pax).val(infant - 1);
}
}
setPaxDropBox();
}
function PlusPax(pax) {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
if (totpax <= 8) {
if (pax == "Adult") {
$("#" + pax).val((adult + 1).toString());
}
else if (pax == "Child") {
if (child < (adult * 2)) {
$("#" + pax).val((child + 1).toString());
}
}
else if (pax == "Infant") {
if (infant < (adult)) {
$("#" + pax).val((infant + 1).toString());
}
}
}
setPaxDropBox();
}
function setPaxDropBox() {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
$("#txtPaxDetail").val(totpax.toString() + " Traveler, " + $("#Cabin option:selected").text());
}
function setPaxDropBox_Result() {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
$("#txtPaxDetail1").val(totpax.toString() + " Traveler");
}
function setPaxDropBox2() {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
var cabin = $("#Cabin").val();
var cabinText = "";
if (cabin == "1") {
cabinText = "Economy";
}
if (cabin == "2") {
cabinText = "Premium..";
}
if (cabin == "3") {
cabinText = "Business..";
}
if (cabin == "4") {
cabinText = "FirstClass";
}
$("#txtPaxDetail2").html(totpax.toString() + " Traveler, " + cabinText);
//$("#txtPaxDetail1").innerHTML = "Traveler";
//document.getElementById("txtPaxDetail2").innerHTML = totpax.toString() + " Traveler";
}
function setPaxDropBox5() {
var adult = parseInt($("#Adult2").val());
var child = parseInt($("#Child2").val());
var infant = parseInt($("#Infant2").val());
var totpax = adult + child + infant;
//var cabin = $("#Cabin").val();
//var cabinText = "";
//if (cabin == "1") {
// cabinText = "Economy";
//}
//if (cabin == "2") {
// cabinText = "Premium..";
//}
//if (cabin == "3") {
// cabinText = "Business..";
//}
//if (cabin == "4") {
// cabinText = "FirstClass";
//}
$("#txtPaxDetail5").html(totpax.toString());
//$("#txtPaxDetail1").innerHTML = "Traveler";
//document.getElementById("txtPaxDetail2").innerHTML = totpax.toString() + " Traveler";
}
function cabinchange2(cabin) {
if (cabin == 1) {
$("#Cabin2").val(1);
$("#txtCabintype").html("Economy");
$("#c1").addClass('active');
$("#c2").removeClass('active');
$("#c3").removeClass('active');
$("#c4").removeClass('active');
$("#txtcao").hide();
$("#txtcabm").hide();
}
else if (cabin == 2) {
$("#Cabin2").val(2);
$("#txtCabintype").html("Premium...");
$("#c1").removeClass('active');
$("#c2").addClass('active');
$("#c3").removeClass('active');
$("#c4").removeClass('active');
$("#txtcao").hide();
$("#txtcabm").hide();
}
else if (cabin == 3) {
$("#Cabin2").val(3);
$("#txtCabintype").html("Business...");
$("#c1").removeClass('active');
$("#c2").removeClass('active');
$("#c3").addClass('active');
$("#c4").removeClass('active');
$("#txtcao").hide();
$("#txtcabm").hide();
}
else if (cabin == 4) {
$("#Cabin2").val(4);
$("#txtCabintype").html("FirstClass");
$("#c1").removeClass('active');
$("#c2").removeClass('active');
$("#c3").removeClass('active');
$("#c4").addClass('active');
$("#txtcao").hide();
$("#txtcabm").hide();
}
else {
$("#Cabin2").val(1);
$("#txtCabintype").html("Economy");
$("#c1").addClass('active');
$("#c2").removeClass('active');
$("#c3").removeClass('active');
$("#c4").removeClass('active');
$("#txtcao").hide();
$("#txtcabm").hide();
}
}
function cabinchange(cabin) {
if (cabin == 1) {
$("#Cabin").val(1);
// document.getElementById("cabintxt").innerHTML = "Economy";
$("#c1").addClass('active');
$("#c2").removeClass('active');
$("#c3").removeClass('active');
$("#c4").removeClass('active');
setPaxDropBox2();
}
else if (cabin == 2) {
$("#Cabin").val(2);
//document.getElementById("cabintxt").innerHTML = "PremiumEconomy";
$("#c1").removeClass('active');
$("#c2").addClass('active');
$("#c3").removeClass('active');
$("#c4").removeClass('active');
setPaxDropBox2();
}
else if (cabin == 3) {
$("#Cabin").val(3);
//document.getElementById("cabintxt").innerHTML = "BusinessClass";
$("#c1").removeClass('active');
$("#c2").removeClass('active');
$("#c3").addClass('active');
$("#c4").removeClass('active');
setPaxDropBox2();
}
else if (cabin == 4) {
$("#Cabin").val(4);
//document.getElementById("cabintxt").innerHTML = "FirstClass";
$("#c1").removeClass('active');
$("#c2").removeClass('active');
$("#c3").removeClass('active');
$("#c4").addClass('active');
setPaxDropBox2();
}
else {
$("#Cabin").val(1);
//document.getElementById("cabintxt").innerHTML = "Economy";
$("#c1").addClass('active');
$("#c2").removeClass('active');
$("#c3").removeClass('active');
$("#c4").removeClass('active');
setPaxDropBox2();
}
}
function MinusPax1(pax) {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
if (pax == "Adult") {
if (adult > 1) {
if ((adult * 2) == child) {
alert("Please decrease child first!!");
}
else if (adult == infant) {
alert("Please decrease infant first!!");
}
else {
$("#" + pax).val(adult - 1);
}
}
}
else if (pax == "Child") {
if (child > 0) {
$("#" + pax).val(child - 1);
}
}
else if (pax == "Infant") {
if (infant > 0) {
$("#" + pax).val(infant - 1);
}
}
setPaxDropBox_Result();
}
function PlusPax1(pax) {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
if (totpax <= 8) {
if (pax == "Adult") {
$("#" + pax).val((adult + 1).toString());
}
else if (pax == "Child") {
if (child < (adult * 2)) {
$("#" + pax).val((child + 1).toString());
}
}
else if (pax == "Infant") {
if (infant < (adult)) {
$("#" + pax).val((infant + 1).toString());
}
}
}
setPaxDropBox_Result();
}
function MinusPax2(pax) {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
if (pax == "Adult") {
if (adult > 1) {
if ((adult * 2) == child) {
alert("Please decrease child first!!");
}
else if (adult == infant) {
alert("Please decrease infant first!!");
}
else {
$("#" + pax).val(adult - 1);
}
}
}
else if (pax == "Child") {
if (child > 0) {
$("#" + pax).val(child - 1);
}
}
else if (pax == "Infant") {
if (infant > 0) {
$("#" + pax).val(infant - 1);
}
}
setPaxDropBox2();
}
function PlusPax2(pax) {
var adult = parseInt($("#Adult").val());
var child = parseInt($("#Child").val());
var infant = parseInt($("#Infant").val());
var totpax = adult + child + infant;
if (totpax <= 8) {
if (pax == "Adult") {
$("#" + pax).val((adult + 1).toString());
}
else if (pax == "Child") {
if (child < (adult * 2)) {
$("#" + pax).val((child + 1).toString());
}
}
else if (pax == "Infant") {
if (infant < (adult)) {
$("#" + pax).val((infant + 1).toString());
}
}
}
setPaxDropBox2();
}
function MinusPax5(pax) {
var adult = parseInt($("#Adult2").val());
var child = parseInt($("#Child2").val());
var infant = parseInt($("#Infant2").val());
var totpax = adult + child + infant;
if (pax == "Adult12") {
if (adult > 1) {
if ((adult * 2) == child) {
alert("Please decrease child first!!");
}
else if (adult == infant) {
alert("Please decrease infant first!!");
}
else {
$("#" + pax).html(adult - 1);
$("#Adult2").val(adult - 1);
}
}
}
else if (pax == "Child12") {
if (child > 0) {
$("#" + pax).html(child - 1);
$("#Child2").val(child - 1);
}
}
else if (pax == "Infant12") {
if (infant > 0) {
$("#" + pax).html(infant - 1);
$("#Infant2").val(infant - 1);
}
}
setPaxDropBox5();
}
function PlusPax5(pax) {
var adult = parseInt($("#Adult2").val());
var child = parseInt($("#Child2").val());
var infant = parseInt($("#Infant2").val());
var totpax = adult + child + infant;
if (totpax <= 8) {
if (pax == "Adult12") {
$("#" + pax).html((adult + 1).toString());
$("#Adult2").val((adult + 1).toString());
}
else if (pax == "Child12") {
if (child < (adult * 2)) {
$("#" + pax).html((child + 1).toString());
$("#Child2").val((child + 1).toString());
}
}
else if (pax == "Infant12") {
if (infant < (adult)) {
$("#" + pax).html((infant + 1).toString());
$("#Infant2").val((infant + 1).toString());
}
}
}
setPaxDropBox5();
}
function ClosePaxDetails() {
$('.travelar').hide();
}
function hidePaxPopup() {
$("#txtpaxo").hide();
$("#txtpaxm").hide();
}
function ShowReturn() {
$("#nitRetrun").show();
$("#nitRetruntext").hide();
$('#hfTripType').val(2);
$("#rt").addClass("active");
$("#ow").removeClass("active");
$("input[name='returnDate']").prop("disabled", false);
$("#returnDate").prop("disabled", false);
}
function ddlTypejourneyChange_Mob(ddlType) {
if (ddlType == "1") {
$('#hfTripType11').val(1);
//$("input[name='returnDate']").prop("disabled", true);
//$("#returnDate").prop("disabled", true);
$("#rt1").removeClass("active");
$("#ow1").addClass("active");
$("#ret11").hide();
$("#dep11").show();
$("#dep11").addClass("nitFull");
$("#triptxt").html("One way");
$("#txtOverlay").hide();
$("#tripPopup").hide();
}
else if (ddlType == "2") {
$('#hfTripType11').val(2);
//$("input[name='returnDate']").prop("enabled", true);
//$("#returnDate").prop("disabled", false);
$("#rt1").addClass("active");
$("#ow1").removeClass("active");
$("#ret11").show();
$("#dep11").show();
$("#dep11").removeClass("nitFull");
//$("#nitDepart").addClass("col-lg-1");
//$("#nitDepart").removeClass("col-lg-2");
$("#triptxt").html("Round Trip");
$("#txtOverlay").hide();
$("#tripPopup").hide();
}
else {
$('#hfTripType11').val(2);
//$("input[name='returnDate']").prop("enabled", true);
//$("#returnDate").prop("disabled", false);
$("#rt1").addClass("active");
$("#ow1").removeClass("active");
$("#ret11").show();
$("#dep11").show();
$("#dep11").removeClass("nitFull");
//$("#nitDepart").addClass("col-lg-1");
//$("#nitDepart").removeClass("col-lg-2");
$("#triptxt").html("Round Trip");
$("#txtOverlay").hide();
$("#tripPopup").hide();
}
}
function ddlTypejourneyChange(ddlType) {
if (ddlType == "1") {
$('#hfTripType').val(1);
$("input[name='returnDate']").prop("disabled", true);
$("#returnDate").prop("disabled", true);
$("#rt").removeClass("active");
$("#ow").addClass("active");
$("#nitRetrun").hide();
$("#nitRetruntext").show();
//$("#nitDepart").removeClass("col-lg-1");
//$("#nitDepart").addClass("col-lg-2");
}
else if (ddlType == "2") {
$('#hfTripType').val(2);
$("input[name='returnDate']").prop("enabled", true);
$("#returnDate").prop("disabled", false);
$("#rt").addClass("active");
$("#ow").removeClass("active");
$("#nitRetrun").show();
$("#nitRetruntext").hide();
//$("#nitDepart").addClass("col-lg-1");
//$("#nitDepart").removeClass("col-lg-2");
}
else {
$('#hfTripType').val(2);
$("input[name='returnDate']").prop("enabled", true);
$("#returnDate").prop("disabled", false);
$("#rt").addClass("active");
$("#ow").removeClass("active");
$("#nitRetrun").show();
$("#nitRetruntext").hide();
//$("#nitDepart").addClass("col-lg-1");
//$("#nitDepart").removeClass("col-lg-2");
}
}
//function ddlTypejourneyChange(ddlType) {
// if (ddlType == "1") {
// $('#hfTripType').val(1);
// $("input[name='returnDate']").prop("disabled", true);
// $("#returnDate").prop("disabled", true);
// }
// else if (ddlType == "2") {
// $('#hfTripType').val(2);
// $("input[name='returnDate']").prop("enabled", true);
// $("#returnDate").prop("disabled", false);
// document.getElementById("radio2").checked = true;
// }
// else {
// $('#hfTripType').val(2);
// $("input[name='returnDate']").prop("enabled", true);
// $("#returnDate").prop("disabled", false);
// }
//}
function setTripType(ddlType) {
if (ddlType == "1") {
$('#hfTripType').val(1);
$("input[name='returnDate']").prop("disabled", true);
$("#returnDate").prop("disabled", true);
$("#divReturn").hide();
$('#inlineRadio2').prop('checked', true);
}
else if (ddlType == "2") {
$('#hfTripType').val(2);
$("input[name='returnDate']").prop("enabled", true);
$("#returnDate").prop("disabled", false);
$("#divReturn").show();
document.getElementById("inlineRadio1").checked = true;
$('#inlineRadio1').prop('checked', true);
}
else {
$('#hfTripType').val(2);
$("input[name='returnDate']").prop("enabled", true);
$("#returnDate").prop("disabled", false);
$("#divReturn").show();
$('#inlineRadio1').prop('checked', true);
}
}
function submitForm() {
var validator = $("#flightSearch").validate({
showErrors: function () {
if (this.settings.highlight) {
for (var i = 0; this.errorList[i]; ++i) {
this.settings.highlight.call(this, this.errorList[i].element,
this.settings.errorClass, this.settings.validClass);
}
}
if (this.settings.unhighlight) {
for (var i = 0, elements = this.validElements() ; elements[i]; ++i) {
this.settings.unhighlight.call(this, elements[i],
this.settings.errorClass, this.settings.validClass);
}
}
},
rules: {
fromCity: {
required: true,
minlength: 3
},
toCity: {
required: true,
minlength: 3
},
departDate: {
required: true,
},
returnDate: {
required: {
depends: function (element) {
if ($('#hfTripType').val() == '2') {
return true;
} else {
return false;
}
}
}
},
Adult: {
required: true,
range: [1, 9]
},
},
errorElement: "span",
messages: {
txtFrom: {
required: "Please enter a valid Origin City.",
minlength: "Origin City must consist of at least 3 characters"
},
txtTo: {
required: "Please enter a valid Destination City.",
minlength: "Destination City must consist of at least 3 characters",
},
departDate: {
required: "Please enter a valid Depart Date.",
},
returnDate: {
required: "Please enter a valid Return Date.",
},
}
});
if (validator.form()) {
var validationFlag = true;
var strError = "";
try {
if ($("#fromCity").val().trim().length < 3) {
strError += "Atleast 3 characters required, departure city / airport code!";
validationFlag = false;
}
if ($("#toCity").val().trim().length == 0 || $("#toCity").val().trim().length < 3) {
strError += "Atleast 3 characters required return city / airport code!";
validationFlag = false;
}
if ($.trim($("#fromCity").val()) == $.trim($("#toCity").val()) && ($.trim($("#toCity").val()).length > 0 || $.trim($("#fromCity").val()).length > 0)) {
strError += "Source and Destination City can't be same !";
validationFlag = false;
}
if ($("#Cabin").val() == 0) {
strError += "» Please select cabin class!
";
validationFlag = false;
}
var temp;
var departDate;
if ($("#departDate").val().trim().length == 0) {
validationFlag = false;
strError += "» Departure date can't be blank!
";
} else {
temp = $("#departDate").val().split("/");
departDate = new Date(parseInt(temp[2], 10), parseInt(temp[0], 10) - 1, parseInt(temp[1], 10));
}
if ($("returnDate").is(":disabled")) {
temp = $("#returnDate").val().split("/");
if ($("#returnDate").val().length < 5) {
validationFlag = false;
strError += "» Return date can't be blank!
";
}
var returnDate = new Date(parseInt(temp[2], 10), parseInt(temp[0], 10) - 1, parseInt(temp[1], 10));
if (departDate > returnDate) {
strError += "Returning date always equal or greater than departure date!";
validationFlag = false;
}
}
var adult = parseInt($("#Adult").val(), 10);
var child = parseInt($("#Child").val(), 10);
var infantLap = parseInt($("#Infant").val(), 10);
var total = adult + child + infantLap;
if (infantLap > adult) {
strError += "Number of infants on lap should be equal to or less then number of adults!!";
validationFlag = false;
}
if (child > (adult * 2)) {
strError += "Maximum number of child and infant with seat should be double number of adults!!";
validationFlag = false;
}
if (total > 9) {
strError += "Total no of person should not be more than 9!!";
validationFlag = false;
}
if (total == 0) {
strError += "Please Choose passenger!!";
validationFlag = false;
}
if (!validationFlag) {
$("#divError").html(strError);
alert(strError);
}/**/
}
catch (err) {
alert(err.toString());
validationFlag = false;
}
if (validationFlag == true) {
var fromCityName = $("#fromCity").val().split('[')[0].toString();
var fromArpName = getAirportCode($("#fromCity").val());
var fromDate = $("#departDate").val();
var toCityName = $("#toCity").val().split('[')[0].toString();
var toArpName = getAirportCode($("#toCity").val());
var toDate = $("#returnDate").val();
//var fromDate = $("#departDate").val().split('/');
//var fDate = "";
//if (fromDate.length == 3) {
// fDate = months[parseInt(fromDate[1]) - 1] + " " + fromDate[2] + ", " + fromDate[0];
//}
//else {
// fDate = $("#departDate").val();
//}
//var toDate = $("#returnDate").val().split('/');;
//var tDate = "";
//if (toDate.length == 3) {
// tDate = months[parseInt(toDate[1]) - 1] + " " + toDate[2] + ", " + toDate[0];
//}
//else {
// fDate = $("#departDate").val();
//}
if ($("#hfTripType").val() == "1") {
$("#waitFrom").html(fromArpName);
$("#waitFromDate").html(fromDate);
$("#waitTo").html(toArpName);
//$("#city1").html(fromCityName);
//$("#city2").html(toCityName);
$("#waitToDate").html(fromDate);
}
else {
$("#waitFrom").html(fromArpName);
$("#waitFromDate").html(fromDate);
$("#waitTo").html(toArpName);
$("#waitToDate").html(toDate);
//$("#city1").html(fromCityName);
//$("#city2").html(toCityName);
}
//$("#waitPax").html(total + " Passengers, " + $("#Cabin option:selected").text());
setLocalStorage();
//$(".searchpop1").show();
$('body').css('overflow', 'hidden');
$(".nit-loading").show();
}
return validationFlag;
}
else
return false;
}
function submitFormMobile() {
var validator = $("#flightSearchMobile").validate({
showErrors: function () {
if (this.settings.highlight) {
for (var i = 0; this.errorList[i]; ++i) {
this.settings.highlight.call(this, this.errorList[i].element,
this.settings.errorClass, this.settings.validClass);
}
}
if (this.settings.unhighlight) {
for (var i = 0, elements = this.validElements() ; elements[i]; ++i) {
this.settings.unhighlight.call(this, elements[i],
this.settings.errorClass, this.settings.validClass);
}
}
},
rules: {
txtFrom1forMobile: {
required: true,
minlength: 3
},
txtTo1forMobile: {
required: true,
minlength: 3
},
departDate1: {
required: true,
},
returnDate1: {
required: {
depends: function (element) {
if ($('#hfTripType11').val() == '2') {
return true;
} else {
return false;
}
}
}
},
Adult2: {
required: true,
range: [1, 9]
},
},
errorElement: "span",
messages: {
txtFrom1forMobile: {
required: "Please enter a valid Origin City.",
minlength: "Origin City must consist of at least 3 characters"
},
txtTo1forMobile: {
required: "Please enter a valid Destination City.",
minlength: "Destination City must consist of at least 3 characters",
},
departDate1: {
required: "Please enter a valid Depart Date.",
},
returnDate1: {
required: "Please enter a valid Return Date.",
},
}
});
if (validator.form()) {
var validationFlag = true;
var strError = "";
try {
if ($("#txtFrom1forMobile").val().trim().length < 3) {
strError += "Atleast 3 characters required, departure city / airport code!";
validationFlag = false;
}
if ($("#txtTo1forMobile").val().trim().length == 0 || $("#txtTo1forMobile").val().trim().length < 3) {
strError += "Atleast 3 characters required return city / airport code!";
validationFlag = false;
}
if ($.trim($("#txtFrom1forMobile").val()) == $.trim($("#txtTo1forMobile").val()) && ($.trim($("#txtTo1forMobile").val()).length > 0 || $.trim($("#txtFrom1forMobile").val()).length > 0)) {
strError += "Source and Destination City can't be same !";
validationFlag = false;
}
if ($("#Cabin2").val() == 0) {
strError += "» Please select cabin class!
";
validationFlag = false;
}
var temp;
var departDate;
if ($("#departDate1").val().trim().length == 0) {
validationFlag = false;
strError += "» Departure date can't be blank!
";
} else {
temp = $("#departDate1").val().split("/");
departDate = new Date(parseInt(temp[2], 10), parseInt(temp[0], 10) - 1, parseInt(temp[1], 10));
}
if ($("returnDate1").is(":disabled")) {
temp = $("#rereturnDate1turnDate").val().split("/");
if ($("#returnDate1").val().length < 5) {
validationFlag = false;
strError += "» Return date can't be blank!
";
}
var returnDate = new Date(parseInt(temp[2], 10), parseInt(temp[0], 10) - 1, parseInt(temp[1], 10));
if (departDate > returnDate) {
strError += "Returning date always equal or greater than departure date!";
validationFlag = false;
}
}
var adult = parseInt($("#Adult2").val(), 10);
var child = parseInt($("#Child2").val(), 10);
var infantLap = parseInt($("#Infant2").val(), 10);
var total = adult + child + infantLap;
if (infantLap > adult) {
strError += "Number of infants on lap should be equal to or less then number of adults!!";
validationFlag = false;
}
if (child > (adult * 2)) {
strError += "Maximum number of child and infant with seat should be double number of adults!!";
validationFlag = false;
}
if (total > 9) {
strError += "Total no of person should not be more than 9!!";
validationFlag = false;
}
if (total == 0) {
strError += "Please Choose passenger!!";
validationFlag = false;
}
if (!validationFlag) {
$("#divError").html(strError);
alert(strError);
}/**/
}
catch (err) {
alert(err.toString());
validationFlag = false;
}
if (validationFlag == true) {
var fromCityName = $("#txtFrom1forMobile").val().split('[')[0].toString();
var fromArpName = getAirportCode($("#txtFrom1forMobile").val());
var fromDate = $("#departDate1").val();
var toCityName = $("#txtTo1forMobile").val().split('[')[0].toString();
var toArpName = getAirportCode($("#txtTo1forMobile").val());
var toDate = $("#returnDate1").val();
//var fromDate = $("#departDate").val().split('/');
//var fDate = "";
//if (fromDate.length == 3) {
// fDate = months[parseInt(fromDate[1]) - 1] + " " + fromDate[2] + ", " + fromDate[0];
//}
//else {
// fDate = $("#departDate").val();
//}
//var toDate = $("#returnDate").val().split('/');;
//var tDate = "";
//if (toDate.length == 3) {
// tDate = months[parseInt(toDate[1]) - 1] + " " + toDate[2] + ", " + toDate[0];
//}
//else {
// fDate = $("#departDate").val();
//}
if ($("#hfTripType11").val() == "1") {
$("#waitFrom").html(fromArpName);
$("#waitFromDate").html(fromDate);
$("#waitTo").html(toArpName);
//$("#city1").html(fromCityName);
//$("#city2").html(toCityName);
$("#waitToDate").html(fromDate);
}
else {
$("#waitFrom").html(fromArpName);
$("#waitFromDate").html(fromDate);
$("#waitTo").html(toArpName);
$("#waitToDate").html(toDate);
//$("#city1").html(fromCityName);
//$("#city2").html(toCityName);
}
//$("#waitPax").html(total + " Passengers, " + $("#Cabin option:selected").text());
setLocalStorage();
//$(".searchpop1").show();
$('body').css('overflow', 'hidden');
$(".nit-loading").show();
}
return validationFlag;
}
else
return false;
}
function LettersOnly(e) {
var keycode;
if (window.event) {
keycode = window.event.keyCode; /*alert('IE');*/
}
else if (e) {
keycode = e.which; /*alert('FF');*/
}
var k = parseInt(keycode);
if ((k > 64 && k < 91) || (k > 96 && k < 123) || (k == 32) || (k == 8) || (k == 0)) {
return true;
}
return false;
}
function LettersCommaOnly(e) {
var keycode;
if (window.event) {
keycode = window.event.keyCode; /*alert('IE');*/
}
else if (e) {
keycode = e.which; /*alert('FF');*/
}
var k = parseInt(keycode);
if ((k > 64 && k < 91) || (k > 96 && k < 123) || (k == 32) || (k == 0) || (k == 8) || (k == 44) || (k == 45)) {
return true;
}
return false;
}
function LettersCommaNoOnly(e) {
var keycode;
if (window.event) {
keycode = window.event.keyCode; /*alert('IE');*/
}
else if (e) {
keycode = e.which; /*alert('FF');*/
}
var k = parseInt(keycode);
if ((k > 64 && k < 91) || (k > 96 && k < 123) || (k > 47 && k < 58) || (k == 32) || (k == 0) || (k == 8) || (k == 44) || (k == 45)) {
return true;
}
return false;
}
function onlyNumerics(e) {
var keycode;
if (window.event) {
keycode = window.event.keyCode; /*alert('IE');*/
}
else if (e) {
keycode = e.which; /*alert('FF');*/
}
var k = parseInt(keycode);
if (k > 47 && k < 58 || k == 13 || (k == 8) || (k == 127) || (k == 0))
return true;
else
return false;
}
function getAirportCode(str) {
/*New York [JFK] John F Kennedy, New York, USA*/
var kk = str.split('[');
if (kk.length == 2) {
return kk[1].slice(0, 3);
}
else { return str.slice(0, 3); }
}
var orgIndex = 0;
var destIndex = 0;
var selectFrom = false;
var selectTo = false;
function monkeyPatchAutocomplete() {
var oldFn = $.ui.autocomplete.prototype._renderItem;
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
var re = new RegExp("^" + this.term, "i");
var t = item.label.replace(re, "" + this.term + " ");
return $(" ").data("item.autocomplete", item).append("" + t + " ").appendTo(ul)
}
}
$(function () {
monkeyPatchAutocomplete();
var actionUrl = '/service/GetCity_New';
var selectFrom = false;
var selectTo = false;
$('#fromCity').autocomplete({
selectFirst: true,
highlight: true,
source: function (request, response) {
var url = actionUrl + "/" + request.term;
$.ajax({
url: url,
type: 'GET',
success: function (data) {
orgIndex = 0;
response($.map(data, function (item) {
return {
label: (item.cityName + " [" + item.airportCode + "] " + item.airportName + (item.stateName == "" ? "" : (", " + item.stateName)) + ", " + item.countryName)
}
}));
}
})
},
open: function (event, ui) { selectFrom = true; },
select: function (event, ui) {
$(this).val(ui.item.label);
orgIndex = 1;
selectFrom = false;
return false;
},
close: function (event, ui) {
selectFrom = false;
if ($("#fromCity").val() != "") {
$("#toCity").focus();
}
},
minLength: 1,
autoFocus: true
}).blur(function () {
if (selectFrom) {
$("#fromCity").val($('ul.ui-autocomplete li:first a').text());
orgIndex = 1;
}
});
$("#toCity").autocomplete({
selectFirst: true,
source: function (request, response) {
var url = actionUrl + "/" + request.term;
$.ajax({
url: url,
type: 'GET',
success: function (data) {
destIndex = 0;
response($.map(data, function (item) {
return {
label: (item.cityName + " [" + item.airportCode + "] " + item.airportName + (item.stateName == "" ? "" : (", " + item.stateName)) + ", " + item.countryName)
}
}));
}
})
},
open: function (event, ui) {
selectTo = true;
},
select: function (event, ui) {
$(this).val(ui.item.label);
destIndex = 1;
selectTo = false;
return false;
},
close: function (event, ui) {
selectTo = false;
if ($("#toCity").val() != "") {
$("#departDate").focus();
}
},
minLength: 1,
autoFocus: true
}).blur(function () {
if (selectTo) {
$("#toCity").val($('ul.ui-autocomplete li:first a').text());
destIndex = 1;
}
});
$('#fromCity_Mob1').autocomplete({
selectFirst: true,
highlight: true,
source: function (request, response) {
var url = actionUrl + "/" + request.term;
$.ajax({
url: url,
type: 'GET',
success: function (data) {
orgIndex = 0;
response($.map(data, function (item) {
return {
label: (item.cityName + " [" + item.airportCode + "] " + item.airportName + (item.stateName == "" ? "" : (", " + item.stateName)) + ", " + item.countryName)
}
}));
}
})
},
open: function (event, ui) { selectFrom = true; },
select: function (event, ui) {
$(this).val(ui.item.label);
$("#checkFromvalue").val(ui.item.label);
$("#txtFrom1forMobile").val($("#checkFromvalue").val());
orgIndex = 1;
selectFrom = false;
return false;
},
close: function (event, ui) {
selectFrom = false;
if ($("#txtFrom1forMobile").val() != "") {
$("#txtTo1forMobile").focus();
$('.nit-travel-popUp h3 span').text('Where To');
$('.nit-travel-popUp .nit-input-box label').text('Where To');
$("#txtMobfrom").hide();
$("#txtMobTo").show();
$("#toCity_Mob1").focus();
}
},
minLength: 1,
autoFocus: true
}).blur(function () {
if (selectFrom) {
$("#fromCity_Mob1").val($('ul.ui-autocomplete li:first a').text());
orgIndex = 1;
}
$("#toCity_Mob1").autocomplete({
selectFirst: true,
source: function (request, response) {
var url = actionUrl + "/" + request.term;
$.ajax({
url: url,
type: 'GET',
success: function (data) {
destIndex = 0;
response($.map(data, function (item) {
return {
label: (item.cityName + " [" + item.airportCode + "] " + item.airportName + (item.stateName == "" ? "" : (", " + item.stateName)) + ", " + item.countryName)
}
}));
}
})
},
open: function (event, ui) {
selectTo = true;
},
select: function (event, ui) {
$(this).val(ui.item.label);
$("#checkTovalue").val(ui.item.label);
$("#txtTo1forMobile").val($("#checkTovalue").val());
destIndex = 1;
selectTo = false;
return false;
},
close: function (event, ui) {
selectTo = false;
if ($("#txtTo1forMobile").val() != "") {
$("#txtMobfrom").hide();
$("#txtMobTo").show();
$(".nit-travel-popUp").hide();
}
// $("#departDate").focus();
},
minLength: 1,
autoFocus: true
}).blur(function () {
if (selectTo) {
$("#toCity_Mob1").val($('ul.ui-autocomplete li:first a').text());
destIndex = 1;
}
});
});
//$("#fromCity_Mob").autocomplete({
// minLength: 0,
// source: function (request, response) {
// var url = actionUrl + "/" + request.term;
// $.ajax({
// url: url,
// type: 'GET',
// success: function (data) {
// orgIndex = 0;
// response($.map(data, function (item) {
// return {
// label: (item.cityName + " [" + item.airportCode + "] " + item.airportName + (item.stateName == "" ? "" : (", " + item.stateName)) + ", " + item.countryName)
// }
// }));
// }
// })
// },
// focus: function (event, ui) {
// $("#fromCity_Mob").val(ui.item.label);
// return false;
// },
// select: function (event, ui) {
// $("#fromCity_Mob").val(ui.item.label);
// return false;
// }
//}).data("ui-autocomplete")._renderItem = function (ul, item) {
// return $("")
// .data("ui-autocomplete-item", item)
// .append("" + item.label + " ")
// .appendTo(ul);
// };
});
function setLocalStorage() {
try {
var seg = [];
var s = {
originAirport: getAirportCode($("#fromCity").val().trim()),
destinationAirport: getAirportCode($("#toCity").val().trim()),
originAirportFull: $("#fromCity").val().trim(),
destinationAirportFull: $("#toCity").val().trim(),
travelDate: $("#departDate").val().trim()
}
seg.push(s);
if ($("#hfTripType").val() == "2") {
var s1 = {
originAirport: getAirportCode($("#toCity").val().trim()),
destinationAirport: getAirportCode($("#fromCity").val().trim()),
originAirportFull: $("#toCity").val().trim(),
destinationAirportFull: $("#fromCity").val().trim(),
travelDate: $("#returnDate").val().trim()
}
seg.push(s1);
}
var itin = {
segment: seg,
//searchDirectFlight: $("#isDirectFlight").is(':checked'),
tripType: $("#hfTripType").val(),
adults: $("#Adult").val(),
child: $("#Child").val(),
infants: $("#Infant").val(),
//infantsWs: $("#InfantWs").val(),
cabinType: $("#Cabin").val(),
//airline: $("#airlines").val()
}
var itinerary = [];
itinerary.push(itin)
if (localStorage.getItem("far3f3rry31ds2f3d1f3d1f3d1") != null) {
var ldata = JSON.parse(localStorage.getItem("far3f3rry31ds2f3d1f3d1f3d1"));
var ctr = 0;
for (var i = 0; i < ldata.length && ctr < 2; i++) {
if (itin.segment[0].originAirport != ldata[i].segment[0].originAirport || itin.segment[0].destinationAirport != ldata[i].segment[0].destinationAirport || itin.segment[0].travelDate != ldata[i].segment[0].travelDate || itin.tripType != ldata[i].tripType) {
itinerary.push(ldata[i]);
ctr++;
}
else if (itin.tripType == ldata[i].tripType && ldata[i].tripType.tripType == "2") {
if (itin.segment[1].travelDate != ldata[i].segment[1].travelDate) {
itinerary.push(ldata[i]);
ctr++;
}
}
}
}
localStorage.setItem("far3f3rry31ds2f3d1f3d1f3d1", JSON.stringify(itinerary));
} catch (e) {
}
}
function setSearchEngine() {
try {
if (localStorage.getItem("far3f3rry31ds2f3d1f3d1f3d1") != null) {
var itinerary = JSON.parse(localStorage.getItem("far3f3rry31ds2f3d1f3d1f3d1"));
$("#fromCity").val(itinerary[0].segment[0].originAirportFull);
$("#toCity").val(itinerary[0].segment[0].destinationAirportFull);
var dd = itinerary[0].segment[0].travelDate.split('/');
if (dd.length == 1)
dd = itinerary[0].segment[0].travelDate.split('-');
var dDate = new Date(parseInt(dd[2], 10), parseInt(dd[0], 10) - 1, parseInt(dd[1], 10));
if (minDate < dDate) {
$("#departDate").val(itinerary[0].segment[0].travelDate);
}
if (itinerary[0].segment.length == 2) {
var dd1 = itinerary[0].segment[1].travelDate.split('/');
if (dd1.length == 1)
dd1 = itinerary[0].segment[1].travelDate.split('-');
var rDate = new Date(parseInt(dd1[2], 10), parseInt(dd1[0], 10) - 1, parseInt(dd1[1], 10));
if (dDate < rDate) {
$("#returnDate").val(itinerary[0].segment[1].travelDate);
}
else {
var rd = $("#departDate").val().split('/');
if (rd.length == 1)
rd = $("#departDate").val().split('-');
var dDate = new Date(parseInt(rd[2], 10), parseInt(rd[0], 10) - 1, parseInt(rd[1], 10));
dDate.setDate(dDate.getDate() + 7);
var month = (dDate.getMonth() + 1)
var strMonth = month <= 9 ? ("0" + month) : month;
var strDate = dDate.getDate() <= 9 ? ("0" + dDate.getDate()) : dDate.getDate();
$("#returnDate").val(strMonth + "/" + strDate + "/" + dDate.getFullYear());
}
}
else {
var rd = $("#departDate").val().split('/');
if (rd.length == 1)
rd = $("#departDate").val().split('-');
var dDate = new Date(parseInt(rd[2], 10), parseInt(rd[0], 10) - 1, parseInt(rd[1], 10));
dDate.setDate(dDate.getDate() + 7);
var month = (dDate.getMonth() + 1)
var strMonth = month <= 9 ? ("0" + month) : month;
var strDate = dDate.getDate() <= 9 ? ("0" + dDate.getDate()) : dDate.getDate();
$("#returnDate").val(strMonth + "/" + strDate + "/" + dDate.getFullYear());
}
$("#Adult").val((itinerary[0].adults != null && itinerary[0].adults != undefined) ? itinerary[0].adults : "1");
$("#Child").val((itinerary[0].child != null && itinerary[0].child != undefined) ? itinerary[0].child : "0");
$("#Infant").val((itinerary[0].infants != null && itinerary[0].infants != undefined) ? itinerary[0].infants : "0");
// $("#InfantWs").val((itinerary[0].infantsWs != null && itinerary[0].infantsWs != undefined) ? itinerary[0].infantsWs : "0");
//$("#airlines").val((itinerary[0].airline != null && itinerary[0].airline != undefined) ? itinerary[0].airline : "All");
$("#Cabin").val((itinerary[0].cabinType != null && itinerary[0].cabinType != undefined) ? itinerary[0].cabinType : "1");
var cabinText = "";
if (itinerary[0].cabinType == "1") {
cabinText = "Economy";
}
if (itinerary[0].cabinType == "2") {
cabinText = "PremiumEconomy";
}
if (itinerary[0].cabinType == "3") {
cabinText = "BusinessClass";
}
if (itinerary[0].cabinType == "4") {
cabinText = "FirstClass";
}
$("#hfTripType").val(itinerary[0].tripType);
var totalAdult = parseInt(itinerary[0].adults);
var totalChild = parseInt(itinerary[0].child);
var totalInfant = parseInt(itinerary[0].infants);
var traveler = totalAdult + totalChild + totalInfant;
var totPaxClass = traveler + " Traveler , " + cabinText;
$("#txtPaxDetail").val(totPaxClass);
$("#txtPaxDetail2").val(totPaxClass);
//document.getElementById("txtPaxDetail1").innerHTML = " " + traveler.toString() + " Traveler, " + cabinText;
cabinchange(itinerary[0].cabinType);
setTripType(itinerary[0].tripType);
ddlTypejourneyChange(itinerary[0].tripType);
//var str = "";
//for (var i = 0; i < itinerary.length; i++) {
// str += " ";
// str += " " + itinerary[i].segment[0].originAirport + " - " + itinerary[i].segment[0].destinationAirport + " " + itinerary[i].segment[0].travelDate + (itinerary[i].segment.length == 2 ? (" - " + itinerary[i].segment[1].travelDate + " ") : " - One Way") + " ";
//}
//$("#totRecentSearch").html(itinerary.length);
//if (itinerary.length > 0) {
// $("#totRecentSearch").addClass('Scratchpad');
//}
//else {
// $("#totRecentSearch").removeClass('Scratchpad');
//}
//$("#MySearches").html(str);
}
else {
$("#totRecentSearch").removeClass('Scratchpad');
}
} catch (e) {
}
}
function SearchFlightFromHistory(itin) {
try {
if ($("#HomePageindex").length != 0) {
if (localStorage.getItem("far3f3rry31ds2f3d1f3d1f3d1") != null) {
var itinerary = JSON.parse(localStorage.getItem("far3f3rry31ds2f3d1f3d1f3d1"));
$("#fromCity").val(itinerary[itin].segment[0].originAirportFull);
$("#toCity").val(itinerary[itin].segment[0].destinationAirportFull);
var dd = itinerary[itin].segment[0].travelDate.split('/');
if (dd.length == 1)
dd = itinerary[itin].segment[0].travelDate.split('-');
var dDate = new Date(parseInt(dd[2], 10), parseInt(dd[0], 10) - 1, parseInt(dd[1], 10));
if (minDate < dDate) {
$("#departDate").val(itinerary[itin].segment[0].travelDate);
}
if (itinerary[itin].segment.length == 2) {
var dd1 = itinerary[itin].segment[1].travelDate.split('/');
if (dd1.length == 1)
dd1 = itinerary[itin].segment[1].travelDate.split('-');
var rDate = new Date(parseInt(dd1[2], 10), parseInt(dd1[0], 10) - 1, parseInt(dd1[1], 10));
if (dDate < rDate) {
$("#returnDate").val(itinerary[itin].segment[1].travelDate);
}
else {
var rd = $("#departDate").val().split('/');
if (rd.length == 1)
rd = $("#departDate").val().split('-');
var dDate = new Date(parseInt(rd[2], 10), parseInt(rd[0], 10) - 1, parseInt(rd[1], 10));
dDate.setDate(dDate.getDate() + 7);
var month = (dDate.getMonth() + 1)
var strMonth = month <= 9 ? ("0" + month) : month;
$("#returnDate").val(strMonth + "/" + dDate.getDate() + "/" + dDate.getFullYear());
}
}
else {
var rd = $("#departDate").val().split('/');
if (rd.length == 1)
rd = $("#departDate").val().split('-');
var dDate = new Date(parseInt(rd[2], 10), parseInt(rd[0], 10) - 1, parseInt(rd[1], 10));
dDate.setDate(dDate.getDate() + 7);
var month = (dDate.getMonth() + 1)
var strMonth = month <= 9 ? ("0" + month) : month;
$("#returnDate").val(strMonth + "/" + dDate.getDate() + "/" + dDate.getFullYear());
}
$("#Adult").val((itinerary[itin].adults != null && itinerary[itin].adults != undefined) ? itinerary[itin].adults : "1");
$("#Child").val((itinerary[itin].child != null && itinerary[itin].child != undefined) ? itinerary[itin].child : "0");
$("#Infant").val((itinerary[itin].infants != null && itinerary[itin].infants != undefined) ? itinerary[itin].infants : "0");
$("#InfantWs").val((itinerary[itin].infantsWs != null && itinerary[itin].infantsWs != undefined) ? itinerary[itin].infantsWs : "0");
$("#airlines").val((itinerary[itin].airline != null && itinerary[itin].airline != undefined) ? itinerary[itin].airline : "All");
$("#Cabin").val((itinerary[itin].cabinType != null && itinerary[itin].cabinType != undefined) ? itinerary[itin].cabinType : "1");
$("#hfTripType").val(itinerary[itin].tripType);
var fromCityName = $("#fromCity").val().split(',')[1].toString();
var fromDate = $("#departDate").val();
var toCityName = $("#toCity").val().split(',')[1].toString();
var toDate = $("#returnDate").val();
if (itinerary[itin].tripType == 1) {
$("#waitFrom").html(fromCityName);
$("#spanTo").html(fromDate);
$("#waitTo").html(toCityName);
}
else {
$("#waitFrom").html(fromCityName + " " + fromDate);
$("#spanTo").html("To");
$("#waitTo").html(toCityName + " " + toDate);
}
$(".searchpop1").show();
$("#flightSearch").submit();
}
}
} catch (e) {
$(".searchpop1").hide();
}
}
function CheckCruise() {
var strMsg = "";
if ($('#txtnameCruise').val() == "") {
$('#txtnameCruise').addClass('errorClass');
//$("#txtname").parent().after("Please enter email address
");
strMsg += "Please enter your name!\n\r";
}
else {
$('#txtnameCruise').removeClass('errorClass');
}
if ($('#txtEmailCruise').val() == "") {
$('#txtEmailCruise').addClass('errorClass');
strMsg += "Please enter valid email address!\n\r";
}
else {
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (!$("#txtEmailCruise").val().match(mailformat)) {
$('#txtEmailCruise').addClass('errorClass');
strMsg += "Required valid email address.!\n\r";
}
else {
$('#txtEmailCruise').removeClass('errorClass');
}
}
if ($('#txtPhoneCruise').val() == "") {
$('#txtPhoneCruise').addClass('errorClass');
strMsg += "Please enter your Number!\n\r";
}
else {
$('#txtPhoneCruise').removeClass('errorClass');
}
if ($('#txtOriginCruise').val() == "") {
$('#txtOriginCruise').addClass('errorClass');
strMsg += "Please Select Origin Port!\n\r";
}
else {
$('#txtOriginCruise').removeClass('errorClass');
}
if ($('#txtTravelMonth').val() == "") {
$('#txtTravelMonth').addClass('errorClass');
strMsg += "Please select Travel Month!\n\r";
}
else {
$('#txtTravelMonth').removeClass('errorClass');
}
if ($('#txtnumberNight').val() == "") {
$('#txtnumberNight').addClass('errorClass');
strMsg += "Please select Number of Nights!\n\r";
}
else {
$('#txtnumberNight').removeClass('errorClass');
}
if ($('#txtDestPort').val() == "") {
$('#txtDestPort').addClass('errorClass');
strMsg += "Please select Destination Port!\n\r";
}
else {
$('#txtDestPort').removeClass('errorClass');
}
if ($('#txtCruiseLine').val() == "") {
$('#txtCruiseLine').addClass('errorClass');
strMsg += "Please select Cruise Line!\n\r";
}
else {
$('#txtCruiseLine').removeClass('errorClass');
}
//else {
// var phoneformat = /^\d{10}$/;
// if (!$('#txtPhone').val().match(phoneformat)) {
// $('#txtPhone').addClass('errorClass');
// $('#errormsg2').html("Required valid phone number.");
// ctr++;
// }
// else {
// $('#txtPhone').removeClass('errorClass');
// }
//}
if (strMsg == "") {
var req = {
Name: $("#txtnameCruise").val(),
emailID: $("#txtEmailCruise").val(),
phone: $("#txtPhoneCruise").val(),
origin: $("#txtOriginCruise").val(),
TrMonth: $("#txtTravelMonth").val(),
TrNight: $("#txtnumberNight").val(),
phone: $("#txtDestPort").val(),
CrLine: $("#txtCruiseLine").val(),
comments: $("#txtMsgArea").val(),
}
$('#idQueryFormPB').show();
$.ajax({
type: "POST",
//url: "/home/contactUs",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(req),
responseType: "json",
success: function (data) {
$('#idQueryFormPB').hide();
if (data.status == 1) {
$('#txtfinalmsg').css("color", "green");
$('#txtfinalmsg').css("font-size", "14px");
$('#txtfinalmsg').html("Thank you for your query. Our travel executive will get back to you at the earliest.");
$("#txtnameCruise").val("");
$("#txtEmailCruise").val("");
$("#txtPhoneCruise").val("");
$("#txtOriginCruise").val("");
$("#txtTravelMonth").val("");
$("#txtnumberNight").val("");
$("#txtDestPort").val("");
$("#txtCruiseLine").val("");
$("#txtMsgArea").val("");
}
else {
$('#idQueryFormPB').hide();
$('#txtfinalmsg').css("color", "green");
$('#txtfinalmsg').css("font-size", "14px");
$('#txtfinalmsg').html("Thank you for your query. Our travel executive will get back to you at the earliest.");
$("#txtnameCruise").val("");
$("#txtEmailCruise").val("");
$("#txtPhoneCruise").val("");
$("#txtOriginCruise").val("");
$("#txtTravelMonth").val("");
$("#txtnumberNight").val("");
$("#txtDestPort").val("");
$("#txtCruiseLine").val("");
$("#txtMsgArea").val("");
}
},
error: function (data) {
$('#idQueryFormPB').hide();
$('#txtfinalmsg').css("color", "green");
$('#txtfinalmsg').css("font-size", "14px");
$('#txtfinalmsg').html("Thank you for your query. Our travel executive will get back to you at the earliest.");
$("#txtnameCruise").val("");
$("#txtEmailCruise").val("");
$("#txtPhoneCruise").val("");
$("#txtOriginCruise").val("");
$("#txtTravelMonth").val("");
$("#txtnumberNight").val("");
$("#txtDestPort").val("");
$("#txtCruiseLine").val("");
$("#txtMsgArea").val("");
},
});
}
else {
alert(strMsg);
return false;
}
};