
!function(e){"use strict";var t={i18n:{ru:{months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],dayOfWeek:["Вск","Пн","Вт","Ср","Чт","Пт","Сб"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeek:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayOfWeek:["So","Mo","Di","Mi","Do","Fr","Sa"]},nl:{months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],dayOfWeek:["zo","ma","di","wo","do","vr","za"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],dayOfWeek:["Paz","Pts","Sal","Çar","Per","Cum","Cts"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],dayOfWeek:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],dayOfWeek:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"]},th:{months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],dayOfWeek:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},pl:{months:["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],dayOfWeek:["nd","pn","wt","śr","cz","pt","sb"]},pt:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeek:["Dom","Seg","Ter","Qua","Qui","Sex","Sab"]},ch:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeek:["日","一","二","三","四","五","六"]},se:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeek:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},kr:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeek:["일","월","화","수","목","금","토"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],dayOfWeek:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"]},da:{months:["January","Februar","Marts","April","Maj","Juni","July","August","September","Oktober","November","December"],dayOfWeek:["Søn","Man","Tir","ons","Tor","Fre","lør"]},ja:{months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["日","月","火","水","木","金","土"]},vi:{months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],dayOfWeek:["CN","T2","T3","T4","T5","T6","T7"]}},value:"",lang:"en",format:"Y/m/d H:i",formatTime:"H:i",formatDate:"Y/m/d",startDate:!1,step:60,closeOnDateSelect:!1,closeOnWithoutClick:!0,timepicker:!0,datepicker:!0,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,allowTimes:[],opened:!1,initTime:!0,inline:!1,onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,timeHeightInTimePicker:25,timepickerScrollbar:!0,todayButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!0,lazyInit:!1,mask:!1,validateOnBlur:!0,allowBlank:!0,yearStart:1950,yearEnd:2050,style:"",id:"",roundTime:"round",className:"",weekends:[],yearOffset:0};Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){for(var n=t||0,a=this.length;n<a;n++)if(this[n]===e)return n;return-1}),e.fn.xdsoftScroller=function(t){return this.each(function(){var n=e(this);if(!e(this).hasClass("xdsoft_scroller_box")){var a=function(e){var t={x:0,y:0};if("touchstart"==e.type||"touchmove"==e.type||"touchend"==e.type||"touchcancel"==e.type){var n=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0];t.x=n.pageX,t.y=n.pageY}else"mousedown"!=e.type&&"mouseup"!=e.type&&"mousemove"!=e.type&&"mouseover"!=e.type&&"mouseout"!=e.type&&"mouseenter"!=e.type&&"mouseleave"!=e.type||(t.x=e.pageX,t.y=e.pageY);return t},r=0,o=n.children().eq(0),s=n[0].clientHeight,i=o[0].offsetHeight,d=e('<div class="xdsoft_scrollbar"></div>'),u=e('<div class="xdsoft_scroller"></div>'),c=100,l=!1;d.append(u),n.addClass("xdsoft_scroller_box").append(d),u.on("mousedown.xdsoft_scroller",function(a){s||n.trigger("resize_scroll.xdsoft_scroller",[t]);var o=a.pageY,i=parseInt(u.css("margin-top")),l=d[0].offsetHeight;e(document.body).addClass("xdsoft_noselect"),e([document.body,window]).on("mouseup.xdsoft_scroller",function f(){e([document.body,window]).off("mouseup.xdsoft_scroller",f).off("mousemove.xdsoft_scroller",r).removeClass("xdsoft_noselect")}),e(document.body).on("mousemove.xdsoft_scroller",r=function(e){var t=e.pageY-o+i;t<0&&(t=0),t+u[0].offsetHeight>l&&(t=l-u[0].offsetHeight),n.trigger("scroll_element.xdsoft_scroller",[c?t/c:0])})}),n.on("scroll_element.xdsoft_scroller",function(e,t){s||n.trigger("resize_scroll.xdsoft_scroller",[t,!0]),t=t>1?1:t<0||isNaN(t)?0:t,u.css("margin-top",c*t),o.css("marginTop",-parseInt((i-s)*t))}).on("resize_scroll.xdsoft_scroller",function(e,t,a){s=n[0].clientHeight,i=o[0].offsetHeight;var r=s/i,l=r*d[0].offsetHeight;r>1?u.hide():(u.show(),u.css("height",parseInt(l>10?l:10)),c=d[0].offsetHeight-u[0].offsetHeight,a!==!0&&n.trigger("scroll_element.xdsoft_scroller",[t?t:Math.abs(parseInt(o.css("marginTop")))/(i-s)]))}),n.mousewheel&&n.mousewheel(function(e,t,a,r){var d=Math.abs(parseInt(o.css("marginTop")));return n.trigger("scroll_element.xdsoft_scroller",[(d-20*t)/(i-s)]),e.stopPropagation(),!1}),n.on("touchstart",function(e){l=a(e)}),n.on("touchmove",function(e){if(l){var t=a(e),r=Math.abs(parseInt(o.css("marginTop")));n.trigger("scroll_element.xdsoft_scroller",[(r-(t.y-l.y))/(i-s)]),e.stopPropagation(),e.preventDefault()}}),n.on("touchend touchcancel",function(e){l=!1})}n.trigger("resize_scroll.xdsoft_scroller",[t])})},e.fn.datetimepicker=function(n){var a=48,r=57,o=96,s=105,i=17,d=46,u=13,c=27,l=8,f=37,m=38,h=39,g=40,p=9,x=116,v=65,y=67,D=86,T=90,w=89,b=!1,_=e.isPlainObject(n)||!n?e.extend(!0,{},t,n):e.extend({},t),M=0,k=function(e){e.on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function t(n){e.is(":disabled")||e.is(":hidden")||!e.is(":visible")||e.data("xdsoft_datetimepicker")||(clearTimeout(M),M=setTimeout(function(){e.data("xdsoft_datetimepicker")||S(e),e.off("open.xdsoft focusin.xdsoft mousedown.xdsoft",t).trigger("open.xdsoft")},100))})},S=function(t){function n(){var e=_.value?_.value:t&&t.val&&t.val()?t.val():"";return e&&W.isValidDate(e=Date.parseDate(e,_.format))?M.data("changed",!0):e="",e||_.startDate===!1||(e=W.strToDateTime(_.startDate)),e?e:0}var M=e("<div "+(_.id?'id="'+_.id+'"':"")+" "+(_.style?'style="'+_.style+'"':"")+' class="xdsoft_datetimepicker xdsoft_noselect '+_.className+'"></div>'),k=e('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),S=e('<div class="xdsoft_datepicker active"></div>'),O=e('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button><div class="xdsoft_label xdsoft_month"><span></span></div><div class="xdsoft_label xdsoft_year"><span></span></div><button type="button" class="xdsoft_next"></button></div>'),F=e('<div class="xdsoft_calendar"></div>'),I=e('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),C=I.find(".xdsoft_time_box").eq(0),H=e('<div class="xdsoft_time_variant"></div>'),Y=e('<div class="xdsoft_scrollbar"></div>'),P=(e('<div class="xdsoft_scroller"></div>'),e('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>')),A=e('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>');O.find(".xdsoft_month span").after(P),O.find(".xdsoft_year span").after(A),O.find(".xdsoft_month,.xdsoft_year").on("mousedown.xdsoft",function(t){O.find(".xdsoft_select").hide();var n=e(this).find(".xdsoft_select").eq(0),a=0,r=0;W.currentTime&&(a=W.currentTime[e(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]()),n.show();for(var o=n.find("div.xdsoft_option"),s=0;s<o.length&&o.eq(s).data("value")!=a;s++)r+=o[0].offsetHeight;return n.xdsoftScroller(r/(n.children()[0].offsetHeight-n[0].clientHeight)),t.stopPropagation(),!1}),O.find(".xdsoft_select").xdsoftScroller().on("mousedown.xdsoft",function(e){e.stopPropagation(),e.preventDefault()}).on("mousedown.xdsoft",".xdsoft_option",function(t){W&&W.currentTime&&W.currentTime[e(this).parent().parent().hasClass("xdsoft_monthselect")?"setMonth":"setFullYear"](e(this).data("value")),e(this).parent().parent().hide(),M.trigger("xchange.xdsoft"),_.onChangeMonth&&_.onChangeMonth.call&&_.onChangeMonth.call(M,W.currentTime,M.data("input"))}),M.setOptions=function(n){if(_=e.extend(!0,{},_,n),n.allowTimes&&e.isArray(n.allowTimes)&&n.allowTimes.length&&(_.allowTimes=e.extend(!0,[],n.allowTimes)),n.weekends&&e.isArray(n.weekends)&&n.weekends.length&&(_.weekends=e.extend(!0,[],n.weekends)),!_.open&&!_.opened||_.inline||t.trigger("open.xdsoft"),_.inline&&(M.addClass("xdsoft_inline"),t.after(M).hide(),M.trigger("afterOpen.xdsoft")),_.inverseButton&&(_.next="xdsoft_prev",_.prev="xdsoft_next"),_.datepicker?S.addClass("active"):S.removeClass("active"),_.timepicker?I.addClass("active"):I.removeClass("active"),_.value&&(t&&t.val&&t.val(_.value),W.setCurrentTime(_.value)),isNaN(_.dayOfWeekStart)||parseInt(_.dayOfWeekStart)<0||parseInt(_.dayOfWeekStart)>6?_.dayOfWeekStart=0:_.dayOfWeekStart=parseInt(_.dayOfWeekStart),_.timepickerScrollbar||Y.hide(),_.minDate&&/^-(.*)$/.test(_.minDate)&&(_.minDate=W.strToDateTime(_.minDate).dateFormat(_.formatDate)),_.maxDate&&/^\+(.*)$/.test(_.maxDate)&&(_.maxDate=W.strToDateTime(_.maxDate).dateFormat(_.formatDate)),O.find(".xdsoft_today_button").css("visibility",_.todayButton?"visible":"hidden"),_.mask){var k=function(e){try{if(document.selection&&document.selection.createRange){var t=document.selection.createRange();return t.getBookmark().charCodeAt(2)-2}if(e.setSelectionRange)return e.selectionStart}catch(n){return 0}},F=function(e,t){var e="string"==typeof e||e instanceof String?document.getElementById(e):e;if(!e)return!1;if(e.createTextRange){var n=e.createTextRange();return n.collapse(!0),n.moveEnd(t),n.moveStart(t),n.select(),!0}return!!e.setSelectionRange&&(e.setSelectionRange(t,t),!0)},C=function(e,t){var n=e.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,"\\$1").replace(/_/g,"{digit+}").replace(/([0-9]{1})/g,"{digit$1}").replace(/\{digit([0-9]{1})\}/g,"[0-$1_]{1}").replace(/\{digit[\+]\}/g,"[0-9_]{1}");return RegExp(n).test(t)};switch(t.off("keydown.xdsoft"),!0){case _.mask===!0:_.mask=_.format.replace(/Y/g,"9999").replace(/F/g,"9999").replace(/m/g,"19").replace(/d/g,"39").replace(/H/g,"29").replace(/i/g,"59").replace(/s/g,"59");case"string"==e.type(_.mask):C(_.mask,t.val())||t.val(_.mask.replace(/[0-9]/g,"_")),t.on("keydown.xdsoft",function(n){var M=this.value,S=n.which;switch(!0){case S>=a&&S<=r||S>=o&&S<=s||S==l||S==d:var O=k(this),I=S!=l&&S!=d?String.fromCharCode(o<=S&&S<=s?S-a:S):"_";for(S!=l&&S!=d||!O||(O--,I="_");/[^0-9_]/.test(_.mask.substr(O,1))&&O<_.mask.length&&O>0;)O+=S==l||S==d?-1:1;if(M=M.substr(0,O)+I+M.substr(O+1),""==e.trim(M))M=_.mask.replace(/[0-9]/g,"_");else if(O==_.mask.length)break;for(O+=S==l||S==d?0:1;/[^0-9_]/.test(_.mask.substr(O,1))&&O<_.mask.length&&O>0;)O+=S==l||S==d?-1:1;C(_.mask,M)?(this.value=M,F(this,O)):""==e.trim(M)?this.value=_.mask.replace(/[0-9]/g,"_"):t.trigger("error_input.xdsoft");break;case!!~[v,y,D,T,w].indexOf(S)&&b:case!!~[c,m,g,f,h,x,i,p,u].indexOf(S):return!0}return n.preventDefault(),!1})}}_.validateOnBlur&&t.off("blur.xdsoft").on("blur.xdsoft",function(){_.allowBlank&&!e.trim(e(this).val()).length?(e(this).val(null),M.data("xdsoft_datetime").empty()):Date.parseDate(e(this).val(),_.format)?M.data("xdsoft_datetime").setCurrentTime(e(this).val()):(e(this).val(W.now().dateFormat(_.format)),M.data("xdsoft_datetime").setCurrentTime(e(this).val())),M.trigger("changedatetime.xdsoft")}),_.dayOfWeekStartPrev=0==_.dayOfWeekStart?6:_.dayOfWeekStart-1,M.trigger("xchange.xdsoft")},M.data("options",_).on("mousedown.xdsoft",function(e){return e.stopPropagation(),e.preventDefault(),A.hide(),P.hide(),!1});var N=I.find(".xdsoft_time_box");N.append(H),N.xdsoftScroller(),M.on("afterOpen.xdsoft",function(){N.xdsoftScroller()}),M.append(S).append(I),_.withoutCopyright!==!0&&M.append(k),S.append(O).append(F),e("body").append(M);var W=new function(){var e=this;e.now=function(){var e=new Date;return _.yearOffset&&e.setFullYear(e.getFullYear()+_.yearOffset),e},e.currentTime=this.now(),e.isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},e.setCurrentTime=function(t){e.currentTime="string"==typeof t?e.strToDateTime(t):e.isValidDate(t)?t:e.now(),M.trigger("xchange.xdsoft")},e.empty=function(){e.currentTime=null},e.getCurrentTime=function(t){return e.currentTime},e.nextMonth=function(){var t=e.currentTime.getMonth()+1;return 12==t&&(e.currentTime.setFullYear(e.currentTime.getFullYear()+1),t=0),e.currentTime.setDate(Math.min(Date.daysInMonth[t],e.currentTime.getDate())),e.currentTime.setMonth(t),_.onChangeMonth&&_.onChangeMonth.call&&_.onChangeMonth.call(M,W.currentTime,M.data("input")),M.trigger("xchange.xdsoft"),t},e.prevMonth=function(){var t=e.currentTime.getMonth()-1;return t==-1&&(e.currentTime.setFullYear(e.currentTime.getFullYear()-1),t=11),e.currentTime.setDate(Math.min(Date.daysInMonth[t],e.currentTime.getDate())),e.currentTime.setMonth(t),_.onChangeMonth&&_.onChangeMonth.call&&_.onChangeMonth.call(M,W.currentTime,M.data("input")),M.trigger("xchange.xdsoft"),t},e.strToDateTime=function(t){var n,a,r=[];return(r=/^(\+|\-)(.*)$/.exec(t))&&(r[2]=Date.parseDate(r[2],_.formatDate))?(n=r[2].getTime()-1*r[2].getTimezoneOffset()*6e4,a=new Date(W.now().getTime()+parseInt(r[1]+"1")*n)):a=t?Date.parseDate(t,_.format):e.now(),e.isValidDate(a)||(a=e.now()),a},e.strtodate=function(t){var n=t?Date.parseDate(t,_.formatDate):e.now();return e.isValidDate(n)||(n=e.now()),n},e.strtotime=function(t){var n=t?Date.parseDate(t,_.formatTime):e.now();return e.isValidDate(n)||(n=e.now()),n},e.str=function(){return e.currentTime.dateFormat(_.format)}};O.find(".xdsoft_today_button").on("mousedown.xdsoft",function(){M.data("changed",!0),W.setCurrentTime(0),M.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){t.val(W.str()),M.trigger("close.xdsoft")}),O.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var t=e(this),n=0,a=!1;!function r(e){W.currentTime.getMonth();t.hasClass(_.next)?W.nextMonth():t.hasClass(_.prev)&&W.prevMonth(),!a&&(n=setTimeout(r,e?e:100))}(500),e([document.body,window]).on("mouseup.xdsoft",function o(){clearTimeout(n),a=!0,e([document.body,window]).off("mouseup.xdsoft",o)})}),I.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var t=e(this),n=0,a=!1,r=110;!function o(e){var s=C[0].clientHeight,i=H[0].offsetHeight,d=Math.abs(parseInt(H.css("marginTop")));t.hasClass(_.next)&&i-s-_.timeHeightInTimePicker>=d?H.css("marginTop","-"+(d+_.timeHeightInTimePicker)+"px"):t.hasClass(_.prev)&&d-_.timeHeightInTimePicker>=0&&H.css("marginTop","-"+(d-_.timeHeightInTimePicker)+"px"),C.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(H.css("marginTop"))/(i-s))]),r=r>10?10:r-10,!a&&(n=setTimeout(o,e?e:r))}(500),e([document.body,window]).on("mouseup.xdsoft",function s(){clearTimeout(n),a=!0,e([document.body,window]).off("mouseup.xdsoft",s)})});var z=0;M.on("xchange.xdsoft",function(t){clearTimeout(z),z=setTimeout(function(){for(var t="",n=new Date(W.currentTime.getFullYear(),W.currentTime.getMonth(),1,12,0,0),a=0,r=W.now();n.getDay()!=_.dayOfWeekStart;)n.setDate(n.getDate()-1);t+="<table><thead><tr>";for(var o=0;o<7;o++)t+="<th>"+_.i18n[_.lang].dayOfWeek[o+_.dayOfWeekStart>6?0:o+_.dayOfWeekStart]+"</th>";t+="</tr></thead>",t+="<tbody><tr>";var s=!1,i=!1;_.maxDate!==!1&&(s=W.strtodate(_.maxDate),s=new Date(s.getFullYear(),s.getMonth(),s.getDate(),23,59,59,999)),_.minDate!==!1&&(i=W.strtodate(_.minDate),i=new Date(i.getFullYear(),i.getMonth(),i.getDate()));for(var d,u,c,l=[];a<W.currentTime.getDaysInMonth()||n.getDay()!=_.dayOfWeekStart||W.currentTime.getMonth()==n.getMonth();)l=[],a++,d=n.getDate(),u=n.getFullYear(),c=n.getMonth(),l.push("xdsoft_date"),(s!==!1&&n>s||i!==!1&&n<i)&&l.push("xdsoft_disabled"),W.currentTime.getMonth()!=c&&l.push("xdsoft_other_month"),(_.defaultSelect||M.data("changed"))&&W.currentTime.dateFormat("d.m.Y")==n.dateFormat("d.m.Y")&&l.push("xdsoft_current"),r.dateFormat("d.m.Y")==n.dateFormat("d.m.Y")&&l.push("xdsoft_today"),(0==n.getDay()||6==n.getDay()||~_.weekends.indexOf(n.dateFormat("d.m.Y")))&&l.push("xdsoft_weekend"),_.beforeShowDay&&"function"==typeof _.beforeShowDay&&l.push(_.beforeShowDay(n)),t+='<td data-date="'+d+'" data-month="'+c+'" data-year="'+u+'" class="xdsoft_date xdsoft_day_of_week'+n.getDay()+" "+l.join(" ")+'"><div>'+d+"</div></td>",n.getDay()==_.dayOfWeekStartPrev&&(t+="</tr>"),n.setDate(d+1);t+="</tbody></table>",F.html(t),O.find(".xdsoft_label span").eq(0).text(_.i18n[_.lang].months[W.currentTime.getMonth()]),O.find(".xdsoft_label span").eq(1).text(W.currentTime.getFullYear());var f="",m="",c="",h=function(e,t){var n=W.now();n.setHours(e),e=parseInt(n.getHours()),n.setMinutes(t),t=parseInt(n.getMinutes()),l=[],(_.maxTime!==!1&&W.strtotime(_.maxTime).getTime()<n.getTime()||_.minTime!==!1&&W.strtotime(_.minTime).getTime()>n.getTime())&&l.push("xdsoft_disabled"),(_.initTime||_.defaultSelect||M.data("changed"))&&parseInt(W.currentTime.getHours())==parseInt(e)&&(_.step>59||Math[_.roundTime](W.currentTime.getMinutes()/_.step)*_.step==parseInt(t))&&(_.defaultSelect||M.data("changed")?l.push("xdsoft_current"):_.initTime&&l.push("xdsoft_init_time")),parseInt(r.getHours())==parseInt(e)&&parseInt(r.getMinutes())==parseInt(t)&&l.push("xdsoft_today"),f+='<div class="xdsoft_time '+l.join(" ")+'" data-hour="'+e+'" data-minute="'+t+'">'+n.dateFormat(_.formatTime)+"</div>"};if(_.allowTimes&&e.isArray(_.allowTimes)&&_.allowTimes.length)for(var a=0;a<_.allowTimes.length;a++)m=W.strtotime(_.allowTimes[a]).getHours(),c=W.strtotime(_.allowTimes[a]).getMinutes(),h(m,c);else for(var a=0,o=0;a<(_.hours12?12:24);a++)for(o=0;o<60;o+=_.step)m=(a<10?"0":"")+a,c=(o<10?"0":"")+o,h(m,c);H.html(f);var g="",a=0;for(a=parseInt(_.yearStart,10)+_.yearOffset;a<=parseInt(_.yearEnd,10)+_.yearOffset;a++)g+='<div class="xdsoft_option '+(W.currentTime.getFullYear()==a?"xdsoft_current":"")+'" data-value="'+a+'">'+a+"</div>";for(A.children().eq(0).html(g),a=0,g="";a<=11;a++)g+='<div class="xdsoft_option '+(W.currentTime.getMonth()==a?"xdsoft_current":"")+'" data-value="'+a+'">'+_.i18n[_.lang].months[a]+"</div>";P.children().eq(0).html(g),e(this).trigger("generate.xdsoft")},10),t.stopPropagation()}).on("afterOpen.xdsoft",function(){if(_.timepicker){var e;if(H.find(".xdsoft_current").length?e=".xdsoft_current":H.find(".xdsoft_init_time").length&&(e=".xdsoft_init_time"),e){var t=C[0].clientHeight,n=H[0].offsetHeight,a=H.find(e).index()*_.timeHeightInTimePicker+1;n-t<a&&(a=n-t),H.css("marginTop","-"+parseInt(a)+"px"),C.trigger("scroll_element.xdsoft_scroller",[parseInt(a)/(n-t)])}}});var J=0;F.on("click.xdsoft","td",function(n){n.stopPropagation(),J++;var a=e(this),r=W.currentTime;return!a.hasClass("xdsoft_disabled")&&(r.setDate(a.data("date")),r.setMonth(a.data("month")),r.setFullYear(a.data("year")),M.trigger("select.xdsoft",[r]),t.val(W.str()),(J>1||_.closeOnDateSelect===!0||0===_.closeOnDateSelect&&!_.timepicker)&&!_.inline&&M.trigger("close.xdsoft"),_.onSelectDate&&_.onSelectDate.call&&_.onSelectDate.call(M,W.currentTime,M.data("input")),M.data("changed",!0),M.trigger("xchange.xdsoft"),M.trigger("changedatetime.xdsoft"),void setTimeout(function(){J=0},200))}),H.on("click.xdsoft","div",function(t){t.stopPropagation();var n=e(this),a=W.currentTime;return!n.hasClass("xdsoft_disabled")&&(a.setHours(n.data("hour")),a.setMinutes(n.data("minute")),M.trigger("select.xdsoft",[a]),M.data("input").val(W.str()),!_.inline&&M.trigger("close.xdsoft"),_.onSelectTime&&_.onSelectTime.call&&_.onSelectTime.call(M,W.currentTime,M.data("input")),M.data("changed",!0),M.trigger("xchange.xdsoft"),void M.trigger("changedatetime.xdsoft"))}),M.mousewheel&&S.mousewheel(function(e,t,n,a){return!_.scrollMonth||(t<0?W.nextMonth():W.prevMonth(),!1)}),M.mousewheel&&C.unmousewheel().mousewheel(function(e,t,n,a){if(!_.scrollTime)return!0;var r=C[0].clientHeight,o=H[0].offsetHeight,s=Math.abs(parseInt(H.css("marginTop"))),i=!0;return t<0&&o-r-_.timeHeightInTimePicker>=s?(H.css("marginTop","-"+(s+_.timeHeightInTimePicker)+"px"),i=!1):t>0&&s-_.timeHeightInTimePicker>=0&&(H.css("marginTop","-"+(s-_.timeHeightInTimePicker)+"px"),i=!1),C.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(H.css("marginTop"))/(o-r))]),e.stopPropagation(),i}),M.on("changedatetime.xdsoft",function(){if(_.onChangeDateTime&&_.onChangeDateTime.call){var e=M.data("input");_.onChangeDateTime.call(M,W.currentTime,e),e.trigger("change")}}).on("generate.xdsoft",function(){_.onGenerate&&_.onGenerate.call&&_.onGenerate.call(M,W.currentTime,M.data("input"))});var j=0;t.mousewheel&&t.mousewheel(function(e,n,a,r){return!_.scrollInput||(!_.datepicker&&_.timepicker?(j=H.find(".xdsoft_current").length?H.find(".xdsoft_current").eq(0).index():0,j+n>=0&&j+n<H.children().length&&(j+=n),H.children().eq(j).length&&H.children().eq(j).trigger("mousedown"),!1):_.datepicker&&!_.timepicker?(S.trigger(e,[n,a,r]),t.val&&t.val(W.str()),M.trigger("changedatetime.xdsoft"),!1):void 0)});var L=function(){var t=M.data("input").offset(),n=t.top+M.data("input")[0].offsetHeight-1,a=t.left;n+M[0].offsetHeight>e(window).height()+e(window).scrollTop()&&(n=t.top-M[0].offsetHeight+1),n<0&&(n=0),a+M[0].offsetWidth>e(window).width()&&(a=t.left-M[0].offsetWidth+M.data("input")[0].offsetWidth),M.css({left:a,top:n})};M.on("open.xdsoft",function(){var t=!0;_.onShow&&_.onShow.call&&(t=_.onShow.call(M,W.currentTime,M.data("input"))),t!==!1&&(M.show(),M.trigger("afterOpen.xdsoft"),L(),e(window).off("resize.xdsoft",L).on("resize.xdsoft",L),_.closeOnWithoutClick&&e([document.body,window]).on("mousedown.xdsoft",function n(){M.trigger("close.xdsoft"),e([document.body,window]).off("mousedown.xdsoft",n)}))}).on("close.xdsoft",function(e){var t=!0;_.onClose&&_.onClose.call&&(t=_.onClose.call(M,W.currentTime,M.data("input"))),t===!1||_.opened||_.inline||M.hide(),e.stopPropagation()}).data("input",t);var E=0;M.data("xdsoft_datetime",W),M.setOptions(_),W.setCurrentTime(n()),M.trigger("afterOpen.xdsoft"),t.data("xdsoft_datetimepicker",M).on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function(e){t.is(":disabled")||t.is(":hidden")||!t.is(":visible")||(clearTimeout(E),E=setTimeout(function(){t.is(":disabled")||t.is(":hidden")||!t.is(":visible")||(W.setCurrentTime(n()),M.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(t){var n=(this.value,t.which);switch(!0){case!!~[u].indexOf(n):var a=e("input:visible,textarea:visible");return M.trigger("close.xdsoft"),a.eq(a.index(this)+1).focus(),!1;case!!~[p].indexOf(n):return M.trigger("close.xdsoft"),!0}})},O=function(t){var n=t.data("xdsoft_datetimepicker");n&&(n.data("xdsoft_datetime",null),n.remove(),t.data("xdsoft_datetimepicker",null).off("open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft"),e(window).off("resize.xdsoft"),e([window,document.body]).off("mousedown.xdsoft"),t.unmousewheel&&t.unmousewheel())};return e(document).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(e){e.keyCode==i&&(b=!0)}).on("keyup.xdsoftctrl",function(e){e.keyCode==i&&(b=!1)}),this.each(function(){var t;if(t=e(this).data("xdsoft_datetimepicker")){if("string"===e.type(n))switch(n){case"show":e(this).select().focus(),t.trigger("open.xdsoft");break;case"hide":t.trigger("close.xdsoft");break;case"destroy":O(e(this));break;case"reset":this.value=this.defaultValue,this.value&&t.data("xdsoft_datetime").isValidDate(Date.parseDate(this.value,_.format))||t.data("changed",!1),t.data("xdsoft_datetime").setCurrentTime(this.value)}else t.setOptions(n);return 0}"string"!==e.type(n)&&(!_.lazyInit||_.open||_.inline?S(e(this)):k(e(this)))})}}(jQuery),Date.parseFunctions={count:0},Date.parseRegexes=[],Date.formatFunctions={count:0},Date.prototype.dateFormat=function(e){if("unixtime"==e)return parseInt(this.getTime()/1e3);null==Date.formatFunctions[e]&&Date.createNewFormat(e);var t=Date.formatFunctions[e];return this[t]()},Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;for(var code="Date.prototype."+funcName+" = function() {return ",special=!1,ch="",i=0;i<format.length;++i)ch=format.charAt(i),special||"\\"!=ch?special?(special=!1,code+="'"+String.escape(ch)+"' + "):code+=Date.getFormatCode(ch):special=!0;eval(code.substring(0,code.length-3)+";}")},Date.getFormatCode=function(e){switch(e){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(e)+"' + "}},Date.parseDate=function(e,t){if("unixtime"==t)return new Date(isNaN(parseInt(e))?0:1e3*parseInt(e));null==Date.parseFunctions[t]&&Date.createParser(t);var n=Date.parseFunctions[t];return Date[n](e)},Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++,regexNum=Date.parseRegexes.length,currentGroup=1;Date.parseFunctions[format]=funcName;for(var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {",regex="",special=!1,ch="",i=0;i<format.length;++i)ch=format.charAt(i),special||"\\"!=ch?special?(special=!1,regex+=String.escape(ch)):(obj=Date.formatCodeToRegex(ch,currentGroup),currentGroup+=obj.g,regex+=obj.s,obj.g&&obj.c&&(code+=obj.c)):special=!0;code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}",code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}",Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$"),eval(code)},Date.formatCodeToRegex=function(e,t){switch(e){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+t+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+t+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+t+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+t+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+t+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+t+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(e)}}},Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")},Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")},Date.prototype.getDayOfYear=function(){var e=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var t=0;t<this.getMonth();++t)e+=Date.daysInMonth[t];return e+this.getDate()},Date.prototype.getWeekOfYear=function(){var e=this.getDayOfYear()+(4-this.getDay()),t=new Date(this.getFullYear(),0,1),n=7-t.getDay()+4;return String.leftPad(Math.ceil((e-n)/7)+1,2,"0")},Date.prototype.isLeapYear=function(){var e=this.getFullYear();return 0==(3&e)&&(e%100||e%400==0&&e)},Date.prototype.getFirstDayOfMonth=function(){var e=(this.getDay()-(this.getDate()-1))%7;return e<0?e+7:e},Date.prototype.getLastDayOfMonth=function(){var e=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return e<0?e+7:e},Date.prototype.getDaysInMonth=function(){return Date.daysInMonth[1]=this.isLeapYear()?29:28,Date.daysInMonth[this.getMonth()]},Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}},String.escape=function(e){return e.replace(/('|\\)/g,"\\$1")},String.leftPad=function(e,t,n){var a=new String(e);for(null==n&&(n=" ");a.length<t;)a=n+a;return a},Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31],Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"],Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Date.y2kYear=50,Date.monthNumbers={Jan:0,Feb:1,Mar:2,
Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11},Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"},function(e){"function"==typeof define&&define.amd?define(["jquery.flot.min"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var r,o=t||window.event,s=[].slice.call(arguments,1),i=0,d=0,u=0,c=0,l=0;return t=e.event.fix(o),t.type="mousewheel",o.wheelDelta&&(i=o.wheelDelta),o.detail&&(i=o.detail*-1),o.deltaY&&(u=o.deltaY*-1,i=u),o.deltaX&&(d=o.deltaX,i=d*-1),void 0!==o.wheelDeltaY&&(u=o.wheelDeltaY),void 0!==o.wheelDeltaX&&(d=o.wheelDeltaX*-1),c=Math.abs(i),(!n||c<n)&&(n=c),l=Math.max(Math.abs(u),Math.abs(d)),(!a||l<a)&&(a=l),r=i>0?"floor":"ceil",i=Math[r](i/n),d=Math[r](d/a),u=Math[r](u/a),s.unshift(t,i,d,u),(e.event.dispatch||e.event.handle).apply(this,s)}var n,a,r=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],o="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];if(e.event.fixHooks)for(var s=r.length;s;)e.event.fixHooks[r[--s]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=o.length;e;)this.addEventListener(o[--e],t,!1);else this.onmousewheel=t},teardown:function(){if(this.removeEventListener)for(var e=o.length;e;)this.removeEventListener(o[--e],t,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})});
function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}var _slice=Array.prototype.slice,_slicedToArray=function(){function e(e,t){var i=[],n=!0,r=!1,s=void 0;try{for(var a,o=e[Symbol.iterator]();!(n=(a=o.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(l){r=!0,s=l}finally{try{!n&&o["return"]&&o["return"]()}finally{if(r)throw s}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e};!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):e.parsley=t(e.jQuery)}(this,function(e){"use strict";function t(e,t){return e.parsleyAdaptedCallback||(e.parsleyAdaptedCallback=function(){var i=Array.prototype.slice.call(arguments,0);i.unshift(this),e.apply(t||T,i)}),e.parsleyAdaptedCallback}function i(e){return 0===e.lastIndexOf(D,0)?e.substr(D.length):e}function n(){var t=this,i=window||global;_extends(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger("input")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on("change.inputevent",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off("input.inputevent",i.data.selector,t.behavesOk).off("change.inputevent",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched="0.0.3";for(var n=["select",'input[type="checkbox"]','input[type="radio"]','input[type="file"]'],r=0;r<n.length;r++){var s=n[r];e(document).on("input.inputevent",s,{selector:s},t.behavesOk).on("change.inputevent",s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(".inputevent")}})}var r=1,s={},a={attr:function(e,t,i){var n,r,s,a=new RegExp("^"+t,"i");if("undefined"==typeof i)i={};else for(n in i)i.hasOwnProperty(n)&&delete i[n];if(!e)return i;for(s=e.attributes,n=s.length;n--;)r=s[n],r&&r.specified&&a.test(r.name)&&(i[this.camelize(r.name.slice(t.length))]=this.deserializeValue(r.value));return i},checkAttr:function(e,t,i){return e.hasAttribute(t+i)},setAttr:function(e,t,i,n){e.setAttribute(this.dasherize(t+i),String(n))},generateID:function(){return""+r++},deserializeValue:function(t){var i;try{return t?"true"==t||"false"!=t&&("null"==t?null:isNaN(i=Number(t))?/^[\[\{]/.test(t)?e.parseJSON(t):t:i):t}catch(n){return t}},camelize:function(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():""})},dasherize:function(e){return e.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()},warn:function(){var e;window.console&&"function"==typeof window.console.warn&&(e=window.console).warn.apply(e,arguments)},warnOnce:function(e){s[e]||(s[e]=!0,this.warn.apply(this,arguments))},_resetWarnings:function(){s={}},trimString:function(e){return e.replace(/^\s+|\s+$/g,"")},parse:{date:function S(e){var t=e.match(/^(\d{4,})-(\d\d)-(\d\d)$/);if(!t)return null;var i=t.map(function(e){return parseInt(e,10)}),n=_slicedToArray(i,4),r=(n[0],n[1]),s=n[2],a=n[3],S=new Date(r,s-1,a);return S.getFullYear()!==r||S.getMonth()+1!==s||S.getDate()!==a?null:S},string:function(e){return e},integer:function(e){return isNaN(e)?null:parseInt(e,10)},number:function(e){if(isNaN(e))throw null;return parseFloat(e)},"boolean":function(e){return!/^\s*false\s*$/i.test(e)},object:function(e){return a.deserializeValue(e)},regexp:function(e){var t="";return/^\/.*\/(?:[gimy]*)$/.test(e)?(t=e.replace(/.*\/([gimy]*)$/,"$1"),e=e.replace(new RegExp("^/(.*?)/"+t+"$"),"$1")):e="^"+e+"$",new RegExp(e,t)}},parseRequirement:function(e,t){var i=this.parse[e||"string"];if(!i)throw'Unknown requirement specification: "'+e+'"';var n=i(t);if(null===n)throw"Requirement is not a "+e+': "'+t+'"';return n},namespaceEvents:function(t,i){return t=this.trimString(t||"").split(/\s+/),t[0]?e.map(t,function(e){return e+"."+i}).join(" "):""},difference:function(t,i){var n=[];return e.each(t,function(e,t){i.indexOf(t)==-1&&n.push(t)}),n},all:function(t){return e.when.apply(e,_toConsumableArray(t).concat([42,42]))},objectCreate:Object.create||function(){var e=function(){};return function(t){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof t)throw TypeError("Argument must be an object");e.prototype=t;var i=new e;return e.prototype=null,i}}(),_SubmitSelector:'input[type="submit"], button:submit'},o={namespace:"data-parsley-",inputs:"input, textarea, select",excluded:"input[type=button], input[type=submit], input[type=reset], input[type=hidden]",priorityEnabled:!0,multiple:null,group:null,uiEnabled:!0,validationThreshold:3,focus:"first",trigger:!1,triggerAfterFailure:"input",errorClass:"parsley-error",successClass:"parsley-success",classHandler:function(e){},errorsContainer:function(e){},errorsWrapper:'<ul class="parsley-errors-list"></ul>',errorTemplate:"<li></li>"},l=function(){this.__id__=a.generateID()};l.prototype={asyncSupport:!0,_pipeAccordingToValidationResult:function(){var t=this,i=function(){var i=e.Deferred();return!0!==t.validationResult&&i.reject(),i.resolve().promise()};return[i,i]},actualizeOptions:function(){return a.attr(this.element,this.options.namespace,this.domOptions),this.parent&&this.parent.actualizeOptions&&this.parent.actualizeOptions(),this},_resetOptions:function(e){this.domOptions=a.objectCreate(this.parent.options),this.options=a.objectCreate(this.domOptions);for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.actualizeOptions()},_listeners:null,on:function(e,t){this._listeners=this._listeners||{};var i=this._listeners[e]=this._listeners[e]||[];return i.push(t),this},subscribe:function(t,i){e.listenTo(this,t.toLowerCase(),i)},off:function(e,t){var i=this._listeners&&this._listeners[e];if(i)if(t)for(var n=i.length;n--;)i[n]===t&&i.splice(n,1);else delete this._listeners[e];return this},unsubscribe:function(t,i){e.unsubscribeTo(this,t.toLowerCase())},trigger:function(e,t,i){t=t||this;var n,r=this._listeners&&this._listeners[e];if(r)for(var s=r.length;s--;)if(n=r[s].call(t,t,i),n===!1)return n;return!this.parent||this.parent.trigger(e,t,i)},asyncIsValid:function(e,t){return a.warnOnce("asyncIsValid is deprecated; please use whenValid instead"),this.whenValid({group:e,force:t})},_findRelated:function(){return this.options.multiple?e(this.parent.element.querySelectorAll("["+this.options.namespace+'multiple="'+this.options.multiple+'"]')):this.$element}};var u=function(e,t){var i=e.match(/^\s*\[(.*)\]\s*$/);if(!i)throw'Requirement is not an array: "'+e+'"';var n=i[1].split(",").map(a.trimString);if(n.length!==t)throw"Requirement has "+n.length+" values when "+t+" are needed";return n},d=function(e,t,i){var n=null,r={};for(var s in e)if(s){var o=i(s);"string"==typeof o&&(o=a.parseRequirement(e[s],o)),r[s]=o}else n=a.parseRequirement(e[s],t);return[n,r]},h=function(t){e.extend(!0,this,t)};h.prototype={validate:function(e,t){if(this.fn)return arguments.length>3&&(t=[].slice.call(arguments,1,-1)),this.fn(e,t);if(Array.isArray(e)){if(!this.validateMultiple)throw"Validator `"+this.name+"` does not handle multiple values";return this.validateMultiple.apply(this,arguments)}var i=arguments[arguments.length-1];if(this.validateDate&&i._isDateInput())return arguments[0]=a.parse.date(arguments[0]),null!==arguments[0]&&this.validateDate.apply(this,arguments);if(this.validateNumber)return!isNaN(e)&&(arguments[0]=parseFloat(arguments[0]),this.validateNumber.apply(this,arguments));if(this.validateString)return this.validateString.apply(this,arguments);throw"Validator `"+this.name+"` only handles multiple values"},parseRequirements:function(t,i){if("string"!=typeof t)return Array.isArray(t)?t:[t];var n=this.requirementType;if(Array.isArray(n)){for(var r=u(t,n.length),s=0;s<r.length;s++)r[s]=a.parseRequirement(n[s],r[s]);return r}return e.isPlainObject(n)?d(n,t,i):[a.parseRequirement(n,t)]},requirementType:"string",priority:2};var p=function(e,t){this.__class__="ValidatorRegistry",this.locale="en",this.init(e||{},t||{})},c={email:/^((([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,number:/^-?(\d*\.)?\d+(e[-+]?\d+)?$/i,integer:/^-?\d+$/,digits:/^\d+$/,alphanum:/^\w+$/i,date:{test:function(e){return null!==a.parse.date(e)}},url:new RegExp("^(?:(?:https?|ftp)://)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:/\\S*)?$","i")};c.range=c.number;var f=function(e){var t=(""+e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0},m=function(e,t){return t.map(a.parse[e])},g=function(e,t){return function(i){for(var n=arguments.length,r=Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.pop(),t.apply(void 0,[i].concat(_toConsumableArray(m(e,r))))}},v=function(e){return{validateDate:g("date",e),validateNumber:g("number",e),requirementType:e.length<=2?"string":["string","string"],priority:30}};p.prototype={init:function(e,t){this.catalog=t,this.validators=_extends({},this.validators);for(var i in e)this.addValidator(i,e[i].fn,e[i].priority);window.Parsley.trigger("parsley:validator:init")},setLocale:function(e){if("undefined"==typeof this.catalog[e])throw new Error(e+" is not available in the catalog");return this.locale=e,this},addCatalog:function(e,t,i){return"object"==typeof t&&(this.catalog[e]=t),!0===i?this.setLocale(e):this},addMessage:function(e,t,i){return"undefined"==typeof this.catalog[e]&&(this.catalog[e]={}),this.catalog[e][t]=i,this},addMessages:function(e,t){for(var i in t)this.addMessage(e,i,t[i]);return this},addValidator:function(e,t,i){if(this.validators[e])a.warn('Validator "'+e+'" is already defined.');else if(o.hasOwnProperty(e))return void a.warn('"'+e+'" is a restricted keyword and is not a valid validator name.');return this._setValidator.apply(this,arguments)},updateValidator:function(e,t,i){return this.validators[e]?this._setValidator.apply(this,arguments):(a.warn('Validator "'+e+'" is not already defined.'),this.addValidator.apply(this,arguments))},removeValidator:function(e){return this.validators[e]||a.warn('Validator "'+e+'" is not defined.'),delete this.validators[e],this},_setValidator:function(e,t,i){"object"!=typeof t&&(t={fn:t,priority:i}),t.validate||(t=new h(t)),this.validators[e]=t;for(var n in t.messages||{})this.addMessage(n,e,t.messages[n]);return this},getErrorMessage:function(e){var t;if("type"===e.name){var i=this.catalog[this.locale][e.name]||{};t=i[e.requirements]}else t=this.formatMessage(this.catalog[this.locale][e.name],e.requirements);return t||this.catalog[this.locale].defaultMessage||this.catalog.en.defaultMessage},formatMessage:function(e,t){if("object"==typeof t){for(var i in t)e=this.formatMessage(e,t[i]);return e}return"string"==typeof e?e.replace(/%s/i,t):""},validators:{notblank:{validateString:function(e){return/\S/.test(e)},priority:2},required:{validateMultiple:function(e){return e.length>0},validateString:function(e){return/\S/.test(e)},priority:512},type:{validateString:function(e,t){var i=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=i.step,r=void 0===n?"any":n,s=i.base,a=void 0===s?0:s,o=c[t];if(!o)throw new Error("validator type `"+t+"` is not supported");if(!o.test(e))return!1;if("number"===t&&!/^any$/i.test(r||"")){var l=Number(e),u=Math.max(f(r),f(a));if(f(l)>u)return!1;var d=function(e){return Math.round(e*Math.pow(10,u))};if((d(l)-d(a))%d(r)!=0)return!1}return!0},requirementType:{"":"string",step:"string",base:"number"},priority:256},pattern:{validateString:function(e,t){return t.test(e)},requirementType:"regexp",priority:64},minlength:{validateString:function(e,t){return e.length>=t},requirementType:"integer",priority:30},maxlength:{validateString:function(e,t){return e.length<=t},requirementType:"integer",priority:30},length:{validateString:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:["integer","integer"],priority:30},mincheck:{validateMultiple:function(e,t){return e.length>=t},requirementType:"integer",priority:30},maxcheck:{validateMultiple:function(e,t){return e.length<=t},requirementType:"integer",priority:30},check:{validateMultiple:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:["integer","integer"],priority:30},min:v(function(e,t){return e>=t}),max:v(function(e,t){return e<=t}),range:v(function(e,t,i){return e>=t&&e<=i}),equalto:{validateString:function(t,i){var n=e(i);return n.length?t===n.val():t===i},priority:256}}};var y={},_=function k(e,t,i){for(var n=[],r=[],s=0;s<e.length;s++){for(var a=!1,o=0;o<t.length;o++)if(e[s].assert.name===t[o].assert.name){a=!0;break}a?r.push(e[s]):n.push(e[s])}return{kept:r,added:n,removed:i?[]:k(t,e,!0).added}};y.Form={_actualizeTriggers:function(){var e=this;this.$element.on("submit.Parsley",function(t){e.onSubmitValidate(t)}),this.$element.on("click.Parsley",a._SubmitSelector,function(t){e.onSubmitButton(t)}),!1!==this.options.uiEnabled&&this.element.setAttribute("novalidate","")},focus:function(){if(this._focusedField=null,!0===this.validationResult||"none"===this.options.focus)return null;for(var e=0;e<this.fields.length;e++){var t=this.fields[e];if(!0!==t.validationResult&&t.validationResult.length>0&&"undefined"==typeof t.options.noFocus&&(this._focusedField=t.$element,"first"===this.options.focus))break}return null===this._focusedField?null:this._focusedField.focus()},_destroyUI:function(){this.$element.off(".Parsley")}},y.Field={_reflowUI:function(){if(this._buildUI(),this._ui){var e=_(this.validationResult,this._ui.lastValidationResult);this._ui.lastValidationResult=this.validationResult,this._manageStatusClass(),this._manageErrorsMessages(e),this._actualizeTriggers(),!e.kept.length&&!e.added.length||this._failedOnce||(this._failedOnce=!0,this._actualizeTriggers())}},getErrorsMessages:function(){if(!0===this.validationResult)return[];for(var e=[],t=0;t<this.validationResult.length;t++)e.push(this.validationResult[t].errorMessage||this._getErrorMessage(this.validationResult[t].assert));return e},addError:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t.message,n=t.assert,r=t.updateClass,s=void 0===r||r;this._buildUI(),this._addError(e,{message:i,assert:n}),s&&this._errorClass()},updateError:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t.message,n=t.assert,r=t.updateClass,s=void 0===r||r;this._buildUI(),this._updateError(e,{message:i,assert:n}),s&&this._errorClass()},removeError:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t.updateClass,n=void 0===i||i;this._buildUI(),this._removeError(e),n&&this._manageStatusClass()},_manageStatusClass:function(){this.hasConstraints()&&this.needsValidation()&&!0===this.validationResult?this._successClass():this.validationResult.length>0?this._errorClass():this._resetClass()},_manageErrorsMessages:function(t){if("undefined"==typeof this.options.errorsMessagesDisabled){if("undefined"!=typeof this.options.errorMessage)return t.added.length||t.kept.length?(this._insertErrorWrapper(),0===this._ui.$errorsWrapper.find(".parsley-custom-error-message").length&&this._ui.$errorsWrapper.append(e(this.options.errorTemplate).addClass("parsley-custom-error-message")),this._ui.$errorsWrapper.addClass("filled").find(".parsley-custom-error-message").html(this.options.errorMessage)):this._ui.$errorsWrapper.removeClass("filled").find(".parsley-custom-error-message").remove();for(var i=0;i<t.removed.length;i++)this._removeError(t.removed[i].assert.name);for(i=0;i<t.added.length;i++)this._addError(t.added[i].assert.name,{message:t.added[i].errorMessage,assert:t.added[i].assert});for(i=0;i<t.kept.length;i++)this._updateError(t.kept[i].assert.name,{message:t.kept[i].errorMessage,assert:t.kept[i].assert})}},_addError:function(t,i){var n=i.message,r=i.assert;this._insertErrorWrapper(),this._ui.$errorsWrapper.addClass("filled").append(e(this.options.errorTemplate).addClass("parsley-"+t).html(n||this._getErrorMessage(r)))},_updateError:function(e,t){var i=t.message,n=t.assert;this._ui.$errorsWrapper.addClass("filled").find(".parsley-"+e).html(i||this._getErrorMessage(n))},_removeError:function(e){this._ui.$errorsWrapper.removeClass("filled").find(".parsley-"+e).remove()},_getErrorMessage:function(e){var t=e.name+"Message";return"undefined"!=typeof this.options[t]?window.Parsley.formatMessage(this.options[t],e.requirements):window.Parsley.getErrorMessage(e)},_buildUI:function(){if(!this._ui&&!1!==this.options.uiEnabled){var t={};this.element.setAttribute(this.options.namespace+"id",this.__id__),t.$errorClassHandler=this._manageClassHandler(),t.errorsWrapperId="parsley-id-"+(this.options.multiple?"multiple-"+this.options.multiple:this.__id__),t.$errorsWrapper=e(this.options.errorsWrapper).attr("id",t.errorsWrapperId),t.lastValidationResult=[],t.validationInformationVisible=!1,this._ui=t}},_manageClassHandler:function(){if("string"==typeof this.options.classHandler)return 0===e(this.options.classHandler).length&&ParsleyUtils.warn("No elements found that match the selector `"+this.options.classHandler+"` set in options.classHandler or data-parsley-class-handler"),e(this.options.classHandler);if("function"==typeof this.options.classHandler)var t=this.options.classHandler.call(this,this);return"undefined"!=typeof t&&t.length?t:this._inputHolder()},_inputHolder:function(){return this.options.multiple&&"SELECT"!==this.element.nodeName?this.$element.parent():this.$element},_insertErrorWrapper:function(){var t;if(0!==this._ui.$errorsWrapper.parent().length)return this._ui.$errorsWrapper.parent();if("string"==typeof this.options.errorsContainer){if(e(this.options.errorsContainer).length)return e(this.options.errorsContainer).append(this._ui.$errorsWrapper);a.warn("The errors container `"+this.options.errorsContainer+"` does not exist in DOM")}else"function"==typeof this.options.errorsContainer&&(t=this.options.errorsContainer.call(this,this));return"undefined"!=typeof t&&t.length?t.append(this._ui.$errorsWrapper):this._inputHolder().after(this._ui.$errorsWrapper)},_actualizeTriggers:function(){var e,t=this,i=this._findRelated();i.off(".Parsley"),this._failedOnce?i.on(a.namespaceEvents(this.options.triggerAfterFailure,"Parsley"),function(){t._validateIfNeeded()}):(e=a.namespaceEvents(this.options.trigger,"Parsley"))&&i.on(e,function(e){t._validateIfNeeded(e)})},_validateIfNeeded:function(e){var t=this;e&&/key|input/.test(e.type)&&(!this._ui||!this._ui.validationInformationVisible)&&this.getValue().length<=this.options.validationThreshold||(this.options.debounce?(window.clearTimeout(this._debounced),this._debounced=window.setTimeout(function(){return t.validate()},this.options.debounce)):this.validate())},_resetUI:function(){this._failedOnce=!1,this._actualizeTriggers(),"undefined"!=typeof this._ui&&(this._ui.$errorsWrapper.removeClass("filled").children().remove(),this._resetClass(),this._ui.lastValidationResult=[],this._ui.validationInformationVisible=!1)},_destroyUI:function(){this._resetUI(),"undefined"!=typeof this._ui&&this._ui.$errorsWrapper.remove(),delete this._ui},_successClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass)},_errorClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass)},_resetClass:function(){this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass)}};var w=function(t,i,n){this.__class__="Form",this.element=t,this.$element=e(t),this.domOptions=i,this.options=n,this.parent=window.Parsley,this.fields=[],this.validationResult=null},b={pending:null,resolved:!0,rejected:!1};w.prototype={onSubmitValidate:function(e){var t=this;if(!0!==e.parsley){var i=this._submitSource||this.$element.find(a._SubmitSelector)[0];if(this._submitSource=null,this.$element.find(".parsley-synthetic-submit-button").prop("disabled",!0),!i||null===i.getAttribute("formnovalidate")){window.Parsley._remoteCache={};var n=this.whenValidate({event:e});"resolved"===n.state()&&!1!==this._trigger("submit")||(e.stopImmediatePropagation(),e.preventDefault(),"pending"===n.state()&&n.done(function(){t._submit(i)}))}}},onSubmitButton:function(e){this._submitSource=e.currentTarget},_submit:function(t){if(!1!==this._trigger("submit")){if(t){var i=this.$element.find(".parsley-synthetic-submit-button").prop("disabled",!1);0===i.length&&(i=e('<input class="parsley-synthetic-submit-button" type="hidden">').appendTo(this.$element)),i.attr({name:t.getAttribute("name"),value:t.getAttribute("value")})}this.$element.trigger(_extends(e.Event("submit"),{parsley:!0}))}},validate:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){a.warnOnce("Calling validate on a parsley form without passing arguments as an object is deprecated.");var i=_slice.call(arguments),n=i[0],r=i[1],s=i[2];t={group:n,force:r,event:s}}return b[this.whenValidate(t).state()]},whenValidate:function(){var t,i=this,n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=n.group,s=n.force,o=n.event;this.submitEvent=o,o&&(this.submitEvent=_extends({},o,{preventDefault:function(){a.warnOnce("Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`"),i.validationResult=!1}})),this.validationResult=!0,this._trigger("validate"),this._refreshFields();var l=this._withoutReactualizingFormOptions(function(){return e.map(i.fields,function(e){return e.whenValidate({force:s,group:r})})});return(t=a.all(l).done(function(){i._trigger("success")}).fail(function(){i.validationResult=!1,i.focus(),i._trigger("error")}).always(function(){i._trigger("validated")})).pipe.apply(t,_toConsumableArray(this._pipeAccordingToValidationResult()))},isValid:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){a.warnOnce("Calling isValid on a parsley form without passing arguments as an object is deprecated.");var i=_slice.call(arguments),n=i[0],r=i[1];t={group:n,force:r}}return b[this.whenValid(t).state()]},whenValid:function(){var t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.group,r=i.force;this._refreshFields();var s=this._withoutReactualizingFormOptions(function(){return e.map(t.fields,function(e){return e.whenValid({group:n,force:r})})});return a.all(s)},reset:function(){for(var e=0;e<this.fields.length;e++)this.fields[e].reset();this._trigger("reset")},destroy:function(){this._destroyUI();for(var e=0;e<this.fields.length;e++)this.fields[e].destroy();this.$element.removeData("Parsley"),this._trigger("destroy")},_refreshFields:function(){return this.actualizeOptions()._bindFields()},_bindFields:function(){var t=this,i=this.fields;return this.fields=[],this.fieldsMappedById={},this._withoutReactualizingFormOptions(function(){t.$element.find(t.options.inputs).not(t.options.excluded).each(function(e,i){var n=new window.Parsley.Factory(i,{},t);if(("Field"===n.__class__||"FieldMultiple"===n.__class__)&&!0!==n.options.excluded){var r=n.__class__+"-"+n.__id__;"undefined"==typeof t.fieldsMappedById[r]&&(t.fieldsMappedById[r]=n,t.fields.push(n))}}),e.each(a.difference(i,t.fields),function(e,t){t.reset()})}),this},_withoutReactualizingFormOptions:function(e){var t=this.actualizeOptions;this.actualizeOptions=function(){return this};var i=e();return this.actualizeOptions=t,i},_trigger:function(e){return this.trigger("form:"+e)}};var F=function(e,t,i,n,r){var s=window.Parsley._validatorRegistry.validators[t],a=new h(s);n=n||e.options[t+"Priority"]||a.priority,r=!0===r,_extends(this,{validator:a,name:t,requirements:i,priority:n,isDomConstraint:r}),this._parseRequirements(e.options)},C=function(e){var t=e[0].toUpperCase();return t+e.slice(1)};F.prototype={validate:function(e,t){var i;return(i=this.validator).validate.apply(i,[e].concat(_toConsumableArray(this.requirementList),[t]))},_parseRequirements:function(e){var t=this;this.requirementList=this.validator.parseRequirements(this.requirements,function(i){return e[t.name+C(i)]})}};var E=function(t,i,n,r){this.__class__="Field",this.element=t,this.$element=e(t),"undefined"!=typeof r&&(this.parent=r),this.options=n,this.domOptions=i,this.constraints=[],this.constraintsByName={},this.validationResult=!0,this._bindConstraints()},A={pending:null,resolved:!0,rejected:!1};E.prototype={validate:function(t){arguments.length>=1&&!e.isPlainObject(t)&&(a.warnOnce("Calling validate on a parsley field without passing arguments as an object is deprecated."),t={options:t});var i=this.whenValidate(t);if(!i)return!0;switch(i.state()){case"pending":return null;case"resolved":return!0;case"rejected":return this.validationResult}},whenValidate:function(){var e,t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.force,r=i.group;if(this.refreshConstraints(),!r||this._isInGroup(r))return this.value=this.getValue(),this._trigger("validate"),(e=this.whenValid({force:n,value:this.value,_refreshed:!0}).always(function(){t._reflowUI()}).done(function(){t._trigger("success")}).fail(function(){t._trigger("error")}).always(function(){t._trigger("validated")})).pipe.apply(e,_toConsumableArray(this._pipeAccordingToValidationResult()))},hasConstraints:function(){return 0!==this.constraints.length},needsValidation:function(e){return"undefined"==typeof e&&(e=this.getValue()),!(!e.length&&!this._isRequired()&&"undefined"==typeof this.options.validateIfEmpty)},_isInGroup:function(t){return Array.isArray(this.options.group)?-1!==e.inArray(t,this.options.group):this.options.group===t},isValid:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){a.warnOnce("Calling isValid on a parsley field without passing arguments as an object is deprecated.");var i=_slice.call(arguments),n=i[0],r=i[1];t={force:n,value:r}}var s=this.whenValid(t);return!s||A[s.state()]},whenValid:function(){var t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.force,r=void 0!==n&&n,s=i.value,o=i.group,l=i._refreshed;if(l||this.refreshConstraints(),!o||this._isInGroup(o)){if(this.validationResult=!0,!this.hasConstraints())return e.when();if("undefined"!=typeof s&&null!==s||(s=this.getValue()),!this.needsValidation(s)&&!0!==r)return e.when();var u=this._getGroupedConstraints(),d=[];return e.each(u,function(i,n){var r=a.all(e.map(n,function(e){return t._validateConstraint(s,e)}));if(d.push(r),"rejected"===r.state())return!1}),a.all(d)}},_validateConstraint:function(t,i){var n=this,r=i.validate(t,this);return!1===r&&(r=e.Deferred().reject()),a.all([r]).fail(function(e){n.validationResult instanceof Array||(n.validationResult=[]),n.validationResult.push({assert:i,errorMessage:"string"==typeof e&&e})})},getValue:function(){var e;return e="function"==typeof this.options.value?this.options.value(this):"undefined"!=typeof this.options.value?this.options.value:this.$element.val(),"undefined"==typeof e||null===e?"":this._handleWhitespace(e)},reset:function(){return this._resetUI(),this._trigger("reset")},destroy:function(){this._destroyUI(),this.$element.removeData("Parsley"),this.$element.removeData("FieldMultiple"),this._trigger("destroy")},refreshConstraints:function(){return this.actualizeOptions()._bindConstraints()},addConstraint:function(e,t,i,n){if(window.Parsley._validatorRegistry.validators[e]){var r=new F(this,e,t,i,n);"undefined"!==this.constraintsByName[r.name]&&this.removeConstraint(r.name),this.constraints.push(r),this.constraintsByName[r.name]=r}return this},removeConstraint:function(e){for(var t=0;t<this.constraints.length;t++)if(e===this.constraints[t].name){this.constraints.splice(t,1);break}return delete this.constraintsByName[e],this},updateConstraint:function(e,t,i){return this.removeConstraint(e).addConstraint(e,t,i)},_bindConstraints:function(){for(var e=[],t={},i=0;i<this.constraints.length;i++)!1===this.constraints[i].isDomConstraint&&(e.push(this.constraints[i]),t[this.constraints[i].name]=this.constraints[i]);this.constraints=e,this.constraintsByName=t;for(var n in this.options)this.addConstraint(n,this.options[n],void 0,!0);return this._bindHtml5Constraints()},_bindHtml5Constraints:function(){null!==this.element.getAttribute("required")&&this.addConstraint("required",!0,void 0,!0),null!==this.element.getAttribute("pattern")&&this.addConstraint("pattern",this.element.getAttribute("pattern"),void 0,!0);var e=this.element.getAttribute("min"),t=this.element.getAttribute("max");null!==e&&null!==t?this.addConstraint("range",[e,t],void 0,!0):null!==e?this.addConstraint("min",e,void 0,!0):null!==t&&this.addConstraint("max",t,void 0,!0),null!==this.element.getAttribute("minlength")&&null!==this.element.getAttribute("maxlength")?this.addConstraint("length",[this.element.getAttribute("minlength"),this.element.getAttribute("maxlength")],void 0,!0):null!==this.element.getAttribute("minlength")?this.addConstraint("minlength",this.element.getAttribute("minlength"),void 0,!0):null!==this.element.getAttribute("maxlength")&&this.addConstraint("maxlength",this.element.getAttribute("maxlength"),void 0,!0);var i=this.element.type;return"number"===i?this.addConstraint("type",["number",{step:this.element.getAttribute("step")||"1",base:e||this.element.getAttribute("value")}],void 0,!0):/^(email|url|range|date)$/i.test(i)?this.addConstraint("type",i,void 0,!0):this},_isRequired:function(){return"undefined"!=typeof this.constraintsByName.required&&!1!==this.constraintsByName.required.requirements},_trigger:function(e){return this.trigger("field:"+e)},_handleWhitespace:function(e){return!0===this.options.trimValue&&a.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"'),"squish"===this.options.whitespace&&(e=e.replace(/\s{2,}/g," ")),"trim"!==this.options.whitespace&&"squish"!==this.options.whitespace&&!0!==this.options.trimValue||(e=a.trimString(e)),e},_isDateInput:function(){var e=this.constraintsByName.type;return e&&"date"===e.requirements},_getGroupedConstraints:function(){if(!1===this.options.priorityEnabled)return[this.constraints];for(var e=[],t={},i=0;i<this.constraints.length;i++){var n=this.constraints[i].priority;t[n]||e.push(t[n]=[]),t[n].push(this.constraints[i])}return e.sort(function(e,t){return t[0].priority-e[0].priority}),e}};var x=E,$=function(){this.__class__="FieldMultiple"};$.prototype={addElement:function(e){return this.$elements.push(e),this},refreshConstraints:function(){var t;if(this.constraints=[],"SELECT"===this.element.nodeName)return this.actualizeOptions()._bindConstraints(),
this;for(var i=0;i<this.$elements.length;i++)if(e("html").has(this.$elements[i]).length){t=this.$elements[i].data("FieldMultiple").refreshConstraints().constraints;for(var n=0;n<t.length;n++)this.addConstraint(t[n].name,t[n].requirements,t[n].priority,t[n].isDomConstraint)}else this.$elements.splice(i,1);return this},getValue:function(){if("function"==typeof this.options.value)return this.options.value(this);if("undefined"!=typeof this.options.value)return this.options.value;if("INPUT"===this.element.nodeName){if("radio"===this.element.type)return this._findRelated().filter(":checked").val()||"";if("checkbox"===this.element.type){var t=[];return this._findRelated().filter(":checked").each(function(){t.push(e(this).val())}),t}}return"SELECT"===this.element.nodeName&&null===this.$element.val()?[]:this.$element.val()},_init:function(){return this.$elements=[this.$element],this}};var P=function(t,i,n){this.element=t,this.$element=e(t);var r=this.$element.data("Parsley");if(r)return"undefined"!=typeof n&&r.parent===window.Parsley&&(r.parent=n,r._resetOptions(r.options)),"object"==typeof i&&_extends(r.options,i),r;if(!this.$element.length)throw new Error("You must bind Parsley on an existing element.");if("undefined"!=typeof n&&"Form"!==n.__class__)throw new Error("Parent instance must be a Form instance");return this.parent=n||window.Parsley,this.init(i)};P.prototype={init:function(e){return this.__class__="Parsley",this.__version__="2.7.2",this.__id__=a.generateID(),this._resetOptions(e),"FORM"===this.element.nodeName||a.checkAttr(this.element,this.options.namespace,"validate")&&!this.$element.is(this.options.inputs)?this.bind("parsleyForm"):this.isMultiple()?this.handleMultiple():this.bind("parsleyField")},isMultiple:function(){return"radio"===this.element.type||"checkbox"===this.element.type||"SELECT"===this.element.nodeName&&null!==this.element.getAttribute("multiple")},handleMultiple:function(){var t,i,n=this;if(this.options.multiple=this.options.multiple||(t=this.element.getAttribute("name"))||this.element.getAttribute("id"),"SELECT"===this.element.nodeName&&null!==this.element.getAttribute("multiple"))return this.options.multiple=this.options.multiple||this.__id__,this.bind("parsleyFieldMultiple");if(!this.options.multiple)return a.warn("To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.",this.$element),this;this.options.multiple=this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g,""),t&&e('input[name="'+t+'"]').each(function(e,t){"radio"!==t.type&&"checkbox"!==t.type||t.setAttribute(n.options.namespace+"multiple",n.options.multiple)});for(var r=this._findRelated(),s=0;s<r.length;s++)if(i=e(r.get(s)).data("Parsley"),"undefined"!=typeof i){this.$element.data("FieldMultiple")||i.addElement(this.$element);break}return this.bind("parsleyField",!0),i||this.bind("parsleyFieldMultiple")},bind:function(t,i){var n;switch(t){case"parsleyForm":n=e.extend(new w(this.element,this.domOptions,this.options),new l,window.ParsleyExtend)._bindFields();break;case"parsleyField":n=e.extend(new x(this.element,this.domOptions,this.options,this.parent),new l,window.ParsleyExtend);break;case"parsleyFieldMultiple":n=e.extend(new x(this.element,this.domOptions,this.options,this.parent),new $,new l,window.ParsleyExtend)._init();break;default:throw new Error(t+"is not a supported Parsley type")}return this.options.multiple&&a.setAttr(this.element,this.options.namespace,"multiple",this.options.multiple),"undefined"!=typeof i?(this.$element.data("FieldMultiple",n),n):(this.$element.data("Parsley",n),n._actualizeTriggers(),n._trigger("init"),n)}};var V=e.fn.jquery.split(".");if(parseInt(V[0])<=1&&parseInt(V[1])<8)throw"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.";V.forEach||a.warn("Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim");var O=_extends(new l,{element:document,$element:e(document),actualizeOptions:null,_resetOptions:null,Factory:P,version:"2.7.2"});_extends(x.prototype,y.Field,l.prototype),_extends(w.prototype,y.Form,l.prototype),_extends(P.prototype,l.prototype),e.fn.parsley=e.fn.psly=function(t){if(this.length>1){var i=[];return this.each(function(){i.push(e(this).parsley(t))}),i}return e(this).length?new P(this[0],t):void a.warn("You must bind Parsley on an existing element.")},"undefined"==typeof window.ParsleyExtend&&(window.ParsleyExtend={}),O.options=_extends(a.objectCreate(o),window.ParsleyConfig),window.ParsleyConfig=O.options,window.Parsley=window.psly=O,O.Utils=a,window.ParsleyUtils={},e.each(a,function(e,t){"function"==typeof t&&(window.ParsleyUtils[e]=function(){return a.warnOnce("Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead."),a[e].apply(a,arguments)})});var M=window.Parsley._validatorRegistry=new p(window.ParsleyConfig.validators,window.ParsleyConfig.i18n);window.ParsleyValidator={},e.each("setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator".split(" "),function(e,t){window.Parsley[t]=function(){return M[t].apply(M,arguments)},window.ParsleyValidator[t]=function(){var e;return a.warnOnce("Accessing the method '"+t+"' through Validator is deprecated. Simply call 'window.Parsley."+t+"(...)'"),(e=window.Parsley)[t].apply(e,arguments)}}),window.Parsley.UI=y,window.ParsleyUI={removeError:function(e,t,i){var n=!0!==i;return a.warnOnce("Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method."),e.removeError(t,{updateClass:n})},getErrorsMessages:function(e){return a.warnOnce("Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly."),e.getErrorsMessages()}},e.each("addError updateError".split(" "),function(e,t){window.ParsleyUI[t]=function(e,i,n,r,s){var o=!0!==s;return a.warnOnce("Accessing UI is deprecated. Call '"+t+"' on the instance directly. Please comment in issue 1073 as to your need to call this method."),e[t](i,{message:n,assert:r,updateClass:o})}}),!1!==window.ParsleyConfig.autoBind&&e(function(){e("[data-parsley-validate]").length&&e("[data-parsley-validate]").parsley()});var T=e({}),R=function(){a.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley")},D="parsley:";e.listen=function(e,n){var r;if(R(),"object"==typeof arguments[1]&&"function"==typeof arguments[2]&&(r=arguments[1],n=arguments[2]),"function"!=typeof n)throw new Error("Wrong parameters");window.Parsley.on(i(e),t(n,r))},e.listenTo=function(e,n,r){if(R(),!(e instanceof x||e instanceof w))throw new Error("Must give Parsley instance");if("string"!=typeof n||"function"!=typeof r)throw new Error("Wrong parameters");e.on(i(n),t(r))},e.unsubscribe=function(e,t){if(R(),"string"!=typeof e||"function"!=typeof t)throw new Error("Wrong arguments");window.Parsley.off(i(e),t.parsleyAdaptedCallback)},e.unsubscribeTo=function(e,t){if(R(),!(e instanceof x||e instanceof w))throw new Error("Must give Parsley instance");e.off(i(t))},e.unsubscribeAll=function(t){R(),window.Parsley.off(i(t)),e("form,input,textarea,select").each(function(){var n=e(this).data("Parsley");n&&n.off(i(t))})},e.emit=function(e,t){var n;R();var r=t instanceof x||t instanceof w,s=Array.prototype.slice.call(arguments,r?2:1);s.unshift(i(e)),r||(t=window.Parsley),(n=t).trigger.apply(n,_toConsumableArray(s))};e.extend(!0,O,{asyncValidators:{"default":{fn:function(e){return e.status>=200&&e.status<300},url:!1},reverse:{fn:function(e){return e.status<200||e.status>=300},url:!1}},addAsyncValidator:function(e,t,i,n){return O.asyncValidators[e]={fn:t,url:i||!1,options:n||{}},this}}),O.addValidator("remote",{requirementType:{"":"string",validator:"string",reverse:"boolean",options:"object"},validateString:function(t,i,n,r){var s,a,o={},l=n.validator||(!0===n.reverse?"reverse":"default");if("undefined"==typeof O.asyncValidators[l])throw new Error("Calling an undefined async validator: `"+l+"`");i=O.asyncValidators[l].url||i,i.indexOf("{value}")>-1?i=i.replace("{value}",encodeURIComponent(t)):o[r.element.getAttribute("name")||r.element.getAttribute("id")]=t;var u=e.extend(!0,n.options||{},O.asyncValidators[l].options);s=e.extend(!0,{},{url:i,data:o,type:"GET"},u),r.trigger("field:ajaxoptions",r,s),a=e.param(s),"undefined"==typeof O._remoteCache&&(O._remoteCache={});var d=O._remoteCache[a]=O._remoteCache[a]||e.ajax(s),h=function(){var t=O.asyncValidators[l].fn.call(r,d,i,n);return t||(t=e.Deferred().reject()),e.when(t)};return d.then(h,h)},priority:-1}),O.on("form:submit",function(){O._remoteCache={}}),l.prototype.addAsyncValidator=function(){return a.warnOnce("Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`"),O.addAsyncValidator.apply(O,arguments)},O.addMessages("en",{defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",number:"This value should be a valid number.",integer:"This value should be a valid integer.",digits:"This value should be digits.",alphanum:"This value should be alphanumeric."},notblank:"This value should not be blank.",required:"This value is required.",pattern:"This value seems to be invalid.",min:"This value should be greater than or equal to %s.",max:"This value should be lower than or equal to %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or fewer.",length:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or fewer.",check:"You must select between %s and %s choices.",equalto:"This value should be the same."}),O.setLocale("en");var I=new n;I.install();var q=O;return q});
jQuery(document).ready(function(e){function a(e,a){l(e,a),e.find(a.container).first().show()}function n(a,n){if(n.tabs){var t=e("<div />",{"class":n.tabMenuClassName}).insertBefore(a.children(n.container).filter(":first"));a.children(n.container).each(function(i,r){var l=e("<button/>").html(e(this).children(n.header).html()).addClass(0==i?n.tabMenuItemActiveClassName:"").addClass("item"+i).addClass("btn btn-default").prop("type","button").on("click keypress",{container:a.children(n.container),fieldset:e(r)},function(){var t=e(this),i=t.parent().children().index(t);s(a,n,t,i)});n.tabIndex&&l.prop("tabindex",i),t.append(l)})}}function t(a,n){n.navigation&&a.children(n.container).each(function(t){var i=e("<div />").addClass("powermail_fieldwrap").addClass("powermail_tab_navigation").appendTo(e(this));t>0&&i.append(c(a,n)),t<a.children(n.container).length-1&&i.append(o(a,n))})}function i(a,n){e.fn.parsley&&"data-parsley-validate"===a.data("parsley-validate")&&a.parsley().subscribe("parsley:field:validated",function(){v(a,n),C(a,n)})}function r(a,n){n.openTabOnError&&e.fn.parsley&&e.listen("parsley:field:error",function(){setTimeout(function(){a.find("."+n.tabMenuClassName+" > ."+n.tabMenuItemErrorClassName+":first").click()},50)})}function s(a,n,t,i){$activeTab=b(a,n),$activeTab.removeClass(n.tabMenuItemActiveClassName),t.addClass(n.tabMenuItemActiveClassName),l(a,n),e(".powermail_fieldset",a).slice(i,i+1).show()}function l(e,a){e.children(a.container).hide()}function c(a,n){return e("<a />").prop("href","#").addClass("btn btn-warning").html("<").click(function(e){e.preventDefault(),u(a,n)})}function o(a,n){return e("<a />").prop("href","#").addClass("btn btn-primary pull-right").html(">").click(function(e){e.preventDefault(),d(a,n)})}function d(e,a){var n=m(e,a);$activeTab=b(e,a),$activeTab.removeClass(a.tabMenuItemActiveClassName).next().addClass(a.tabMenuItemActiveClassName),f(e,a,n+1)}function u(e,a){var n=m(e,a);$activeTab=b(e,a),$activeTab.removeClass(a.tabMenuItemActiveClassName).prev().addClass(a.tabMenuItemActiveClassName),f(e,a,n-1)}function f(e,a,n){l(e,a),e.find(".powermail_fieldset").slice(n,n+1).show()}function m(e,a){var n=p(e,a),t=n.index(b(e,a));return parseInt(t)}function p(e,a){return e.find("."+a.tabMenuClassName).children()}function b(e,a){var n=p(e,a);return n.filter("."+a.tabMenuItemActiveClassName)}function v(e,a){var n=p(e,a);n.removeClass(a.tabMenuItemErrorClassName)}function C(a,n){a.parsley().isValid()||a.find(".parsley-error").each(function(){var t=a.find(".powermail_fieldset").index(e(this).closest(".powermail_fieldset")),i=p(a,n),r=i.slice(t,t+1);r.addClass(n.tabMenuItemErrorClassName)})}e.fn.powermailTabs=function(e){"use strict";var s=jQuery(this);e=jQuery.extend({container:"fieldset",header:"legend",tabs:!0,navigation:!0,openTabOnError:!0,tabIndex:!0,tabMenuClassName:"btn-group",tabMenuItemActiveClassName:"btn-primary",tabMenuItemErrorClassName:"btn-danger"},e),a(s,e),n(s,e),t(s,e),i(s,e),r(s,e)}});
function PowermailForm(e){"use strict";this.initialize=function(){t(),a(),i(),r(),o(),n(),f(),l()};var t=function(){e.fn.powermailTabs&&e(".powermail_morestep").each(function(){e(this).powermailTabs()})},a=function(){e("form[data-powermail-ajax]").length&&p()},i=function(){if(e('*[data-powermail-location="prefill"]').length&&navigator.geolocation){e(this);navigator.geolocation.getCurrentPosition(function(t){var a=t.coords.latitude,i=t.coords.longitude,r=C()+"/index.php?eID=powermailEidGetLocation";jQuery.ajax({url:r,data:"lat="+a+"&lng="+i,cache:!1,success:function(t){t&&e('*[data-powermail-location="prefill"]').val(t)}})})}},r=function(){e.fn.datetimepicker&&e(".powermail_date").each(function(){var t=e(this);if("date"===t.prop("type")||"datetime-local"===t.prop("type")||"time"===t.prop("type")){if(!t.data("datepicker-force")){if(e(this).data("date-value")){var a=g(e(this).data("date-value"),e(this).data("datepicker-format"),t.prop("type"));null!==a&&e(this).val(a)}return}t.prop("type","text"),t.val(e(this).data("date-value"))}var i=!0,r=!0;"date"===t.data("datepicker-settings")?r=!1:"time"===t.data("datepicker-settings")&&(i=!1),t.datetimepicker({format:t.data("datepicker-format"),timepicker:r,datepicker:i,lang:"en",i18n:{en:{months:t.data("datepicker-months").split(","),dayOfWeek:t.data("datepicker-days").split(",")}}})})},o=function(){e(".powermail_all_type_password.powermail_all_value").html("********")},n=function(){e.fn.parsley&&e(".powermail_reset").on("click","",function(){e('form[data-parsley-validate="data-parsley-validate"]').parsley().reset()})},l=function(){window.Parsley&&(x(),b())},p=function(){var t,a=!1;e(document).on("submit","form[data-powermail-ajax]",function(i){var r=e(this),o=r.closest(".tx-powermail");r.data("powermail-ajax-uri")&&(t=r.data("powermail-ajax-uri"));var n=r.data("powermail-form");a||(e.ajax({type:"POST",url:r.prop("action"),data:new FormData(r.get(0)),contentType:!1,processData:!1,beforeSend:function(){s(r)},complete:function(){d(r),f(),c(o)},success:function(i){var o=e('*[data-powermail-form="'+n+'"]:first',i);o.length?(e('*[data-powermail-form="'+n+'"]:first').closest(".tx-powermail").html(o),e.fn.powermailTabs&&e(".powermail_morestep").powermailTabs(),e.fn.parsley&&e('form[data-parsley-validate="data-parsley-validate"]').parsley(),w()):(t?D(t):r.submit(),a=!0)}}),i.preventDefault())})},s=function(t){d(t),e(".powermail_submit",t).length?e(".powermail_submit",t).parent().append(y()):t.closest(".tx-powermail").append(y())},d=function(e){e.closest(".tx-powermail").find(".powermail_progressbar").remove()},c=function(t){var a=e.Event("submitted.powermail.form");t.trigger(a)},f=function(){e(".powermail_fieldwrap_file").find(".deleteAllFiles").each(function(){u(e(this).closest(".powermail_fieldwrap_file").find('input[type="file"]'))}),e(".deleteAllFiles").click(function(){m(e(this).closest(".powermail_fieldwrap_file").find('input[type="hidden"]')),e(this).closest("ul").fadeOut(function(){e(this).remove()})})},u=function(e){e.prop("disabled","disabled").addClass("hide").prop("type","hidden")},m=function(e){e.prop("disabled",!1).removeClass("hide").prop("type","file")},w=function(){e("img.powermail_captchaimage").each(function(){var t=h(e(this).prop("src"));e(this).prop("src",t+"?hash="+v(5))})},h=function(e){var t=e.split("?");return t[0]},v=function(e){for(var t="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<e;i++)t+=a.charAt(Math.floor(Math.random()*a.length));return t},g=function(e,t,a){var i=Date.parseDate(e,t);if(null===i)return null;var r=new Date(i),o=r.getFullYear()+"-";o+=("0"+(r.getMonth()+1)).slice(-2)+"-",o+=("0"+r.getDate()).slice(-2);var n=("0"+r.getHours()).slice(-2)+":"+("0"+r.getMinutes()).slice(-2),l=o+"T"+n;return"date"===a?o:"datetime-local"===a?l:"time"===a?n:null},y=function(){return e("<div />").addClass("powermail_progressbar").html(e("<div />").addClass("powermail_progress").html(e("<div />").addClass("powermail_progess_inner")))},_=function(e){for(var t=e.get(0),a=0,i=0;i<t.files.length;i++){var r=t.files[i];r.size>a&&(a=r.size)}return parseInt(a)},x=function(){window.Parsley.addValidator("powermailfilesize",function(t,a){if(a.indexOf(",")!==-1){var i=a.split(","),r=parseInt(i[0]),o=e('*[name="tx_powermail_pi1[field]['+i[1]+'][]"]');if(o.length&&_(o)>r)return!1}return!0},32).addMessage("en","powermailfilesize","Error")},b=function(){window.Parsley.addValidator("powermailfileextensions",function(t,a){var i=e('*[name="tx_powermail_pi1[field]['+a+'][]"]');return!i.length||k(j(t),i.prop("accept"))},32).addMessage("en","powermailfileextensions","Error")},k=function(e,t){return t.indexOf("."+e)!==-1},j=function(e){return e.split(".").pop().toLowerCase()},D=function(e){e.indexOf("http")!==-1?window.location=e:window.location.pathname=e},C=function(){var t;return t=e("base").length>0?jQuery("base").prop("href"):"https:"!=window.location.protocol?"http://"+window.location.hostname:"https://"+window.location.hostname}}jQuery(document).ready(function(e){"use strict";var t=new window.PowermailForm(e);t.initialize()});
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-csstransitions-touch-shiv-cssclasses-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes-load
 */
;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:w(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},q.csstransitions=function(){return F("transition")};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,e.prefixed=function(a,b,c){return b?F(a,b,c):F(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
/*** jQuery Plugin | responsivehelper 1.1.1 | (c) by Alen Krummmenacher	***/(function(c){c.fn.responsivehelper=function(d){var e,k,l,f;function m(){var b=a.showHeight?a.currentWidth+" x "+g.$.height()+"px @ ":a.currentWidth+"px @ ";for(i in a.breakpoints)if(a.currentWidth>=a.breakpoints[i].breakpoint){b+=a.breakpoints[i].name;break}h.$.text(b)}function n(){b.$.css("overflow-y","hidden");a.currentWidth=g.$.width();a.currentHeight=g.$.height();b.$.css("overflow-y","auto");var c=a.currentBreakpoint,d={};for(i in a.breakpoints)if(a.currentWidth>=a.breakpoints[i].breakpoint){d=
a.breakpoints[i];break}a.currentBreakpoint=d;if(null!=c&&c.breakpoint!=d.breakpoint)a.onBreakpointChange()}var a=c.extend({$:null,domId:"nextResponsiveHelper",breakpoints:{hd:{name:"High Definition",breakpoint:1152},d:{name:"Desktop",breakpoint:1025},tl:{name:"Tablet Landscape",breakpoint:961},tp:{name:"Tablet Portrait",breakpoint:641},s:{name:"Smartphone",breakpoint:1}},maxColumns:12,showWindowSize:!1,showHeight:!1,showGrid:!1,styles:{"background-color":"rgb(33,33,33)",color:"rgb(255,255,255)",padding:"5px",
"font-size":"12px"},positionX:"right",positionY:"bottom",currentBreakpoint:null,currentWidth:0,currentHeight:0,onBreakpointChange:function(){}},d),g={$:c(window)},b={$:c("body")};if(a.showWindowSize)var h={$:null,oDummy:{$:c("<div />").attr("id",a.domId).css({position:"fixed","z-index":1E6,"box-sizing":"border-box"}).css(a.styles)}};a.showGrid&&(f="",l='<div class="column c1"><div></div></div>',k=c("<input />").attr("id",a.domId+"GridToggle").attr("type","checkbox").attr("style","position:fixed;z-index:1000000;"+
a.positionX+":5px;"+a.positionY+":30px"),e=c("<div />").attr("id",a.domId+"Grid").attr("class","row"));if(0<b.$.length){a.showWindowSize&&(h.oDummy.$.css(a.positionX,0).css(a.positionY,0),b.$.append(h.oDummy.$),h.$=b.$.find("#"+a.domId));if(a.showGrid){b.$.append(k);for(d=1;d<=a.maxColumns;d++)f+=l,e.html(f);b.$.append(e);b.$.find("#"+e.attr("id"))}g.$.bind("resize",function(){n();a.showWindowSize&&m()});for(i in a.breakpoints)a.breakpoints[i].codeName=i;n();a.showWindowSize&&m()}else"undefined"!=
typeof console&&console.warn("responsivehelper: the binded element was not found!");return a}})(jQuery);
/*! jQuery AnySlider 2.0.2 | Copyright 2014 Jonathan Wilsson and contributors */

;(function(root, factory) {
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    } else if (typeof exports === 'object') {
        factory(require('jquery'));
    } else {
        factory(root.jQuery || root.Zepto);
    }
}(this, function($) {
    'use strict';

    var AnySlider = (function (slider, options) {
        var slides = slider.children(),
            orgNumSlides = slides.length,
            numSlides = orgNumSlides,
            width = slider.width(),
            nextSlide = 0,
            current = 0,
            inner,
            timer,
            running = false,
            defaults = {
                afterChange: function () {},
                afterSetup: function () {},
                animation: 'slide',
                beforeChange: function () {},
                easing: 'swing',
                interval: 5000,
                keyboard: true,
                nextLabel: 'Next slide',
                pauseOnHover: true,
                prevLabel: 'Previous slide',
                reverse: false,
                showBullets: true,
                showControls: true,
                speed: 400,
                startSlide: 1,
                touch: true
            };

        options = $.extend(defaults, options);

        // Setup the slides
        if (orgNumSlides > 1) {
            slides.eq(0).clone().addClass('clone').appendTo(slider);
            slides.eq(numSlides - 1).clone().addClass('clone').prependTo(slider);

            if (options.startSlide < orgNumSlides) {
                current = options.startSlide;
            }
        }

        slides = slider.children();
        numSlides = slides.length;

        // CSS setup
        slides.wrapAll('<div class="as-slide-inner"></div>').css('width', width);
        inner = slider.css('overflow', 'hidden').find('.as-slide-inner');

        if (options.animation === 'fade') {
            // Properties are quoted for consistency since "float" will trigger an error when the script is minified (if unquoted)
            slides.css({
                'display': 'none',
                'left': 0,
                'position': 'absolute',
                'top': 0
            }).eq(current).show();

            inner.css('width', width);
        } else {
            slides.css({
                'float': 'left',
                'position': 'relative'
            });

            inner.css({
                'left': -current * width,
                'width': numSlides * width
            });
        }

        inner.css({
            'float': 'left',
            'position': 'relative'
        });

        // Add the arrows
        if (options.showControls && orgNumSlides > 1) {
            slider.prepend('<a href="#" class="as-prev-arrow" title="LABEL">LABEL</a>'.replace(/LABEL/g, options.prevLabel));
            slider.append('<a href="#" class="as-next-arrow" title="LABEL">LABEL</a>'.replace(/LABEL/g, options.nextLabel));

            slider.on('click.as', '.as-prev-arrow, .as-next-arrow', function (e) {
                e.preventDefault();

                if (running) {
                    return;
                }

                if ($(this).hasClass('as-prev-arrow')) {
                    prev();
                } else {
                    next();
                }
            });
        }

        // Add navigation bullets
        if (options.showBullets && orgNumSlides > 1) {
            var i,
                active,
                out = '<div class="as-nav"></div>',
                nav = $(out);

            for (i = 1; i <= orgNumSlides; i++) {
                active = '';
                if (i === current) {
                    active = ' class="as-active"';
                }

                nav.append('<a href="#"' + active + '>' + i + '</a>');
            }

            nav.on('click.as', 'a', function (e) {
                var index = $(this).index();

                e.preventDefault();

                if ($(this).hasClass('as-active') || running) {
                    return;
                }

                nav.find('a').removeClass('as-active').eq(index).addClass('as-active');

                goTo(index + 1);
            });

            slider.after(nav);
        }

        // Enable keyboard navigation
        if (options.keyboard) {
            $(document).on('keydown.as', function (e) {
                var key = e.keyCode;

                // See if the left or right arrow is pressed
                if (key !== 37 && key !== 39 || orgNumSlides <= 1) {
                    return;
                }

                if (key === 37) {
                    prev();
                } else {
                    next();
                }
            });
        }

        if (options.pauseOnHover) {
            slider.on('mouseenter', function () {
                pause();
            }).on('mouseleave', function () {
                play();
            });
        }

        // Enable responsive support
        $(window).resize(function () {
            if (!running) {
                width = slider.width();

                inner.css('width', width);
                slides.css('width', width);

                if (options.animation !== 'fade') {
                    inner.css({
                        'left': -current * width,
                        'width': numSlides * width
                    });
                }
            }
        });

        /**
         * Enable swipe support. (Don't bother if not wanted or supported)
         *
         * Resources:
         * http://wowmotty.blogspot.com/2011/10/adding-swipe-support.html
         * http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10.aspx#step4
         * https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/
         */
        if (options.touch && ('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints > 0)) {
            var startTime,
                startX;

            slider.on('touchstart.as pointerdown.as MSPointerDown.as', function (e) {
                startTime = e.timeStamp;

                if (e.originalEvent) {
                    startX = e.originalEvent.pageX || e.originalEvent.touches[0].pageX;
                } else {
                    startX = e.pageX || e.touches[0].pageX;
                }
            }).on('touchmove.as pointermove.as MSPointerMove.as', function (e) {
                var currentDistance = 0,
                    currentTime = e.timeStamp,
                    currentX;

                if (e.originalEvent) {
                    currentX = e.originalEvent.pageX || e.originalEvent.touches[0].pageX;
                } else {
                    currentX = e.pageX || e.touches[0].pageX;
                }

                if (startX !== 0) {
                    currentDistance = Math.abs(currentX - startX);
                }

                // Only allow if movement < 1 sec and distance is long enough
                if (startTime !== 0 && currentTime - startTime < 1000 && currentDistance > 10) {
                    e.preventDefault();

                    if (currentX < startX) { // Swiping to the left, i.e. next slide
                        next();
                    } else if (currentX > startX) { // Swiping to the right, i.e. previous slide
                        prev();
                    }

                    startTime = 0;
                    startX = 0;

                    // Android doesn't always fire touchend
                    slider.trigger('touchend.as');
                }
            }).on('touchend.as pointerup.as MSPointerUp.as', function () {
                startTime = 0;
                startX = 0;
            });
        }

        // Enable autoplay
        tick();

        options.afterSetup.call(slider[0]);

        // Private methods
        // Animation complete callback
        function animationCallback() {
            current = nextSlide;

            if (nextSlide === 0) {
                current = orgNumSlides;

                if (options.animation !== 'fade') {
                    inner.css('left', -current * width);
                }
            } else if (nextSlide === numSlides - 1) {
                current = 1;

                if (options.animation !== 'fade') {
                    inner.css('left', -width);
                }
            }

            // Fix for Zepto hiding the slide
            if (options.animation === 'fade') {
                slides.eq(current).show();
            }

            if (options.showBullets) {
                slider.next('.as-nav').find('a').removeClass('as-active').eq(current - 1).addClass('as-active');
            }

            running = false;

            options.afterChange.call(slider[0]);
        }

        // The main animation function
        function run() {
            if (running || orgNumSlides <= 1) {
                return;
            }

            running = true;

            options.beforeChange.call(slider[0]);

            if (options.animation === 'fade') {
                slides.css('z-index', 1).fadeOut(options.speed).eq(nextSlide).css('z-index', 2).fadeIn(options.speed, animationCallback);
            } else {
                inner.animate({'left': -nextSlide * width}, options.speed, options.easing, animationCallback);
            }

            tick();
        }

        // Set the autoplay timer
        function tick() {
            clearTimeout(timer);

            // Check if autoplay is enabled
            if (options.interval && orgNumSlides > 1) {
                timer = setTimeout(function () {
                    if (options.reverse) {
                        prev();
                    } else {
                        next();
                    }
                }, options.interval);
            }
        }

        // Public methods
        function currentSlide() {
            return current;
        }

        function goTo(slide) {
            nextSlide = slide;

            run();
        }

        function next() {
            nextSlide = current + 1;

            run();
        }

        function pause() {
            clearTimeout(timer);
        }

        function play() {
            tick();
        }

        function prev() {
            nextSlide = current - 1;

            run();
        }

        return {
            currentSlide: currentSlide,
            goTo: goTo,
            next: next,
            pause: pause,
            play: play,
            prev: prev
        };
    });

    $.fn.anyslider = function (options) {
        return this.each(function () {
            var slider = $(this),
                anyslider;

            // Bail if we already have a plugin instance for this element
            if (slider.data('anyslider')) {
                return slider.data('anyslider');
            }

            anyslider = new AnySlider(slider, options);

            slider.data('anyslider', anyslider);
        });
    };
}));

/*** jQuery Plugin | nextformvalidator 1.0.9 | (c) by Alen Krummmenacher ***/

(function($) {

	$.fn.nextformvalidator										= function(oArguments){
		var oNextFormValidator									= $.extend({
			'errorClass'				:	'error',
			'requiredClass'				:	'required',
			'ignoreClass'				:	'ignore',
			'markLabelsOnError'			:	true,
			'debugMode'					:	false,
			'beforeValidate'			:	function(){return true;},
			'onValidate'				:	function(){return true;},
			'beforeSubmit'				:	function(){return true;},
			'validateOnBlur'			:	false
		}, oArguments);

		/* DEFAULTS */
		var sCurrentCheckBoxGroup								= '';
		var aInputTypesToCheck									= [
			'text',
			'textarea',
			'password',
			'select',
			'email',
			'tel',
			'month',
			'number',
			'range',
			'search',
			'date',
			'datetime',
			'datetime-local',
			'time',
			'url',
			'week',
			'color'
		];

		oNextFormValidator.debugMode = oNextFormValidator.debugMode && typeof console != 'undefined';

		/* FUNCTIONIONS */

		// Mark Label
		function markLabel(oLabel, bDoMark) {
			if(oNextFormValidator.debugMode) {
				console.info('nextformvalidator: Mark Label (for): ' + oLabel.attr('for'));
			}

			if(oLabel.length) {
				if(typeof bDoMark == 'undefined' || bDoMark) {
					oLabel.addClass(oNextFormValidator.errorClass);
				} else {
					oLabel.removeClass(oNextFormValidator.errorClass);
				}
			}
		}

		// Validate Field
		function validateField(oCurrentField, sCurrentFieldValue) {
			var bCurrentFieldIsValid					= true;
			var bCurrentFieldIsEmpty					= false;
			var bMatchFieldIsEmpty						= false;

			if (oCurrentField.attr('data-placeholder') == sCurrentFieldValue || sCurrentFieldValue == '') {
				bCurrentFieldIsEmpty					= true;
				sCurrentFieldValue						= '';
			}

			if(oCurrentField.hasClass(oNextFormValidator.requiredClass) && bCurrentFieldIsEmpty) {
				bCurrentFieldIsValid					= false;
			}

			if(!bCurrentFieldIsEmpty) {
				if(oCurrentField.hasClass('email')) {
					if(sCurrentFieldValue.match(/^([a-zA-Z0-9_\-]+)([a-zA-Z0-9_\-\.]*)([a-zA-Z0-9_\-]+)[@]{1}(([a-zA-Z0-9\-])+\.){1,5}([a-zA-Z]){2,12}$/) == null) {
						bCurrentFieldIsValid			= false;
					}
				}

				if(oCurrentField.hasClass('number')) {
					if(isNaN(sCurrentFieldValue)) {
						bCurrentFieldIsValid			= false;
					}
				}

				if(oCurrentField.hasClass('integer')) {
					if(sCurrentFieldValue != parseInt(sCurrentFieldValue)) {
						bCurrentFieldIsValid			= false;
					}
				}

				if(oCurrentField.hasClass('float')) {
					if((isNaN(sCurrentFieldValue) || (!isNaN(sCurrentFieldValue) && sCurrentFieldValue % 1 == 0)))  {
						bCurrentFieldIsValid			= false;
					}
				}
			}

			/* Match */
			if(oCurrentField.hasClass('match') || $('[data-match-group="' + oCurrentField.attr('id') + '"]').length) {
				if(oCurrentField.hasClass('match')) {
					var sMatchFieldId					= oCurrentField.attr('data-match-group');
					var $matchField 					= $('input[id="' + sMatchFieldId + '"]');
					var sMatchFieldValue				= ($matchField.val() == '' || $matchField.val() == $matchField.attr('data-placeholder')) ? '' : $matchField.val();
					var bMatchFieldIsEmpty				= false;
					var bMatchFieldIsValid				= true;


					if ($matchField.attr('data-placeholder') == sMatchFieldValue || sMatchFieldValue == '') {
						bMatchFieldIsEmpty				= true;
						sMatchFieldValue				= '';
					}

					if((sCurrentFieldValue != sMatchFieldValue|| !bCurrentFieldIsValid) && !bMatchFieldIsEmpty) {
						bMatchFieldIsValid				= false;
						$('input[id="' + sMatchFieldId + '"]').addClass(oNextFormValidator.errorClass);
					} else {
						$('input[id="' + sMatchFieldId + '"]').removeClass(oNextFormValidator.errorClass);
					}

					if(oNextFormValidator.markLabelsOnError) {
						markLabel($('label[for="'+ sMatchFieldId +'"]'), !bMatchFieldIsValid);
					}
				} else {
					if(sCurrentFieldValue != $('[data-match-group="' + oCurrentField.attr('id') + '"]').val()) {
						bCurrentFieldIsValid			= false;
						oCurrentField.addClass(oNextFormValidator.errorClass);
					} else {
						oCurrentField.removeClass(oNextFormValidator.errorClass);
					}

					if(oNextFormValidator.markLabelsOnError) {
						markLabel($('label[for="' + oCurrentField.attr('id') +'"]'), !bCurrentFieldIsValid);
					}
				}
			}

			/* Grouped Fields */
			if(oCurrentField.filter('[data-group]').length) {
				var iFieldsWithThisGroup				= $('[data-group="' + oCurrentField.attr('data-group') + '"]').length;
				var iEmptyFieldsWithThisGroup			= 0;

				$('[data-group="' + oCurrentField.attr('data-group') + '"]').each(function(iGroupFields, el){
					var sFieldWithGroupValue			= $.trim($(this).val());
					if(sFieldWithGroupValue.length == 0 || sFieldWithGroupValue == $(this).attr('data-placeholder')) {
						iEmptyFieldsWithThisGroup++;
					}
				});

				if(iFieldsWithThisGroup == iEmptyFieldsWithThisGroup) {
					bCurrentFieldIsValid				= false;
				} else {
					bCurrentFieldIsValid				= true;
				}
			}

			return bCurrentFieldIsValid;
		}

		function validate(oCurrentField) {
			var bIsValid									= true;
			var sCurrentCheckBoxGroup						= '';
			var sCurrentFieldTagName						= oCurrentField.prop('tagName').toLowerCase();
			var sCurrentFieldType							= (sCurrentFieldTagName == 'input') ? oCurrentField.attr('type') : sCurrentFieldTagName;
			var bCurrentFieldIsValid						= true;
			var sCurrentFieldValue							= $.trim(oCurrentField.val());

			if(oNextFormValidator.debugMode) {
				if(typeof oCurrentField.attr('id') == 'undefined' && typeof oCurrentField.attr('name') != 'undefined') {
					console.warn('nextformvalidator: Folgendes Feld hat kein "id" Attribut: ' + sCurrentFieldTagName + '[name="' + oCurrentField.attr('name') + '"]');
				} else if(typeof oCurrentField.attr('name') == 'undefined' && typeof oCurrentField.attr('id') != 'undefined') {
					console.warn('nextformvalidator: Folgendes Feld hat kein "name" Attribut: ' + oCurrenFieldTagName + '#' + oCurrentField.attr('id'));
				} else if(typeof oCurrentField.attr('name') == 'undefined' && typeof oCurrentField.attr('id') == 'undefined') {
					console.warn('nextformvalidator: Folgendes Feld hat kein "name" & kein "id" Attribut: ' + sCurrentFieldTagName + ' ' + oCurrentField);
				}
			}

			// Text, Textarea, Password, Select
			if($.inArray(sCurrentFieldType, aInputTypesToCheck) != -1) {
				if(oNextFormValidator.debugMode) {
					console.info('nextformvalidator: Current Validation-Type to Check: ' + sCurrentFieldType);
				}

				bCurrentFieldIsValid						= validateField(oCurrentField, sCurrentFieldValue);

				if(oNextFormValidator.debugMode) {
					console.log('nextformvalidator: Field "' + oCurrentField.attr('name') + '" is Valid -> ' + bCurrentFieldIsValid);
				}

				if(bCurrentFieldIsValid) {
					oCurrentField.removeClass(oNextFormValidator.errorClass).parent('.customSelect').removeClass(oNextFormValidator.errorClass);;

					if(oCurrentField.filter('[data-group]').length) {
						$('[data-group="' + oCurrentField.attr('data-group') + '"]').removeClass(oNextFormValidator.errorClass).parent('.customSelect').removeClass(oNextFormValidator.errorClass);
					}
				} else {
					oCurrentField.addClass(oNextFormValidator.errorClass).parent('.customSelect').addClass(oNextFormValidator.errorClass);
					bIsValid								= false;
				}

				if(oNextFormValidator.markLabelsOnError) {
					markLabel($('label[for="'+ oCurrentField.attr('id') +'"]'), !bCurrentFieldIsValid);
				}
			// Checkbox
			} else if($.inArray(sCurrentFieldType, ['checkbox','radio']) != -1 && oCurrentField.hasClass(oNextFormValidator.requiredClass) && oCurrentField.attr('data-group') != sCurrentCheckBoxGroup) { // Maybe Radiobuttons
				if(oNextFormValidator.debugMode) {
					console.info('nextformvalidator: Current Validation-Type to Check: ' + sCurrentFieldType);
				}

				sCurrentCheckBoxGroup						= oCurrentField.attr('data-group');

				if($('input[data-group="' + sCurrentCheckBoxGroup + '"]').length == $('input[data-group="' + sCurrentCheckBoxGroup + '"]:not(:checked)').length) {
					bCurrentFieldIsValid					= false;
					bIsValid								= false;
					$('input[data-group="' + sCurrentCheckBoxGroup + '"]').addClass(oNextFormValidator.errorClass);
				} else {
					$('input[data-group="' + sCurrentCheckBoxGroup + '"]').removeClass(oNextFormValidator.errorClass);
				}

				markLabel($('label[for="'+ sCurrentCheckBoxGroup +'"]'), !bCurrentFieldIsValid);
			}

			return bIsValid;
		}

		// Form Validator
		function validateForm(oFieldGroup, bForceThisField) {
			var bIsValid										= true;
			var bCurrentIsValid 								= true;
			var bIsSingleField									= (typeof bForceThisField != 'undefined') ? bForceThisField : false;
			
			if(oNextFormValidator.validateOnBlur && bIsSingleField) {
				bIsValid = validate(oFieldGroup);
			} else {
				oFieldGroup.find('.required, .number, .integer, .float, .email, .match').not('.' + oNextFormValidator.ignoreClass).each(function(iFieldIndex){
					bCurrentIsValid = validate($(this));
					if(!bCurrentIsValid) {
						bIsValid = false;
					}
				});
			}

			if(oNextFormValidator.debugMode) {
				if(bIsSingleField) {
					console.log('nextformvalidator: Is Field Valid -> ' + bIsValid);
					console.log('-------------------------------------------------------------------------------------');
				} else {
					console.log('nextformvalidator: Is Form Valid -> ' + bIsValid);
				}
			}

			if(oNextFormValidator.debugMode) {
				console.log('nextformvalidator: onValidate()');
			}

			var bReturnOnValidate								= oNextFormValidator.onValidate(oFieldGroup, bIsValid);

			if(typeof bReturnOnValidate != 'undefined') {
				if(!bReturnOnValidate){
					if(oNextFormValidator.debugMode) {
						console.log('nextformvalidator: onValidate() returned FALSE');
					}
					return false;
				}else{
					return true;
				}
			}

			return bIsValid;
		}

		/* BIND FORM / A PART FROM FORM / BLUR ON REQUIRED FIELDS */
		if($(this).length > 0) {
			if(oNextFormValidator.validateOnBlur) {
				$(this).find('.required').bind('blur', function(e){
					if(oNextFormValidator.debugMode) {
						console.log('nextformvalidator: live validate one field: ' + $(this).prop('tagName') + ' ' + $(this).attr('name'));
					}
					return validateForm($(this), true);
				});
			}

			if($(this).prop('tagName').toLowerCase() == 'form') {
				return this.bind('submit', function(e){
					var oFieldGroup = $(this);
					var oSubmit 	= $(this).find('button[type="submit"]:focus');

					if(oNextFormValidator.debugMode) {
						console.log('nextformvalidator: beforeValidate()');
					}
					var bBeforeValidate							= oNextFormValidator.beforeValidate(oFieldGroup, oSubmit);
					
					var bValidateForm 							= false;
					if(typeof bBeforeValidate == 'undefined' || bBeforeValidate) {
						bValidateForm = validateForm(oFieldGroup);
					} else {
						return false;
					}

					if(bValidateForm) {
						if(oNextFormValidator.debugMode) {
							console.log('nextformvalidator: beforeSubmit()');
						}
						var bReturnBeforeSubmit					= oNextFormValidator.beforeSubmit(oFieldGroup);
						if(typeof bReturnBeforeSubmit != 'undefined' && !bReturnBeforeSubmit) {
							return false;
						}

						oFieldGroup.find('[data-placeholder]').not('.' + oNextFormValidator.ignoreClass).each(function(iFieldIndex){
							if(oNextFormValidator.debugMode) {
								console.log('nextformvalidator: form is valid! clear placeholders for not required fields.');
							}

							if($(this).val() == $(this).attr('data-placeholder')) {
								$(this).val('');
							}
						});
					}
					return bValidateForm;
				});
			} else {
				if(oNextFormValidator.debugMode) {
					console.log('nextformvalidator: beforeValidate()');
				}
				var bBeforeValidate								= oNextFormValidator.beforeValidate($(this));
				if(typeof bBeforeValidate == 'undefined' || bBeforeValidate) {
					return validateForm($(this));
				} else {
					return false;
				}
			}
		} else if(oNextFormValidator.debugMode) {
			console.warn('nextformvalidator: the binded element was not found!');
		}
	};
})(jQuery);
/*!
 * jQuery postMessage - v0.5 - 9/11/2009
 * http://benalman.com/projects/jquery-postmessage-plugin/
 *
 * Copyright (c) 2009 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */

// Script: jQuery postMessage: Cross-domain scripting goodness
//
// *Version: 0.5, Last updated: 9/11/2009*
//
// Project Home - http://benalman.com/projects/jquery-postmessage-plugin/
// GitHub       - http://github.com/cowboy/jquery-postmessage/
// Source       - http://github.com/cowboy/jquery-postmessage/raw/master/jquery.ba-postmessage.js
// (Minified)   - http://github.com/cowboy/jquery-postmessage/raw/master/jquery.ba-postmessage.min.js (0.9kb)
//
// About: License
//
// Copyright (c) 2009 "Cowboy" Ben Alman,
// Dual licensed under the MIT and GPL licenses.
// http://benalman.com/about/license/
//
// About: Examples
//
// This working example, complete with fully commented code, illustrates one
// way in which this plugin can be used.
//
// Iframe resizing - http://benalman.com/code/projects/jquery-postmessage/examples/iframe/
//
// About: Support and Testing
//
// Information about what version or versions of jQuery this plugin has been
// tested with and what browsers it has been tested in.
//
// jQuery Versions - 1.3.2
// Browsers Tested - Internet Explorer 6-8, Firefox 3, Safari 3-4, Chrome, Opera 9.
//
// About: Release History
//
// 0.5 - (9/11/2009) Improved cache-busting
// 0.4 - (8/25/2009) Initial release

(function($){
  '$:nomunge'; // Used by YUI compressor.

  // A few vars used in non-awesome browsers.
  var interval_id,
    last_hash,
    cache_bust = 1,

    // A var used in awesome browsers.
    rm_callback,

    // A few convenient shortcuts.
    window = this,
    FALSE = !1,

    // Reused internal strings.
    postMessage = 'postMessage',
    addEventListener = 'addEventListener',

    p_receiveMessage,

    // I couldn't get window.postMessage to actually work in Opera 9.64!
    has_postMessage = window[postMessage];

  // Method: jQuery.postMessage
  //
  // This method will call window.postMessage if available, setting the
  // targetOrigin parameter to the base of the target_url parameter for maximum
  // security in browsers that support it. If window.postMessage is not available,
  // the target window's location.hash will be used to pass the message. If an
  // object is passed as the message param, it will be serialized into a string
  // using the jQuery.param method.
  //
  // Usage:
  //
  // > jQuery.postMessage( message, target_url [, target ] );
  //
  // Arguments:
  //
  //  message - (String) A message to be passed to the other frame.
  //  message - (Object) An object to be serialized into a params string, using
  //    the jQuery.param method.
  //  target_url - (String) The URL of the other frame this window is
  //    attempting to communicate with. This must be the exact URL (including
  //    any query string) of the other window for this script to work in
  //    browsers that don't support window.postMessage.
  //  target - (Object) A reference to the other frame this window is
  //    attempting to communicate with. If omitted, defaults to `parent`.
  //
  // Returns:
  //
  //  Nothing.

  $[postMessage] = function( message, target_url, target ) {
    if ( !target_url ) { return; }

    // Serialize the message if not a string. Note that this is the only real
    // jQuery dependency for this script. If removed, this script could be
    // written as very basic JavaScript.
    message = typeof message === 'string' ? message : $.param( message );

    // Default to parent if unspecified.
    target = target || parent;

    if ( has_postMessage ) {
      // The browser supports window.postMessage, so call it with a targetOrigin
      // set appropriately, based on the target_url parameter.
      target[postMessage]( message, target_url.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );

    } else if ( target_url ) {
      // The browser does not support window.postMessage, so set the location
      // of the target to target_url#message. A bit ugly, but it works! A cache
      // bust parameter is added to ensure that repeat messages trigger the
      // callback.
      target.location = target_url.replace( /#.*$/, '' ) + '#' + (+new Date) + (cache_bust++) + '&' + message;
    }
  };

  // Method: jQuery.receiveMessage
  //
  // Register a single callback for either a window.postMessage call, if
  // supported, or if unsupported, for any change in the current window
  // location.hash. If window.postMessage is supported and source_origin is
  // specified, the source window will be checked against this for maximum
  // security. If window.postMessage is unsupported, a polling loop will be
  // started to watch for changes to the location.hash.
  //
  // Note that for simplicity's sake, only a single callback can be registered
  // at one time. Passing no params will unbind this event (or stop the polling
  // loop), and calling this method a second time with another callback will
  // unbind the event (or stop the polling loop) first, before binding the new
  // callback.
  //
  // Also note that if window.postMessage is available, the optional
  // source_origin param will be used to test the event.origin property. From
  // the MDC window.postMessage docs: This string is the concatenation of the
  // protocol and "://", the host name if one exists, and ":" followed by a port
  // number if a port is present and differs from the default port for the given
  // protocol. Examples of typical origins are https://example.org (implying
  // port 443), http://example.net (implying port 80), and http://example.com:8080.
  //
  // Usage:
  //
  // > jQuery.receiveMessage( callback [, source_origin ] [, delay ] );
  //
  // Arguments:
  //
  //  callback - (Function) This callback will execute whenever a <jQuery.postMessage>
  //    message is received, provided the source_origin matches. If callback is
  //    omitted, any existing receiveMessage event bind or polling loop will be
  //    canceled.
  //  source_origin - (String) If window.postMessage is available and this value
  //    is not equal to the event.origin property, the callback will not be
  //    called.
  //  source_origin - (Function) If window.postMessage is available and this
  //    function returns false when passed the event.origin property, the
  //    callback will not be called.
  //  delay - (Number) An optional zero-or-greater delay in milliseconds at
  //    which the polling loop will execute (for browser that don't support
  //    window.postMessage). If omitted, defaults to 100.
  //
  // Returns:
  //
  //  Nothing!

  $.receiveMessage = p_receiveMessage = function( callback, source_origin, delay ) {
    if ( has_postMessage ) {
      // Since the browser supports window.postMessage, the callback will be
      // bound to the actual event associated with window.postMessage.

      if ( callback ) {
        // Unbind an existing callback if it exists.
        rm_callback && p_receiveMessage();

        // Bind the callback. A reference to the callback is stored for ease of
        // unbinding.
        rm_callback = function(e) {
          if ( ( typeof source_origin === 'string' && e.origin !== source_origin )
            || ( $.isFunction( source_origin ) && source_origin( e.origin ) === FALSE ) ) {
            return FALSE;
          }
          callback( e );
        };
      }

      if ( window[addEventListener] ) {
        window[ callback ? addEventListener : 'removeEventListener' ]( 'message', rm_callback, FALSE );
      } else {
        window[ callback ? 'attachEvent' : 'detachEvent' ]( 'onmessage', rm_callback );
      }

    } else {
      // Since the browser sucks, a polling loop will be started, and the
      // callback will be called whenever the location.hash changes.

      interval_id && clearInterval( interval_id );
      interval_id = null;

      if ( callback ) {
        delay = typeof source_origin === 'number'
          ? source_origin
          : typeof delay === 'number'
            ? delay
            : 100;

        interval_id = setInterval(function(){
          var hash = document.location.hash,
            re = /^#?\d+&/;
          if ( hash !== last_hash && re.test( hash ) ) {
            last_hash = hash;
            callback({ data: hash.replace( re, '' ) });
          }
        }, delay );
      }
    }
  };

})(jQuery);

/*  jQuery Nice Select - v1.0
    http://hernansartorio.github.io/jquery-nice-select
    Made by Hernán Sartorio  */

/*****************************************/
/* ACHTUNG!!! WURDE NEXTAGE CUSTOMIZED!!!! *******/
/*****************************************/ 

(function($) {

  $.fn.niceSelect = function() {

    // Create custom markup
    this.each(function() {
      var select = $(this);
      
      if (!select.next().hasClass('nice-select')) {
        select.after('<div class="nice-select ' + (select.attr('class') || '') + (select.attr('disabled') ? 'disabled' : '" tabindex="0') + 
          '"><span class="current"></span><ul class="list"></ul></div>');
        
        var dropdown = select.next();
        var options = select.find('option');
        var selected = select.find('option:selected');
        
        dropdown.find('.current').html(selected.data('display') || selected.text());

        if(selected.val() == ''){
          dropdown.find('.current').addClass('subtitle');
        }else{
           dropdown.find('.current').removeClass('subtitle');
        }
        
        options.each(function() {
          var display = $(this).data('display');
          dropdown.find('ul').append('<li class="option ' + ($(this).is(':selected') ? 'selected' : '') + ($(this).val() == '' ? ' title' : '') +
            '" data-value="' + $(this).val() + (display ? '" data-display="' + display : '') + '">' + 
            $(this).text() + '</li>');
        });
      }
    });
    
    /* Event listeners */
    
    // Unbind existing events in case that the plugin has been initialized before
    $(document).off('.nice_select');
    
    // Open/close
    $(document).on('click.nice_select', '.nice-select', function(event) {
      var dropdown = $(this);
      
      $('.nice-select').not(dropdown).removeClass('open');
      dropdown.toggleClass('open');
      
      if (dropdown.hasClass('open')) {
        dropdown.find('.option');  
        dropdown.find('.focus').removeClass('focus');
        dropdown.find('.selected').addClass('focus');
      } else {
        dropdown.focus();
      }
    });
    
    // Close when clicking outside
    $(document).on('click.nice_select', function(event) {
      if ($(event.target).closest('.nice-select').length === 0) {
        $('.nice-select').removeClass('open').find('.option');  
      }
    });
    
    // Option click
    $(document).on('click.nice_select', '.nice-select .option', function(event) {
      var option = $(this);
      var dropdown = option.closest('.nice-select');
      
      dropdown.find('.selected').removeClass('selected');
      option.addClass('selected');
      
      var text = option.data('display') || option.text();
      dropdown.find('.current').text(text);

      if(option.val() == ''){
        dropdown.find('.current').addClass('subtitle');
      }else{
         dropdown.find('.current').removeClass('subtitle');
      }
      
      dropdown.prev('select').val(option.data('value')).trigger('change');
    });

    // Keyboard events
    $(document).on('keydown.nice_select', '.nice-select', function(event) {    
      var dropdown = $(this);
      var focused_option = $(dropdown.find('.focus') || dropdown.find('.list .option.selected'));
      
      // Space or Enter
      if (event.keyCode == 32 || event.keyCode == 13) {
        if (dropdown.hasClass('open')) {
          focused_option.trigger('click');
        } else {
          dropdown.trigger('click');
        }
        return false;
      // Down
      } else if (event.keyCode == 40) {
        if (!dropdown.hasClass('open')) {
          dropdown.trigger('click');
        } else {
          if (focused_option.next().length > 0) {
            dropdown.find('.focus').removeClass('focus');
            focused_option.next().addClass('focus');
          }
        }
        return false;
      // Up
      } else if (event.keyCode == 38) {
        if (!dropdown.hasClass('open')) {
          dropdown.trigger('click');
        } else {
          if (focused_option.prev().length > 0) {
            dropdown.find('.focus').removeClass('focus');
            focused_option.prev().addClass('focus');
          }
        }
        return false;
      // Esc
      } else if (event.keyCode == 27) {
        if (dropdown.hasClass('open')) {
          dropdown.trigger('click');
        }
      // Tab
      } else if (event.keyCode == 9) {
        if (dropdown.hasClass('open')) {
          return false;
        }
      }
    });

  };

}(jQuery));
/*
 Author: Jafar Akhondali
 Release year: 2016
 Title:	Light-Zoom JQuery plugin that use pure css to zoom on images, this enables you to zoom without loading bigger image and zoom even on gif images !
 https://github.com/JafarAkhondali/lightzoom
 */
$.fn.lightzoom=function(a){a=$.extend({zoomPower:3,glassSize:175},a);var l=a.glassSize/2,m=a.glassSize/4,n=a.zoomPower;$("body").append('<div id="glass"></div>');$("html > head").append($("<style> #glass{width: "+a.glassSize+"px; height: "+a.glassSize+"px;}</style>"));var k;$("#glass").mousemove(function(a){var c=this.targ;a.target=c;k(a,c)});this.mousemove(function(a){k(a,this)});k=function(a,c){document.getElementById("glass").targ=c;var d=a.pageX,e=a.pageY,g=c.offsetWidth,h=c.offsetHeight,b=$(c).offset(),
f=b.left,b=b.top;d>f&&d<f+g&&b<e&&b+h>e?(offsetXfixer=(d-f-g/2)/(g/2)*m,offsetYfixer=(e-b-h/2)/(h/2)*m,f=(d-f+offsetXfixer)/g*100,b=(e-b+offsetYfixer)/h*100,e-=l,d-=l,$("#glass").css({top:e,left:d,"background-image":" url('"+c.src+"')","background-size":g*n+"px "+h*n+"px","background-position":f+"% "+b+"%",display:"inline-block"}),$("body").css("cursor","none")):($("#glass").css("display","none"),$("body").css("cursor","default"))};return this};

/**
 * @module       RD Navbar
 * @author       Evgeniy Gusarov
 * @version      2.2.5
 */
(function() {
  var isTouch;

  isTouch = "ontouchstart" in window;

  (function($, document, window) {

    /**
     * Creates a RDNavbar.
     * @class RDNavbar.
     * @public
     * @param {HTMLElement} element - The element to create the RDNavbar for.
     * @param {Object} [options] - The options
     */
    var RDNavbar;
    RDNavbar = (function() {

      /**
       * Default options for RDNavbar.
       * @protected
       */
      RDNavbar.prototype.Defaults = {
        layout: 'rd-navbar-static',
        deviceLayout: 'rd-navbar-fixed',
        focusOnHover: true,
        focusOnHoverTimeout: 800,
        linkedElements: ["html"],
        domAppend: true,
        stickUp: true,
        stickUpClone: true,
        stickUpOffset: '100%',
        anchorNav: true,
        anchorNavSpeed: 400,
        anchorNavOffset: 0,
        anchorNavEasing: 'swing',
        autoHeight: true,
        responsive: {
          0: {
            layout: "rd-navbar-fixed",
            deviceLayout: "rd-navbar-fixed",
            focusOnHover: false,
            stickUp: false
          },
          992: {
            layout: "rd-navbar-static",
            deviceLayout: "rd-navbar-static",
            focusOnHover: true,
            stickUp: true
          }
        },
        callbacks: {
          onToggleSwitch: false,
          onToggleClose: false,
          onDomAppend: false,
          onDropdownOver: false,
          onDropdownOut: false,
          onDropdownToggle: false,
          onDropdownClose: false,
          onStuck: false,
          onUnstuck: false,
          onAnchorChange: false
        }
      };

      function RDNavbar(element, options) {

        /**
         * Current options set
         * @public
         */
        this.options = $.extend(true, {}, this.Defaults, options);

        /**
         * Plugin element
         * @public
         */
        this.$element = $(element);

        /**
         * Plugin element clone
         * @public
         */
        this.$clone = null;

        /**
         * Additional references
         * @public
         */
        this.$win = $(window);
        this.$doc = $(document);
        this.currentLayout = this.options.layout;
        this.loaded = false;
        this.focusOnHover = this.options.focusOnHover;
        this.focusTimer = false;
        this.cloneTimer = false;
        this.isStuck = false;
        this.initialize();
      }


      /**
       * Initializes the RDNavbar.
       * @protected
       */

      RDNavbar.prototype.initialize = function() {
        var ctx;
        ctx = this;
        ctx.$element.addClass("rd-navbar").addClass(ctx.options.layout);
        if (isTouch) {
          ctx.$element.addClass("rd-navbar--is-touch");
        }
        if (ctx.options.domAppend) {
          ctx.createNav(ctx);
        }
        if (ctx.options.stickUpClone) {
          ctx.createClone(ctx);
        }
        ctx.$element.addClass('rd-navbar-original');
        ctx.addAdditionalClassToToggles('.rd-navbar-original', 'toggle-original', 'toggle-original-elements');
        ctx.applyHandlers(ctx);
        ctx.offset = ctx.$element.offset().top;
        ctx.height = ctx.$element.outerHeight();
        ctx.loaded = true;
        return ctx;
      };


      /**
       * Changes {ctx.$element} layout basing on screen resolution
       * @protected
       */

      RDNavbar.prototype.resize = function(ctx, e) {
        var targetElement, targetLayout;
        targetLayout = isTouch ? ctx.getOption('deviceLayout') : ctx.getOption('layout');
        targetElement = ctx.$element.add(ctx.$clone);
        if (targetLayout !== ctx.currentLayout || !ctx.loaded) {
          ctx.switchClass(targetElement, ctx.currentLayout, targetLayout);
          if (ctx.options.linkedElements != null) {
            $.grep(ctx.options.linkedElements, function(link, index) {
              return ctx.switchClass(link, ctx.currentLayout + '-linked', targetLayout + '-linked');
            });
          }
          ctx.currentLayout = targetLayout;
        }
        ctx.focusOnHover = ctx.getOption('focusOnHover');
        return ctx;
      };


      /**
       * Toggles bar stickup on scroll
       * @protected
       */

      RDNavbar.prototype.stickUp = function(ctx, e) {
        var scrollTop, stickUp, stickUpOffset, targetElement, threshold;
        stickUp = ctx.getOption("stickUp");
        if ($('html').hasClass('ios') || ctx.$element.hasClass('rd-navbar-fixed')) {
          stickUp = false;
        }
        scrollTop = ctx.$doc.scrollTop();
        targetElement = ctx.$clone != null ? ctx.$clone : ctx.$element;
        stickUpOffset = ctx.getOption('stickUpOffset');
        threshold = (typeof stickUpOffset === 'string' ? (stickUpOffset.indexOf('%') > 0 ? parseFloat(stickUpOffset) * ctx.height / 100 : parseFloat(stickUpOffset)) : stickUpOffset);
        if (stickUp) {
          if ((scrollTop >= threshold && !ctx.isStuck) || (scrollTop < threshold && ctx.isStuck)) {
            ctx.$element.add(ctx.$clone).find('[data-rd-navbar-toggle]').each(function() {
              $.proxy(ctx.closeToggle, this)(ctx, false);
            }).end().find('.rd-navbar-submenu').removeClass('opened').removeClass('focus');
            if (scrollTop >= threshold && !ctx.isStuck && !ctx.$element.hasClass('rd-navbar-fixed')) {
              if (ctx.options.callbacks.onStuck) {
                ctx.options.callbacks.onStuck.call(ctx);
              }


              setTimeout(function(){
                if (e.type === 'resize') {
                  ctx.switchClass(targetElement, '', 'rd-navbar--is-stuck');
                } else {
                  targetElement.addClass('rd-navbar--is-stuck');
                }
                ctx.isStuck = true;
              }, navigator.platform.match(/(Mac)/i) ? 10 : 0);

            } else {
              if (e.type === 'resize') {
                ctx.switchClass(targetElement, 'rd-navbar--is-stuck', '');
              } else {
                targetElement.removeClass('rd-navbar--is-stuck').one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', $.proxy(ctx.resizeWrap, ctx, e));
              }
              ctx.isStuck = false;
              if (ctx.options.callbacks.onUnstuck) {
                ctx.options.callbacks.onUnstuck.call(ctx);
              }
            }
          }
        } else {
          /*ctx.$element.find('.rd-navbar-submenu').removeClass('opened').removeClass('focus');
          if (ctx.isStuck) {
            ctx.switchClass(targetElement, 'rd-navbar--is-stuck', '');
            ctx.isStuck = false;
            ctx.resizeWrap(e);
          }*/
        }
        return ctx;
      };


      /**
       * Resizes an external wrap of navbar
       * @protected
       */

      RDNavbar.prototype.resizeWrap = function(e) {
        var $wrap, ctx;
        ctx = this;
        if ((ctx.$clone == null) && !ctx.isStuck) {
          $wrap = ctx.$element.parent();
          if (!ctx.getOption('autoHeight')) {
            $wrap.css('height', 'auto');
            return;
          }
          ctx.height = ctx.$element.outerHeight();
          if (e.type === 'resize') {
            $wrap.addClass('rd-navbar--no-transition').css('height', ctx.height);
            $wrap[0].offsetHeight;
            return $wrap.removeClass('rd-navbar--no-transition');
          } else {
            return $wrap.css('height', ctx.height);
          }
        }
      };


      /**
       * Creates additional DOM for navigation functionality
       * @protected
       */

      RDNavbar.prototype.createNav = function(ctx) {
        ctx.$element.find('.rd-navbar-dropdown, .rd-navbar-megamenu').each(function() {
          var $this, rect;
          $this = $(this);
          rect = this.getBoundingClientRect();
          if ($this.hasClass('rd-navbar-megamenu')) {
            return $this.parent().addClass('rd-navbar--has-megamenu');
          } else {
            return $this.parent().addClass('rd-navbar--has-dropdown');
          }
        }).parents("li").addClass("rd-navbar-submenu");
        $('<span class="rd-navbar-submenu-toggle"></span>').insertAfter('.rd-navbar-nav li.rd-navbar-submenu > a');
        if (ctx.options.callbacks.onDomAppend) {
          ctx.options.callbacks.onDomAppend.call(this);
        }
        return ctx;
      };


      /**
       * Creates navbar clone to stick up
       * @protected
       */

      RDNavbar.prototype.createClone = function(ctx) {
        ctx.$clone = ctx.$element.clone().insertAfter(ctx.$element).addClass('rd-navbar--is-clone');
        ctx.addAdditionalClassToToggles('.rd-navbar--is-clone', 'toggle-cloned', 'toggle-cloned-elements');
        return ctx;
      };


      /**
       * Closes all toggles on outside click of each item
       * @protected
       */

      RDNavbar.prototype.closeToggle = function(ctx, e) {
        var $items, $target, additionalToggleElClass, additionalToogleClass, collapse, linkedElements, needClose;
        $target = $(e.target);
        collapse = false;
        linkedElements = this.getAttribute('data-rd-navbar-toggle');
        if (ctx.options.stickUpClone && ctx.isStuck) {
          additionalToogleClass = '.toggle-cloned';
          additionalToggleElClass = '.toggle-cloned-elements';
          needClose = !$target.hasClass('toggle-cloned');
        } else {
          additionalToogleClass = '.toggle-original';
          additionalToggleElClass = '.toggle-original-elements';
          needClose = !$target.hasClass('toggle-original');
        }
        if (e.target !== this && !$target.parents(additionalToogleClass + '[data-rd-navbar-toggle]').length && !$target.parents(additionalToggleElClass).length && linkedElements && needClose) {
          $items = $(this).parents('body').find(linkedElements).add($(this).parents('.rd-navbar')[0]);
          $items.each(function() {
            if (!collapse) {
              return collapse = (e.target === this || $.contains(this, e.target)) === true;
            }
          });
          if (!collapse) {
            $items.add(this).removeClass('active');
            if (ctx.options.callbacks.onToggleClose) {
              ctx.options.callbacks.onToggleClose.call(this, ctx);
            }
          }
        }
        return this;
      };


      /**
       * Switches toggle
       * @protected
       */

      RDNavbar.prototype.switchToggle = function(ctx, e) {
        var additionalToggleElClass, linkedElements, navbarClass;
        e.preventDefault();
        if ($(this).hasClass('toggle-cloned')) {
          navbarClass = '.rd-navbar--is-clone';
          additionalToggleElClass = '.toggle-cloned-elements';
        } else {
          navbarClass = '.rd-navbar-original';
          additionalToggleElClass = '.toggle-original-elements';
        }
        if (linkedElements = this.getAttribute('data-rd-navbar-toggle')) {
          $(navbarClass + ' [data-rd-navbar-toggle]').not(this).each(function() {
            var deactivateElements;
            if (deactivateElements = this.getAttribute('data-rd-navbar-toggle')) {
              return $(this).parents('body').find(navbarClass + ' ' + deactivateElements + additionalToggleElClass).add(this).add($.inArray('.rd-navbar', deactivateElements.split(/\s*,\s*/i)) > -1 ? $(this).parents('body')[0] : false).removeClass('active');
            }
          });
          $(this).parents('body').find(navbarClass + ' ' + linkedElements + additionalToggleElClass).add(this).add($.inArray('.rd-navbar', linkedElements.split(/\s*,\s*/i)) > -1 ? $(this).parents('.rd-navbar')[0] : false).toggleClass('active');
        }
        if (ctx.options.callbacks.onToggleSwitch) {
          ctx.options.callbacks.onToggleSwitch.call(this, ctx);
        }
        return this;
      };


      /**
       * Triggers submenu popup to be shown on mouseover
       * @protected
       */

      RDNavbar.prototype.dropdownOver = function(ctx, timer) {
        var $this;
        if (ctx.focusOnHover) {
          $this = $(this);
          clearTimeout(timer);
          if (ctx.options.callbacks.onDropdownOver) {
            if (!ctx.options.callbacks.onDropdownOver.call(this, ctx)){
              return this;
            }
          }

          $this.addClass('focus').siblings().removeClass('opened').each(ctx.dropdownUnfocus);
        }
        return this;
      };


      /**
       * Triggers submenu popup to be shown on mouseover
       * @protected
       */

      RDNavbar.prototype.dropdownTouch = function(ctx, timer) {
        var $this, hasFocus;
        $this = $(this);
        clearTimeout(timer);
        if (ctx.focusOnHover) {
          hasFocus = false;
          if ($this.hasClass('focus')) {
            hasFocus = true;
          }
          if (!hasFocus) {
            $this.addClass('focus').siblings().removeClass('opened').each(ctx.dropdownUnfocus);
            return false;
          }
          if (ctx.options.callbacks.onDropdownOver) {
            ctx.options.callbacks.onDropdownOver.call(this, ctx);
          }
        }
        return this;
      };


      /**
       * Triggers submenu popop to be hidden on mouseout
       * @protected
       */

      RDNavbar.prototype.dropdownOut = function(ctx, timer) {
        var $this;
        if (ctx.focusOnHover) {
          $this = $(this);
          $this.one('mouseenter.navbar', function() {
            return clearTimeout(timer);
          });

          if (ctx.options.callbacks.onDropdownOut) {
            ctx.options.callbacks.onDropdownOut.call(this, ctx);
          }
          clearTimeout(timer);

          timer = setTimeout($.proxy(ctx.dropdownUnfocus, this, ctx), ctx.options.focusOnHoverTimeout);
        }
        return this;
      };


      /**
       * Removes a focus from submenu
       * @protected
       */

      RDNavbar.prototype.dropdownUnfocus = function(ctx) {
        var $this;
        $this = $(this);
        $this.find('li.focus').add(this).removeClass('focus');
        return this;
      };


      /**
       * Closes submenu
       * @protected
       */

      RDNavbar.prototype.dropdownClose = function(ctx, e) {
        var $this;
        if (e.target !== this && !$(e.target).parents('.rd-navbar-submenu').length) {
          $this = $(this);
          $this.find('li.focus').add(this).removeClass('focus').removeClass('opened');
          if (ctx.options.callbacks.onDropdownClose) {
            ctx.options.callbacks.onDropdownClose.call(this, ctx);
          }
        }
        return this;
      };


      /**
       * Toggles submenu popup to be shown on trigger click
       * @protected
       */

      RDNavbar.prototype.dropdownToggle = function(ctx) {
        $(this).toggleClass('opened').siblings().removeClass('opened');
        if (ctx.options.callbacks.onDropdownToggle) {
          ctx.options.callbacks.onDropdownToggle.call(this, ctx);
        }
        return this;
      };


      /**
       * Scrolls the page to triggered anchor
       * @protected
       */

      RDNavbar.prototype.goToAnchor = function(ctx, e) {
        var $anchor, hash;
        hash = this.hash;
        $anchor = $(hash);

        if (!ctx.getOption('anchorNav')){
          return false;
        }

        if ($anchor.length) {
          e.preventDefault();
          $('html, body').stop().animate({
            'scrollTop': $anchor.offset().top + ctx.getOption('anchorNavOffset') + 1
          }, ctx.getOption('anchorNavSpeed'), ctx.getOption('anchorNavEasing'), function() {
            return ctx.changeAnchor(hash);
          });
        }
        return this;
      };


      /**
       * Highlight an active anchor
       * @protected
       */

      RDNavbar.prototype.activateAnchor = function(e) {
        var $anchor, $item, $link, ctx, docHeight, hash, i, link, links, navOffset, scrollTop, winHeight;
        ctx = this;
        scrollTop = ctx.$doc.scrollTop();
        winHeight = ctx.$win.height();
        docHeight = ctx.$doc.height();
        navOffset = ctx.getOption('anchorNavOffset');

        if (!ctx.options.anchorNav){
          return false;
        }

        if (scrollTop + winHeight > docHeight - 50) {
          $anchor = $('[data-type="anchor"]').last();
          if ($anchor.length) {
            if ($anchor.offset().top >= scrollTop) {
              hash = '#' + $anchor.attr("id");
              $item = $('.rd-navbar-nav a[href^="' + hash + '"]').parent();
              if (!$item.hasClass('active')) {
                $item.addClass('active').siblings().removeClass('active');
                if (ctx.options.callbacks.onAnchorChange) {
                  ctx.options.callbacks.onAnchorChange.call($anchor[0], ctx);
                }
              }
            }
          }
          return $anchor;
        } else {
          links = $('.rd-navbar-nav a[href^="#"]').get();
          for (i in links) {
            link = links[i];
            $link = $(link);
            hash = $link.attr('href');
            $anchor = $(hash);
            if ($anchor.length) {
              if ($anchor.offset().top + navOffset <= scrollTop && $anchor.offset().top + $anchor.outerHeight() > scrollTop) {
                $link.parent().addClass('active').siblings().removeClass('active');
                if (ctx.options.callbacks.onAnchorChange) {
                  ctx.options.callbacks.onAnchorChange.call($anchor[0], ctx);
                }
              }
            }
          }
        }
        return null;
      };


      /**
       * Returns current anchor
       * @protected
       */

      RDNavbar.prototype.getAnchor = function() {
        if (history) {
          if (history.state) {
            return history.state.id;
          }
        }
        return null;
      };


      /**
       * Changes current page anchor
       * @protected
       */

      RDNavbar.prototype.changeAnchor = function(hash) {
        if (history) {
          if (history.state) {
            if (history.state.id !== hash) {
              history.replaceState({
                'anchorId': hash
              }, null, hash);
            } else {
              history.pushState({
                'anchorId': hash
              }, null, hash);
            }
          } else {
            history.pushState({
              'anchorId': hash
            }, null, hash);
          }
        }
        return this;
      };


      /**
       * Applies all JS event handlers
       * @protected
       */

      RDNavbar.prototype.applyHandlers = function(ctx) {
        if (ctx.options.responsive != null) {
          ctx.$win.on('resize.navbar', $.proxy(ctx.resize, ctx.$win[0], ctx)).on('resize.navbar', $.proxy(ctx.resizeWrap, ctx)).on('resize.navbar', $.proxy(ctx.stickUp, (ctx.$clone != null ? ctx.$clone : ctx.$element), ctx)).on('orientationchange.navbar', $.proxy(ctx.resize, ctx.$win[0], ctx)).trigger('resize.navbar');
        }
        ctx.$doc.on('scroll.navbar', $.proxy(ctx.stickUp, (ctx.$clone != null ? ctx.$clone : ctx.$element), ctx)).on('scroll.navbar', $.proxy(ctx.activateAnchor, ctx));
        ctx.$element.add(ctx.$clone).find('[data-rd-navbar-toggle]').each(function() {
          var $this;
          $this = $(this);
          $this.on('click', $.proxy(ctx.switchToggle, this, ctx));
          return $this.parents('body').on('click', $.proxy(ctx.closeToggle, this, ctx));
        });
        ctx.$element.add(ctx.$clone).find('.rd-navbar-submenu').each(function() {
          var $this, timer;
          $this = $(this);
          timer = $this.parents(".rd-navbar--is-clone").length ? ctx.cloneTimer : ctx.focusTimer;
          $this.on('mouseleave.navbar', $.proxy(ctx.dropdownOut, this, ctx, timer));
          $this.find('> a').on('mouseenter.navbar', $.proxy(ctx.dropdownOver, this, ctx, timer));
          $this.find('> a').on('touchstart.navbar', $.proxy(ctx.dropdownTouch, this, ctx, timer));
          $this.find('> .rd-navbar-submenu-toggle').on('click', $.proxy(ctx.dropdownToggle, this, ctx));
          return $this.parents('body').on('click', $.proxy(ctx.dropdownClose, this, ctx));
        });
        ctx.$element.add(ctx.$clone).find('.rd-navbar-nav a[href^="#"]').each(function() {
          return $(this).on('click', $.proxy(ctx.goToAnchor, this, ctx));
        });

        ctx.$element.find('.rd-navbar-dropdown, .rd-navbar-megamenu').each(function() {
          var $this, rect;
          $this = $(this);
          rect = this.getBoundingClientRect();
          if ((rect.left + $this.outerWidth()) >= window.innerWidth - 10) {
            this.className += ' rd-navbar-open-left';
          } else if ((rect.left - $this.outerWidth()) <= 10) {
            this.className += ' rd-navbar-open-right';
          }
        });

        return ctx;
      };


      /**
       * Switches classes of elements without transition
       * @protected
       */

      RDNavbar.prototype.switchClass = function(element, before, after) {
        var obj;
        obj = element instanceof jQuery ? element : $(element);
        obj.addClass('rd-navbar--no-transition').removeClass(before).addClass(after);
        obj[0].offsetHeight;
        return obj.removeClass('rd-navbar--no-transition');
      };


      /**
       * Gets specific option of plugin
       * @protected
       */

      RDNavbar.prototype.getOption = function(key) {
        var point, targetPoint;
        for (point in this.options.responsive) {
          if (point <= window.innerWidth) {
            targetPoint = point;
          }
        }
        if ((this.options.responsive != null) && (this.options.responsive[targetPoint][key] != null)) {
          return this.options.responsive[targetPoint][key];
        } else {
          return this.options[key];
        }
      };


      /**
       * Add additional class to navbar toggles to identify it when navbar is cloned
       * @protected
       */

      RDNavbar.prototype.addAdditionalClassToToggles = function(navbarClass, toggleAdditionalClass, toggleElAdditionalClass) {
        return $(navbarClass).find('[data-rd-navbar-toggle]').each(function() {
          var toggleElement;
          $(this).addClass(toggleAdditionalClass);
          toggleElement = this.getAttribute('data-rd-navbar-toggle');
          return $(this).parents('body').find(navbarClass).find(toggleElement).addClass(toggleElAdditionalClass);
        });
      };

      return RDNavbar;

    })();

    /**
     * The jQuery Plugin for the RD Navbar
     * @public
     */
    $.fn.extend({
      RDNavbar: function(options) {
        var $this;
        $this = $(this);
        if (!$this.data('RDNavbar')) {
          return $this.data('RDNavbar', new RDNavbar(this, options));
        }
      }

      /**
       * RD Navbar window export
       * @public
       */
    });
    return window.RDNavbar = RDNavbar;
  })(window.jQuery, document, window);


  /**
   * The Plugin AMD export
   * @public
   */

  if (typeof module !== "undefined" && module !== null) {
    module.exports = window.RDNavbar;
  } else if (typeof define === 'function' && define.amd) {
    define(["jquery"], function() {
      'use strict';
      return window.RDNavbar;
    });
  }

}).call(this);

/*! npm.im/object-fit-images 3.2.3 */
var objectFitImages=function(){"use strict";function t(t,e){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='"+t+"' height='"+e+"'%3E%3C/svg%3E"}function e(t){if(t.srcset&&!m&&window.picturefill){var e=window.picturefill._;t[e.ns]&&t[e.ns].evaled||e.fillImg(t,{reselect:!0}),t[e.ns].curSrc||(t[e.ns].supported=!1,e.fillImg(t,{reselect:!0})),t.currentSrc=t[e.ns].curSrc||t.src}}function i(t){for(var e,i=getComputedStyle(t).fontFamily,r={};null!==(e=l.exec(i));)r[e[1]]=e[2];return r}function r(e,i,r){var n=t(i||1,r||0);p.call(e,"src")!==n&&b.call(e,"src",n)}function n(t,e){t.naturalWidth?e(t):setTimeout(n,100,t,e)}function c(t){var c=i(t),o=t[a];if(c["object-fit"]=c["object-fit"]||"fill",!o.img){if("fill"===c["object-fit"])return;if(!o.skipTest&&g&&!c["object-position"])return}if(!o.img){o.img=new Image(t.width,t.height),o.img.srcset=p.call(t,"data-ofi-srcset")||t.srcset,o.img.src=p.call(t,"data-ofi-src")||t.src,b.call(t,"data-ofi-src",t.src),t.srcset&&b.call(t,"data-ofi-srcset",t.srcset),r(t,t.naturalWidth||t.width,t.naturalHeight||t.height),t.srcset&&(t.srcset="");try{s(t)}catch(t){window.console&&console.warn("https://bit.ly/ofi-old-browser")}}e(o.img),t.style.backgroundImage='url("'+(o.img.currentSrc||o.img.src).replace(/"/g,'\\"')+'")',t.style.backgroundPosition=c["object-position"]||"center",t.style.backgroundRepeat="no-repeat",t.style.backgroundOrigin="content-box",/scale-down/.test(c["object-fit"])?n(o.img,function(){o.img.naturalWidth>t.width||o.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=c["object-fit"].replace("none","auto").replace("fill","100% 100%"),n(o.img,function(e){r(t,e.naturalWidth,e.naturalHeight)})}function s(t){var e={get:function(e){return t[a].img[e||"src"]},set:function(e,i){return t[a].img[i||"src"]=e,b.call(t,"data-ofi-"+i,e),c(t),e}};Object.defineProperty(t,"src",e),Object.defineProperty(t,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(t,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}function o(t,e){var i=!h&&!t;if(e=e||{},t=t||"img",f&&!e.skipTest||!d)return!1;"img"===t?t=document.getElementsByTagName("img"):"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var r=0;r<t.length;r++)t[r][a]=t[r][a]||{skipTest:e.skipTest},c(t[r]);i&&(document.body.addEventListener("load",function(t){"IMG"===t.target.tagName&&o(t.target,{skipTest:e.skipTest})},!0),h=!0,t="img"),e.watchMQ&&window.addEventListener("resize",o.bind(null,t,{skipTest:e.skipTest}))}var a="bfred-it:object-fit-images",l=/(object-fit|object-position)\s*:\s*([-\w\s%]+)/g,u="undefined"==typeof Image?{style:{"object-position":1}}:new Image,g="object-fit"in u.style,f="object-position"in u.style,d="background-size"in u.style,m="string"==typeof u.currentSrc,p=u.getAttribute,b=u.setAttribute,h=!1;return o.supportsObjectFit=g,o.supportsObjectPosition=f,function(){function t(t,e){return t[a]&&t[a].img&&("src"===e||"srcset"===e)?t[a].img:t}f||(HTMLImageElement.prototype.getAttribute=function(e){return p.call(t(this,e),e)},HTMLImageElement.prototype.setAttribute=function(e,i){return b.call(t(this,e),e,String(i))})}(),o}();

/**
 * Owl Carousel v2.3.4
 * Copyright 2013-2018 David Deutsch
 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
 */
!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},a.each(["onResize","onThrottledResize"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",slideTransition:"",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Type={Event:"event",State:"state"},e.Plugins={},e.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(a){var b=this.settings.margin||"",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:"auto","margin-left":d?b:"","margin-right":d?"":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:["width","items","settings"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:["items","settings"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h="",i="";for(g/=2;g>0;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i,g-=1;this._clones=b,a(h).addClass("cloned").appendTo(this.$stage),a(i).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:["width","items","settings"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,"padding-left":a||"","padding-right":a||""};this.$stage.css(c)}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;c<d;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass("active"),this.$stage.children(".center").removeClass("center"),this.settings.center&&this.$stage.children().eq(this.current()).addClass("center")}}],e.prototype.initializeStage=function(){this.$stage=this.$element.find("."+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=a("<"+this.settings.stageElement+">",{class:this.settings.stageClass}).wrap(a("<div/>",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},e.prototype.initializeItems=function(){var b=this.$element.find(".owl-item");if(b.length)return this._items=b.get().map(function(b){return a(b)}),this._mergers=this._items.map(function(){return 1}),void this.refresh();this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},e.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading")){var a,b,c;a=this.$element.find("img"),b=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,c=this.$element.children(b).width(),a.length&&c<=0&&this.preloadAutoWidthImages(a)}this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},e.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(":visible")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){a<=b&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),"function"==typeof e.stagePadding&&(e.stagePadding=e.stagePadding()),delete e.responsive,e.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+d))):e=a.extend({},this.options),this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},e.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};b<c;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={},!this.is("valid")&&this.enter("valid")},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.isVisible()&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},e.prototype.registerEventHandlers=function(){a.support.transition&&this.$stage.on(a.support.transition.end+".owl.core",a.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&&this.on(b,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",a.proxy(this.onDragEnd,this)))},e.prototype.onDragStart=function(b){var d=null;3!==b.which&&(a.support.transform?(d=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","),d={x:d[16===d.length?12:4],y:d[16===d.length?13:5]}):(d=this.$stage.position(),d={x:this.settings.rtl?d.left+this.$stage.width()-this.width()+this.settings.margin:d.left,y:d.top}),this.is("animating")&&(a.support.transform?this.animate(d.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===b.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=a(b.target),this._drag.stage.start=d,this._drag.stage.current=d,this._drag.pointer=this.pointer(b),a(c).on("mouseup.owl.core touchend.owl.core",a.proxy(this.onDragEnd,this)),a(c).one("mousemove.owl.core touchmove.owl.core",a.proxy(function(b){var d=this.difference(this._drag.pointer,this.pointer(b));a(c).on("mousemove.owl.core touchmove.owl.core",a.proxy(this.onDragMove,this)),Math.abs(d.x)<Math.abs(d.y)&&this.is("valid")||(b.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},e.prototype.onDragMove=function(a){var b=null,c=null,d=null,e=this.difference(this._drag.pointer,this.pointer(a)),f=this.difference(this._drag.stage.start,e);this.is("dragging")&&(a.preventDefault(),this.settings.loop?(b=this.coordinates(this.minimum()),c=this.coordinates(this.maximum()+1)-b,f.x=((f.x-b)%c+c)%c+b):(b=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),c=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),d=this.settings.pullDrag?-1*e.x/5:0,f.x=Math.max(Math.min(f.x,b+d),c+d)),this._drag.stage.current=f,this.animate(f.x))},e.prototype.onDragEnd=function(b){var d=this.difference(this._drag.pointer,this.pointer(b)),e=this._drag.stage.current,f=d.x>0^this.settings.rtl?"left":"right";a(c).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==d.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==d.x?f:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=f,(Math.abs(d.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},e.prototype.closest=function(b,c){var e=-1,f=30,g=this.width(),h=this.coordinates();return this.settings.freeDrag||a.each(h,a.proxy(function(a,i){return"left"===c&&b>i-f&&b<i+f?e=a:"right"===c&&b>i-g-f&&b<i-g+f?e=a+1:this.op(b,"<",i)&&this.op(b,">",h[a+1]!==d?h[a+1]:i-g)&&(e="left"===c?a+1:a),-1===e},this)),this.settings.loop||(this.op(b,">",h[this.minimum()])?e=b=this.minimum():this.op(b,"<",h[this.maximum()])&&(e=b=this.maximum())),e},e.prototype.animate=function(b){var c=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),c&&(this.enter("animating"),this.trigger("translate")),a.support.transform3d&&a.support.transition?this.$stage.css({transform:"translate3d("+b+"px,0px,0px)",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")}):c?this.$stage.animate({left:b+"px"},this.speed(),this.settings.fallbackEasing,a.proxy(this.onTransitionEnd,this)):this.$stage.css({left:b+"px"})},e.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(b){return"string"===a.type(b)&&(this._invalidated[b]=!0,this.is("valid")&&this.leave("valid")),a.map(this._invalidated,function(a,b){return b})},e.prototype.reset=function(a){(a=this.normalize(a))!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(a,b){var c=this._items.length,e=b?0:this._clones.length;return!this.isNumeric(a)||c<1?a=d:(a<0||a>=c+e)&&(a=((a-e/2)%c+c)%c+e/2),a},e.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=this.settings,f=this._coordinates.length;if(e.loop)f=this._clones.length/2+this._items.length-1;else if(e.autoWidth||e.merge){if(b=this._items.length)for(c=this._items[--b].width(),d=this.$element.width();b--&&!((c+=this._items[b].width()+this.settings.margin)>d););f=b+1}else f=e.center?this._items.length-1:this._items.length-e.items;return a&&(f-=this._clones.length/2),Math.max(f,0)},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2==0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c,e=1,f=b-1;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(this.settings.rtl&&(e=-1,f=b+1),c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[f]||0))/2*e):c=this._coordinates[f]||0,c=Math.ceil(c))},e.prototype.duration=function(a,b,c){return 0===c?0:Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(a,b){var c=this.current(),d=null,e=a-this.relative(c),f=(e>0)-(e<0),g=this._items.length,h=this.minimum(),i=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(e)>g/2&&(e+=-1*f*g),a=c+e,(d=((a-h)%g+g)%g+h)!==a&&d-e<=i&&d-e>0&&(c=d-e,a=d,this.reset(c))):this.settings.rewind?(i+=1,a=(a%i+i)%i):a=Math.max(h,Math.min(i,a)),this.speed(this.duration(c,a,b)),this.current(a),this.isVisible()&&this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.onTransitionEnd=function(a){if(a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},e.prototype.viewport=function(){var d;return this.options.responsiveBaseElement!==b?d=a(this.options.responsiveBaseElement).width():b.innerWidth?d=b.innerWidth:c.documentElement&&c.documentElement.clientWidth?d=c.documentElement.clientWidth:console.warn("Can not detect viewport width."),d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(b,c){var e=this.relative(this._current);c=c===d?this._items.length:this.normalize(c,!0),b=b instanceof jQuery?b:a(b),this.trigger("add",{content:b,position:c}),b=this.prepare(b),0===this._items.length||c===this._items.length?(0===this._items.length&&this.$stage.append(b),0!==this._items.length&&this._items[c-1].after(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[c].before(b),this._items.splice(c,0,b),this._mergers.splice(c,0,1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[e]&&this.reset(this._items[e].index()),this.invalidate("items"),this.trigger("added",{content:b,position:c})},e.prototype.remove=function(a){(a=this.normalize(a,!0))!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.preloadAutoWidthImages=function(b){b.each(a.proxy(function(b,c){this.enter("pre-loading"),c=a(c),a(new Image).one("load",a.proxy(function(a){c.attr("src",a.target.src),c.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",c.attr("src")||c.attr("data-src")||c.attr("data-src-retina"))},this))},e.prototype.destroy=function(){this.$element.off(".owl.core"),this.$stage.off(".owl.core"),a(c).off(".owl.core"),!1!==this.settings.responsive&&(b.clearTimeout(this.resizeTimer),this.off(b,"resize",this._handlers.onThrottledResize));for(var d in this._plugins)this._plugins[d].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:a<c;case">":return d?a<c:a>c;case">=":return d?a<=c:a>=c;case"<=":return d?a>=c:a<=c}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d,f,g){var h={item:{count:this._items.length,index:this.current()}},i=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),j=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},h,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(j)}),this.register({type:e.Type.Event,name:b}),this.$element.trigger(j),this.settings&&"function"==typeof this.settings[i]&&this.settings[i].call(this,j)),j},e.prototype.enter=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]===d&&(this._states.current[b]=0),this._states.current[b]++},this))},e.prototype.leave=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]--},this))},e.prototype.register=function(b){if(b.type===e.Type.Event){if(a.event.special[b.name]||(a.event.special[b.name]={}),!a.event.special[b.name].owl){var c=a.event.special[b.name]._default;a.event.special[b.name]._default=function(a){return!c||!c.apply||a.namespace&&-1!==a.namespace.indexOf("owl")?a.namespace&&a.namespace.indexOf("owl")>-1:c.apply(this,arguments)},a.event.special[b.name].owl=!0}}else b.type===e.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=a.grep(this._states.tags[b.name],a.proxy(function(c,d){return a.inArray(c,this._states.tags[b.name])===d},this)))},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.pointer=function(a){var c={x:null,y:null};return a=a.originalEvent||a||b.event,a=a.touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,a.pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},e.prototype.isNumeric=function(a){return!isNaN(parseFloat(a))},e.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},a.fn.owlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),f=d.data("owl.carousel");f||(f=new e(this,"object"==typeof b&&b),d.data("owl.carousel",f),a.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(b,c){f.register({type:e.Type.Event,name:c}),f.$element.on(c+".owl.carousel.core",a.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([c]),f[c].apply(this,[].slice.call(arguments,1)),this.release([c]))},f))})),"string"==typeof b&&"_"!==b.charAt(0)&&f[b].apply(f,c)})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoRefresh:!0,autoRefreshInterval:500},e.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=b.setInterval(a.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},e.prototype.refresh=function(){this._core.isVisible()!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},e.prototype.destroy=function(){var a,c;b.clearInterval(this._interval);for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoRefresh=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type)){var c=this._core.settings,e=c.center&&Math.ceil(c.items/2)||c.items,f=c.center&&-1*e||0,g=(b.property&&b.property.value!==d?b.property.value:this._core.current())+f,h=this._core.clones().length,i=a.proxy(function(a,b){this.load(b)},this);for(c.lazyLoadEager>0&&(e+=c.lazyLoadEager,c.loop&&(g-=c.lazyLoadEager,e++));f++<e;)this.load(h/2+this._core.relative(g)),h&&a.each(this._core.clones(this._core.relative(g)),i),g++}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={lazyLoad:!1,lazyLoadEager:0},e.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src")||f.attr("data-srcset");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):f.is("source")?f.one("load.owl.lazy",a.proxy(function(){this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("srcset",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":'url("'+g+'")',opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(c){this._core=c,this._previousHeight=null,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&"position"===a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var d=this;a(b).on("load",function(){d._core.settings.autoHeight&&d.update()}),a(b).resize(function(){d._core.settings.autoHeight&&(null!=d._intervalId&&clearTimeout(d._intervalId),d._intervalId=setTimeout(function(){d.update()},250))})};e.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},e.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.settings.lazyLoad,e=this._core.$stage.children().toArray().slice(b,c),f=[],g=0;a.each(e,function(b,c){f.push(a(c).height())}),g=Math.max.apply(null,f),g<=1&&d&&this._previousHeight&&(g=this._previousHeight),this._previousHeight=g,this._core.$stage.parent().height(g).addClass(this._core.settings.autoHeightClass)},e.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"===a.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(".owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};e.Defaults={video:!1,videoHeight:!1,videoWidth:!1},e.prototype.fetch=function(a,b){var c=function(){return a.attr("data-vimeo-id")?"vimeo":a.attr("data-vzaar-id")?"vzaar":"youtube"}(),d=a.attr("data-vimeo-id")||a.attr("data-youtube-id")||a.attr("data-vzaar-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else if(d[3].indexOf("vimeo")>-1)c="vimeo";else{if(!(d[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");c="vzaar"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},e.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?"width:"+c.width+"px;height:"+c.height+"px;":"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(c){e='<div class="owl-video-play-icon"></div>',d=k.lazyLoad?a("<div/>",{class:"owl-video-tn "+j,srcType:c}):a("<div/>",{class:"owl-video-tn",style:"opacity:1;background-image:url("+c+")"}),b.after(d),b.after(e)};if(b.wrap(a("<div/>",{class:"owl-video-wrapper",style:g})),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length)return l(h.attr(i)),h.remove(),!1;"youtube"===c.type?(f="//img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type?a.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}):"vzaar"===c.type&&a.ajax({type:"GET",url:"//vzaar.com/api/videos/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a.framegrab_url,l(f)}})},e.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest("."+this._core.settings.itemClass),f=this._videos[e.attr("data-video")],g=f.width||"100%",h=f.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),c=a('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>'),c.attr("height",h),c.attr("width",g),"youtube"===f.type?c.attr("src","//www.youtube.com/embed/"+f.id+"?autoplay=1&rel=0&v="+f.id):"vimeo"===f.type?c.attr("src","//player.vimeo.com/video/"+f.id+"?autoplay=1"):"vzaar"===f.type&&c.attr("src","//view.vzaar.com/"+f.id+"/player?autoplay=true"),a(c).wrap('<div class="owl-video-frame" />').insertAfter(e.find(".owl-video")),this._playing=e.addClass("owl-video-playing"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass("owl-video-frame")},e.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,
animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g)),f&&e.one(a.support.animation.end,c).addClass("animated owl-animated-in").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={"changed.owl.carousel":a.proxy(function(a){a.namespace&&"settings"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&"position"===a.property.name&&this._paused&&(this._time=0)},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype._next=function(d){this._call=b.setTimeout(a.proxy(this._next,this,d),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is("interacting")||c.hidden||this._core.next(d||this._core.settings.autoplaySpeed)},e.prototype.read=function(){return(new Date).getTime()-this._time},e.prototype.play=function(c,d){var e;this._core.is("rotating")||this._core.enter("rotating"),c=c||this._core.settings.autoplayTimeout,e=Math.min(this._time%(this._timeout||c),c),this._paused?(this._time=this.read(),this._paused=!1):b.clearTimeout(this._call),this._time+=this.read()%c-e,this._timeout=c,this._call=b.setTimeout(a.proxy(this._next,this,d),c-e)},e.prototype.stop=function(){this._core.is("rotating")&&(this._time=0,this._paused=!0,b.clearTimeout(this._call),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&!this._paused&&(this._time=this.read(),this._paused=!0,b.clearTimeout(this._call))},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:['<span aria-label="Previous">&#x2039;</span>','<span aria-label="Next">&#x203a;</span>'],navSpeed:!1,navElement:'button type="button" role="presentation"',navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=a("<"+c.navElement+">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a("<"+c.navElement+">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a('<button role="button">').addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","button",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d,e;e=this._core.settings;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)"$relative"===b&&e.navContainer?this._controls[b].html(""):this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if("page"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||"page"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;a<e;a++){if(b>=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length<=c.items,e=this._core.relative(this._core.current()),f=c.loop||c.rewind;this._controls.$relative.toggleClass("disabled",!c.nav||d),c.nav&&(this._controls.$previous.toggleClass("disabled",!f&&e<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!f&&e>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b<0&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(a.inArray(this.current(),this._pages)).addClass("active"))},e.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotsData?1:c.dotsEach||c.items)}},e.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,a.proxy(function(a,c){return a.start<=b&&a.end>=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;!d&&this._pages.length?(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c)):a.proxy(this._overrides.to,this._core)(b,c)},a.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":a.proxy(function(c){c.namespace&&"URLHash"===this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!c)return;this._hashes[c]=b.content}},this),"changed.owl.carousel":a.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+" "+h.join(f+" ")+f).split(" "),function(a,b){if(g[b]!==d)return e=!c||b,!1}),e}function f(a){return e(a,!0)}var g=a("<support>").get(0).style,h="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},j={csstransforms:function(){return!!e("transform")},csstransforms3d:function(){return!!e("perspective")},csstransitions:function(){return!!e("transition")},cssanimations:function(){return!!e("animation")}};j.csstransitions()&&(a.support.transition=new String(f("transition")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f("animation")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f("transform")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document);
(function(e){e.cookie=function(o,n,i){if(arguments.length>1&&(!/Object/.test(Object.prototype.toString.call(n))||null==n)){if(i=e.extend({},i),null==n&&(i.expires=-1),"number"==typeof i.expires){var t=i.expires,r=i.expires=new Date;r.setDate(r.getDate()+t)}return n=String(n),document.cookie=[encodeURIComponent(o),"=",i.raw?n:encodeURIComponent(n),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}i=n||{};for(var s,a=i.raw?function(e){return e}:decodeURIComponent,c=document.cookie.split("; "),u=0;s=c[u]&&c[u].split("=");u++)if(a(s[0])===o)return a(s[1]||"");return null},e.fn.cookieBar=function(o){var n=e.extend({closeButton:"none",hideOnClose:!0,secure:!1,path:"/",domain:"",name:"cookiebar",expiresDays:365},o);return this.each(function(){var o=e(this);o.hide(),"none"==n.closeButton&&(o.append('<a class="cookiebar-close">Continue</a>'),e.extend(n,{closeButton:".cookiebar-close"})),"hide"!=e.cookie(n.name)&&o.show(),o.find(n.closeButton).click(function(){return n.hideOnClose&&o.hide(),e.cookie(n.name,"hide",{path:n.path,secure:n.secure,domain:n.domain,expires:n.expiresDays}),o.trigger("cookieBar-close"),!1})})},e.cookieBar=function(o){e("body").prepend('<div class="ui-widget"><div style="display: none;" class="cookie-message ui-widget-header blue"><p>By using this website you allow us to place cookies on your computer. They are harmless and never personally identify you.</p></div></div>'),e(".cookie-message").cookieBar(o)}})(jQuery);
jQuery(function($){
	if(typeof  $.datepicker !== 'undefined') { 
        $.datepicker.regional['de'] = {clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
                closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
                prevText: '<zurück', prevStatus: 'letzten Monat zeigen',
                nextText: 'Vor>', nextStatus: 'nächsten Monat zeigen',
                currentText: 'heute', currentStatus: '',
                monthNames: ['Januar','Februar','März','April','Mai','Juni',
                'Juli','August','September','Oktober','November','Dezember'],
                monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
                'Jul','Aug','Sep','Okt','Nov','Dez'],
                monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
                weekHeader: 'Wo', weekStatus: 'Woche des Monats',
                dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
                dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
                dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
                dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
                dateFormat: 'dd.mm.yy', firstDay: 1, 
                initStatus: 'Wähle ein Datum', isRTL: false};
        $.datepicker.setDefaults($.datepicker.regional['de']);

     }
});

//jwplayer.key="Q/jwET2CX9onJC/QN7y8Wy3ICHzfhFFCj8YgaVwqpyA=";

jwplayer.key="a1BRKiCjiGqc5ZJ4qdqBCxnAC8d/jEHJm8V7EIdfOoA=";
/***********************************************************************************
	GLOBALS
***********************************************************************************/
var oGlobals											= {
	sLanguage:						$('html').attr('lang').split('-')[0],
	cacheJQueryObjects:				function() {
		oWindow.$										= $(window);
		oBody.$											= $('body');
		oBody.$wrap										= $('html, body, .body-wrap');
		oAccordions.$									= $('.accordion').children('.accordionToggle');
		oUmantis.$										= $('#umantis_iframe');
		oGoogleMaps.$ 									= $('.mapcontent');
		oShare.$ 										= $('#share-container');
		oEventApplicationForm.$ 						= $('form#eventapplicationform');
		oNewsletterForm.$								= $('#newsletterform');
		oReferenceSearch.$ 								= $('#reference-search-form');
		oMediareleaseSearch.$ 							= $('#mediarelease-search-form');
		oIndexedSearch.$								= $('#tx_indexedsearch');
		oContentSlider.$slider 							= $('.contentslider');
		oContentImageSlider.$slider 					= $('.contentimageslider');
		oToolTips.$ 									= $('.tooltip');
		oFileUpload.$ 									= $('.inputfile');
		oPodCast.$ 										= $('.podcastitem');
		oSearchWord.$ 									= $('.csc-sword');
		oNavBar.$ 										= $('.rd-navbar');
		oSideBar.$ 										= $('#sidebarnavigation');
		oObjectFitImage.$ 								= $('img.ofi');
		oAnchorNavigation.$ 							= $('#anchornavigation');
		oAnchorTop.$ 									= $('#jumptotop');
		oOwlCarousel.$ 									= $('.owl-carousel');
		oHomestage.$ 									= $('#homestage');
		oMapSupplyArea.$ 								= $('#map-supplyarea');
		oMapDecommissioningGasNetwork.$					= $('#map-decommissioning-gas-network');
		oSwiftypeSearch.$ 								= $('#swiftype-search');
		oStageVideo.$									= $('#stagevideo');
	},
	init:							function() {
		oWindow.init();
		
		oUmantis.init();
		oGoogleMaps.init();
		oFileUpload.init();

		$('.tooltipIcon').bind('click', function(e) {
			e.preventDefault();
			return false;
		});

		if(!oBody.$.hasClass('darksite')) {
			oShare.init();
		}

		oEventApplicationForm.init();
		oReferenceSearch.init();
		oMediareleaseSearch.init();
		oIndexedSearch.init();
		oContentSlider.init();
		oContentImageSlider.init();
		oSearchWord.init();
		
		oAnchorTop.init();


		if(oStageVideo.$.length){
			oStageVideo.init();
		}

		if(oPodCast.$.length){
			oPodCast.init();
		}

		if(oNavBar.$.length){
			oNavBar.init();
		}

		if(oSideBar.$.length){
			oSideBar.init();
		}

		if(oObjectFitImage.$.length){
			oObjectFitImage.init();
		}

		if(oOwlCarousel.$.length){
			oOwlCarousel.init();
		}

		if(oHomestage.$.length){
			oHomestage.init();
		}

		if(oMapSupplyArea.$.length){
			oMapSupplyArea.init();
		}

		if(oMapDecommissioningGasNetwork.$.length){
			oMapDecommissioningGasNetwork.init();
		}
		if(oSwiftypeSearch.$.length){
			oSwiftypeSearch.init();
		}

		oBody.$.bind('touchstart', function(e){});
		oWindow.$.bind('resize', function(){
			oWindow.resize();
		});

		oWindow.$.bind('load', function(){
			oWindow.loaded();
		});

		oNewsletterForm.init();
	},
	oResponsiveHelper								: $.fn.responsivehelper({
		showWindowSize:  false,
		showHeight: false,
		showGrid:  (document.location.hostname == 'stage.energie360.ch'),
		positionY: 'bottom',
		onBreakpointChange: function() {
		}
	})
};

/***********************************************************************************
	WINDOW
***********************************************************************************/
var oWindow												= {
	$:				null,
	iCurrentScrollTop: 0,
	init: function() {
		oWindow.iCurrentScrollTop = oWindow.$.scrollTop();
		oWindow.$.bind('scroll', function() {
			oWindow.scroll();
		});
	},
	resize: function() {

		if(oToolTips.$.length){
			oToolTips.setClass();
		}

		if(oSideBar.$.length){
			oSideBar.resize();
		}
		
		oAccordions.init();
	},
	scroll: function() {
		oWindow.iCurrentScrollTop = oWindow.$.scrollTop();
		oShare.checkvisibility();

		if(oAnchorNavigation.$.length){
			oAnchorNavigation.changeSticky();
			oAnchorNavigation.setActiveStateScroll();	
		}
	},
	loaded: function(){

		if(oAnchorNavigation.$.length){
			oAnchorNavigation.init();
		}

		

		if(oToolTips.$.length){
			oToolTips.setClass();
		}
	}
};

/***********************************************************************************
	BODY
***********************************************************************************/
var oBody												= {
	$:				null,
	$wrap:			null
};

/***********************************************************************************
	COOKIE
***********************************************************************************/
var oCookie												= {
	set: 						function(sName, sValue, iDays) {
		var dtExpires;

		if(typeof iDays != 'undefined') {
			var dtDate 				= new Date();
			dtDate.setTime(dtDate.getTime() + (iDays * 24 * 60 * 60 * 1000));
			dtExpires 				= '; expires=' + dtDate.toGMTString();
		} else {
			dtExpires 				= '';
		}

		document.cookie = escape(sName) + '=' + escape(sValue) + dtExpires + '; path=/';
	},
	get:						function(sName) {
		sName 						= escape(sName) + "=";

		var aCookies 				= document.cookie.split(';');

		for(var i = 0; i < aCookies.length; i++) {
			var c = aCookies[i];

			while(c.charAt(0) === ' ') c = c.substring(1, c.length);
			if(c.indexOf(sName) === 0) return unescape(c.substring(sName.length, c.length));
		}

		return null;
	},
	check:						function(sName) {
		var bIsValid			= false;

		if(oCookie.get(sName) !== null && oCookie.get(sName) != '') {
			bIsValid			= true;
		}

		return bIsValid;
	},
	remove:						function(sName) {
		oCookie.set(sName, '', -10000);
	}
};

/***********************************************************************************
	SWIFTYPE
***********************************************************************************/
var oSwiftypeSearch = {
	$: null,
	currentLanguage: oGlobals.sLanguage,
	filters: {},
	translations: 	{
						de: {
							private: 'Private',
							enterprise: 'Unternehmen',
							energie360: 'Energie 360°',
							customerservice: 'Kundenservice',
							magazin: 'Magazin',
							download: 'Download',
							global: 'Allgemein',
							noresultsfound: 'Es wurden keine Ergebnisse gefunden.',
							showresults1: 'Anzeige der Ergebnisse',
							showresults2: 'bis',
							showresults3: 'von insgesamt'
						},
						fr: {
							private: 'Particuliers',
							enterprise: 'Enterprises',
							energie360: 'Energie 360°',
							customerservice: 'Service Clientèle',
							magazin: 'Magazine',
							download: 'Téléchargement',
							global: 'Général',
							noresultsfound: 'Aucun résultat trouvé.',
							showresults1: 'Affichage des résultats',
							showresults2: 'à',
							showresults3: 'sur un total de'
						}
					},
	init: function(){

		if(oSwiftypeSearch.currentLanguage != 'fr' && oSwiftypeSearch.currentLanguage != 'de'){
			oSwiftypeSearch.currentLanguage = 'de';
		}

		if(oSwiftypeSearch.currentLanguage == 'fr'){
			var sSTengineKey = '2wU6sjUcvzGXmwnp4jVL';
		}else{
			var sSTengineKey = 'CYjxTsjsxRB9zMcv_nxU';
		}

		if(window.location.hash.length){
			var params = oSwiftypeSearch.queryParser(window.location.hash.substr(1).split('&'));
			if(params.stq){
				$('#swiftype-search-field', oSwiftypeSearch.$).val(params.stq);
			}
			if(params.ftl){
				oSwiftypeSearch.initFilter(params.ftl);
			}
		}

		$('#swiftype-search-field', oSwiftypeSearch.$).swiftypeSearch({
		  resultContainingElement: '#swiftype-search-results',
		  engineKey: sSTengineKey,
		  renderFunction: oSwiftypeSearch.customRenderFunction,
		  postRenderFunction: oSwiftypeSearch.customPostRenderFunction,
		  renderPaginationForType: oSwiftypeSearch.customRenderPaginationForType,
		  renderResultsFunction: oSwiftypeSearch.customRenderResultsFunction,
		  filters: oSwiftypeSearch.readFilters,
		  facets: { page: ['swifttype-category'] }
		});

		$('input.search-filter', oSwiftypeSearch.$).on('click', function(){
			oSwiftypeSearch.changeFilter();
		});


	},
	readFilters: function() {
		return window.oSwiftypeSearch.filters;
	},
	changeFilter: function(){
		oSwiftypeSearch.filters = {};

		var aActiveFilters = [];
		$('input.search-filter:checkbox:checked',  oSwiftypeSearch.$).each(function () {
		    aActiveFilters.push($(this).val());
		});

		if(aActiveFilters.length){
			oSwiftypeSearch.filters = {page: {'swifttype-category': aActiveFilters}};
		}

		var params = oSwiftypeSearch.queryParser(window.location.hash.substr(1).split('&'));
		var filterList = aActiveFilters.toString();

		if(filterList.length){
			location.hash = "stq=" + encodeURIComponent(params.stq) + "&ftl="+ filterList +"&stp=" + 1;
		}else{
			location.hash = "stq=" + encodeURIComponent(params.stq) + "&stp=" + 1;
		}

		$(window).hashchange();
	},
	initFilter: function(filterlist){

		var aActiveFilters = filterlist.split(',');
		
		$.each(aActiveFilters, function(filter){
			$('input#filter-'+aActiveFilters[filter]).prop("checked", true);
		});

		oSwiftypeSearch.changeFilter();

	},
	queryParser: function (a) {
      var i, p, b = {};
      if (a === "") {
        return {};
      }
      for (i = 0; i < a.length; i += 1) {
        p = a[i].split('=');
        if (p.length === 2) {
          b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
        }
      }
      return b;
    },
	shortenText: function(str, maxLen, separator) {
		if (str.length <= maxLen) return str;
		return str.substr(0, str.lastIndexOf(separator, maxLen));
	},
	customRenderFunction: function (document_type, item, query) {


		var sCategory = item['swifttype-category'];

		if(typeof sCategory === 'undefined'){
			var sCategory = 'download';
		}

		var sResultItem = '<div class="st-result category-'+ sCategory +'">';

		if(sCategory == 'download'){
			var sPath = item['url'];
			var sTitel = sPath.replace(/.*(\/|\\)/, '');
		}else{
			var sTitel = (item['highlight']['swifttype-title'] != undefined) ? item['highlight']['swifttype-title']: item['swifttype-title'];
		}
		
		var sBody = (item['highlight']['body'] != undefined) ? item['highlight']['body']: oSwiftypeSearch.shortenText(item['body'], 350, ' ');

		if(sCategory == 'magazin' || sCategory == 'download'){
			sResultItem += '<h2><a href="' + item['url'] +'"><div class="flag"><div>'+ oSwiftypeSearch.translations[oSwiftypeSearch.currentLanguage][sCategory] +'</div></div><div class="title"><div>' + sTitel + '</div></div></a></h2>';
		}else{
			sResultItem += '<h2><a href="' + item['url'] + '?no_cache=1&sword_list%5B0%5D='+ query +'"><div class="flag"><div>'+ oSwiftypeSearch.translations[oSwiftypeSearch.currentLanguage][sCategory] +'</div></div><div class="title"><div>' + sTitel + '</div></div></a></h2>';
		}

		if(typeof sCategory === 'undefined'){
			sResultItem = '';
		}else if(!sBody.length || sCategory == 'download'){
			sResultItem += '<p></p>';
		}else{
			sResultItem += '<p>...' + sBody + '...</p>';
		}

		return sResultItem;
	},
	renderPagination: function (ctx, resultInfo) {
		var maxPagesType, maxPages = -1,
		config = ctx.config;

		$.each(resultInfo, function(documentType, typeInfo) {
			if (typeInfo.num_pages > maxPages) {
				maxPagesType = documentType;
				maxPages = typeInfo.num_pages;
			}
		});
		var currentPage = resultInfo[maxPagesType].current_page,
		totalPages = resultInfo[maxPagesType].num_pages;

		return config.renderPaginationForType(maxPagesType, currentPage, totalPages);
	},
	customPostRenderFunction: function(data) {
		var totalResultCount = 0;
		var page = null;
		var $resultContainer = this.getContext().resultContainer;
		var ctx = this.getContext();
		var spellingSuggestion = null;
		var toValue = 0;
		var fromValue = 0;
		var pagination = '';

		/*if(data['info']['page']['facets']){
			oSwiftypeSearch.updateFilterOptions(data['info']['page']['facets']);
		}*/

		oSwiftypeSearch.checkSearchAndFilter();


		if (data['info']['page']) {
			page = data['info']['page'];
			totalResultCount = page['total_result_count'];
			currentPage = parseInt(page['current_page']);
			numPages = parseInt(page['num_pages']);
			perPage = parseInt(page['per_page']);

			if(numPages === 1){
			  	fromValue = 1;
			  	toValue = totalResultCount;
			}else if(currentPage < numPages){
			  	fromValue = (currentPage === 1) ? 1 : (currentPage - 1) * perPage;
			  	toValue = currentPage * perPage;
			}else{
			  	fromValue = (currentPage - 1) * perPage;
			  	toValue = totalResultCount;
			}
		}

		if(totalResultCount === 0) {
			
			$resultContainer.html("<div class='browsebox'><p>"+ oSwiftypeSearch.translations[oSwiftypeSearch.currentLanguage].noresultsfound +"</p></div>");
			
		}else{
			pagination = oSwiftypeSearch.renderPagination(ctx, data.info);

			$resultContainer.prepend("<div class='browsebox top'><p>"+ oSwiftypeSearch.translations[oSwiftypeSearch.currentLanguage].showresults1 +" <strong>"+ fromValue +" "+ oSwiftypeSearch.translations[oSwiftypeSearch.currentLanguage].showresults2 +" "+ toValue +"</strong> "+ oSwiftypeSearch.translations[oSwiftypeSearch.currentLanguage].showresults3 +" <strong>"+ totalResultCount +"</strong></p>"+ pagination +"</div>");
			$resultContainer.append("<div class='browsebox bottom'>"+ pagination +"</div>");
		}
	},
	checkSearchAndFilter: function(){

		var params = oSwiftypeSearch.queryParser(window.location.hash.substr(1).split('&'));
		
		if(params.stq){
			//$('#filter', oSwiftypeSearch.$).show();
		}

	},
	updateFilterOptions: function(dataFacets){
		var iSize = 0;
		var bGlobal = false;

		$('#filter', oSwiftypeSearch.$).hide();
		$("#filter .customCheckboxWithLabel", oSwiftypeSearch.$).hide();

		$.each(dataFacets['swifttype-category'], function(field, facetCounts){
			if(field == 'global'){
				bGlobal = true;
			}else{
				//$("#filter #row-filter-"+field, oSwiftypeSearch.$).show();
			}
			iSize += 1;
		});

		if(iSize == 2 && !bGlobal){
			//$('#filter', oSwiftypeSearch.$).show();
		}else if(iSize > 2){
			//$('#filter', oSwiftypeSearch.$).show();
		}
	},
	customRenderPaginationForType: function (type, currentPage, totalPages) {
		var pages = '<ul class="pagination">',
		previousPage, nextPage;

		if(totalPages > 1){

			if (currentPage != 1) {
				previousPage = currentPage - 1;
				pages = pages + '<li><a href="#" data-hash="true" data-page="' + previousPage + '">&laquo;</a></li>';
			}

			for(i = 1; i<=totalPages; i++){
				sClass = (i === currentPage) ? 'active' : '';
				pages = pages + '<li><a class="'+ sClass +'" href="#" data-hash="true" data-page="' + i + '">'+ i +'</a></li>';
			}
			if (currentPage < totalPages) {
				nextPage = currentPage + 1;
				pages = pages + '<li><a href="#" class="st-next" data-hash="true" data-page="' + nextPage + '">&raquo;</a></li>';
			}

			pages += '</ul>';
		}else{
			pages = '';
		}

		return pages;
	},
	customRenderResultsFunction: function (ctx, data) {
		var $resultContainer = ctx.resultContainer,
		config = ctx.config;

		$resultContainer.html('');

		$.each(data.records, function (documentType, items) {
			$.each(items, function (idx, item) {
				ctx.registerResult($(config.renderFunction(documentType, item, data.info.page.query)).appendTo($resultContainer), item);
			});
		});
	}
}

/***********************************************************************************
	UMANTIS IFRAME
	Stellenmarkt
***********************************************************************************/
var oUmantis = {
	$: null,
	init: function() {
		if(this.$.length) {
			var if_height;

			var	src = 'https://recruitingapp-' + this.$.data('umantis-id') + '.umantis.com/Jobs/All';

			if (typeof(this.$.data('lang-code')) != "undefined"){
				src = src + '?lang=' + this.$.data('lang-code');
			}else{
				src = src + '?lang=ger';
			}

			if (typeof(this.$.data('design-id')) != "undefined"){
				src = src + '&DesignID=' + this.$.data('design-id');
			}

			var $iframe = $( '<iframe src="' + src + '" name="' + document.location.href + '" width="100%" height="500" frameborder="0" scrolling="no"><\/iframe>' ).appendTo( this.$ );

			$.receiveMessage(function(e){

				

				if (jQuery.type(e.data) === 'string' && e.data.indexOf("if_height=") >= 0){
					var tmp = new RegExp('if_height=([^&#]*)').exec(e.data);
					var h = Number(tmp[1]);
					/*var h = Number( e.data.replace( /.*if_height=(\d+)(?:&|$|.)/, '$1' ) );*/

				if (!isNaN( h ) && h > 0 && h !== if_height) {
						

						if_height = h;
						$iframe.height(h);
					}
				}
			});
		}
	}
}

/***********************************************************************************
	ANCHOR NAVIGATION
***********************************************************************************/
var oAnchorNavigation 							= {
	$: 				null,
	iTopCorrection: 	100,
	iStickyCorrection: 95,
	iPosition: 0,
	sCurrentActiveState: '',
	bJumpState: false,
	aTopPos: [],
	init: function(){

		var it = 0;

		$('a', oAnchorNavigation.$).each(function(){
			oAnchorNavigation.bind($(this));

			var $target = $('#'+$(this).data('targetid'));
			var top = $target.offset().top;
			oAnchorNavigation.aTopPos[it] = top;

			$(this).attr('data-toppos', top);

			it += 1;
		});

		var it = 0;
		$('a', oAnchorNavigation.$).each(function(){
			
			it += 1;

			iBottomPos = oAnchorNavigation.aTopPos[it];

			if(typeof iBottomPos === "undefined"){
				$(this).attr('data-bottompos', 1000000000000000000);
			}else{
				$(this).attr('data-bottompos', iBottomPos);
			}

		});

		
		var bounds = oAnchorNavigation.$.offset();
		oAnchorNavigation.iPosition = bounds.top;


		if(window.location.hash.length){
			var sCurrentHash = window.location.hash.replace('#', '');
			oAnchorNavigation.jump(sCurrentHash);
		}
		
	},
	bind: function($anchorlink){
		$anchorlink.bind('click', function(e){
			e.preventDefault();
			oAnchorNavigation.bJumpState = true;
			oAnchorNavigation.jump($(this).data('targetid'));
			return false;
		});
	},
	jump: function(sTargetid){

		var $target = $('#'+sTargetid);

		if(oGlobals.oResponsiveHelper.currentBreakpoint.codeName == 's' || oGlobals.oResponsiveHelper.currentBreakpoint.codeName == 'tp'){
			var top = $target.offset().top - oAnchorNavigation.iTopCorrection + 40;
		}else{
			var top = $target.offset().top - oAnchorNavigation.iTopCorrection;

			if(!oAnchorNavigation.$.hasClass('sticky')){
				top = top - oAnchorNavigation.iStickyCorrection;
			}

		}


		

		$('html, body').animate({
	        'scrollTop': top
	    }, 900, 'swing', function () {
	    }).promise().then(function() {
	    	oAnchorNavigation.setActiveState(sTargetid);
		});
	},
	setActiveState: function(sTargetid){

		if(oAnchorNavigation.sCurrentActiveState != sTargetid){
		
			$('a', oAnchorNavigation.$).each(function(){
				$(this).removeClass('active');
			});

			$('a', oAnchorNavigation.$).each(function(){
				if($(this).data('targetid') == sTargetid){
					$(this).addClass('active');
				}
			});
			
			oAnchorNavigation.setUrl(sTargetid);
		}
	},
	setActiveStateScroll: function(){

		if(!oAnchorNavigation.bJumpState && oGlobals.oResponsiveHelper.currentBreakpoint.codeName != 's' && oGlobals.oResponsiveHelper.currentBreakpoint.codeName != 'tp'){

			var sActiveFound = '';

			$('a', oAnchorNavigation.$).each(function(){

				var top = $(this).data('toppos') - oAnchorNavigation.iTopCorrection;
				var bottom = $(this).data('bottompos') - oAnchorNavigation.iTopCorrection;

				if(!oAnchorNavigation.$.hasClass('sticky')){
					top = top - oAnchorNavigation.iStickyCorrection;
					bottom = bottom - oAnchorNavigation.iStickyCorrection;
				}

				var scrollTop = oWindow.$.scrollTop() + oAnchorNavigation.iStickyCorrection;

				if(scrollTop >= top && scrollTop <= bottom){
					oAnchorNavigation.setActiveState($(this).data('targetid'));
					sActiveFound = $(this).data('targetid');
				}else{
					$(this).removeClass('active');
				}
			});

			if(!sActiveFound.length){
				oAnchorNavigation.setActiveState('');
			}
		}
	},
	setUrl: function(sTargetid){

		if(sTargetid.length){
			/*if(history.pushState) {
		    	var currentURL = window.location.href.replace(location.hash, "");
		    	var newUrl = currentURL + '#' + sTargetid;
			    history.pushState(null, null, newUrl);
			}else {
		    	location.hash = sTargetid;
			}*/

			oAnchorNavigation.sCurrentActiveState = sTargetid;
			oAnchorNavigation.bJumpState = false;
		}else{
			/*if(history.pushState) {
		    	var currentURL = window.location.href.replace(location.hash, "");
			    history.pushState(null, null, currentURL);
			}else {
		    	location.hash = '';
			}*/
			oAnchorNavigation.sCurrentActiveState = '';
			oAnchorNavigation.bJumpState = false;
		}

	},
	changeSticky: function(){

		if(oGlobals.oResponsiveHelper.currentBreakpoint.codeName != 's' && oGlobals.oResponsiveHelper.currentBreakpoint.codeName != 'tp'){
			if(oAnchorNavigation.iPosition > 0 && oWindow.iCurrentScrollTop >= (oAnchorNavigation.iPosition - 61) && !oAnchorNavigation.$.hasClass('stickyblocked')) {
				oAnchorNavigation.$.addClass('sticky');
			} else {
				oAnchorNavigation.$.removeClass('sticky');
			}
		}

		
	}
}

/***********************************************************************************
	MAINNAVIGATION
***********************************************************************************/
var oNavBar = {
	$: null,
	init: function(){

		oNavBar.$.RDNavbar({

			responsive: {
				0: {
		            layout: 'rd-navbar-fixed',
		            deviceLayout: 'rd-navbar-fixed',
		            focusOnHover: false,
		            stickUp: false
		        },
		        961: {
		            layout: 'rd-navbar-static',
		            deviceLayout: 'rd-navbar-fixed',
		            focusOnHover: true,
		            stickUp: true
		        }
		     },
		    callbacks: {
	          onStuck: function(){
	          	
	          },
	          onUnstuck: function(){

	          }
	        }
		});
	}
}

/***********************************************************************************
	SIDEBARNAVIGATION
***********************************************************************************/
var oSideBar = {
	$: null,
	init: function(){

		var socialBarWidth = $('.hint .socialicon', oSideBar.$).outerWidth();
		$('.hint .socialicon', oSideBar.$).css('width', socialBarWidth+'px');
		


		$('.item .hint', oSideBar.$).each(function(){
			$(this).css('left', '45px');
		});



		setTimeout(this.position,1000);
	},
	position: function(){
		var iSidebarWidth = oSideBar.$.outerWidth();
		var iSidebarHeight = oSideBar.$.outerHeight();
		var iWindowHeight = oWindow.$.height();

		var iPositionTop = (iWindowHeight - iSidebarHeight) / 2;
		var iPositionRightStart = 0;
		var iPositionRightEnd = 45;

		oSideBar.$.css('top', iPositionTop+'px').css('right', iPositionRightStart+'px');
		oSideBar.$.css('visibility', 'visible');

		oSideBar.$.animate({right: iPositionRightEnd+'px'});
	},
	resize: function(){
		var iSidebarWidth = oSideBar.$.outerWidth();
		var iSidebarHeight = oSideBar.$.outerHeight();
		var iWindowHeight = oWindow.$.height();

		var iPositionTop = (iWindowHeight - iSidebarHeight) / 2;
		var iPositionRightEnd = iSidebarWidth - 45;

		oSideBar.$.css('top', iPositionTop+'px').css('right', '-'+iPositionRightEnd+'px');	
	}
}

/***********************************************************************************
	ANCHOR TOP
***********************************************************************************/
var oAnchorTop 									= {
	$: null,
	init: function(){
		if(oAnchorTop.$.length){
			oAnchorTop.bind();
		}
	},
	bind: function(){
		oAnchorTop.$.bind('click', function(e){
			e.preventDefault();
			oAnchorTop.jump();
		});
	},
	jump: function(){
		$('html, body').animate({
	        'scrollTop': 0
	    }, 900, 'swing', function () {
	    }).promise().then(function() {
	    	/*if(window.location.hash.length){
	    		if(history.pushState) {
			    	var currentURL = window.location.href.replace(location.hash, "");
				    history.pushState(null, null, currentURL);
				}else {
			    	location.hash = '';
				}
	    	}*/
		});
	}
}

/***********************************************************************************
	GOOGLE MAPS
***********************************************************************************/
var oGoogleMaps									= {
	$: null,
	$geocoder: null,
	$bounds: null,
	$map: null,
	styles: [],
	init: function() {

		oGoogleMaps.styles = [{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#474747"}]},{"featureType":"administrative.country","elementType":"geometry","stylers":[{"visibility":"off"},{"hue":"#ff0000"},{"saturation":"94"},{"lightness":"88"},{"weight":"3.01"},{"invert_lightness":true}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"on"}]},{"featureType": "poi","elementType": "labels.icon","stylers": [{"gamma":0.2},{"lightness": -4},{"saturation":-49}]},{"featureType": "poi","elementType": "geometry.fill","stylers":[{"gamma":0.2},{"lightness":-4},{"saturation":-49},{"color":"#c5c5c5"}]},{"featureType": "poi","elementType": "labels.text.fill","stylers":[{"gamma":0.2},{"lightness":-4},{"saturation":-49},{"color":"#474747"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#ffffff"},{"visibility":"on"}]}];

		if(oGoogleMaps.$.length){
			oGoogleMaps.$.each(function(){
				oGoogleMaps.createmap($(this));
			});
		}
	},
	createmap: function($content){

		var sMapId 			= $content.find('.mapcontainer').attr('id');
		$geocoder 			= new google.maps.Geocoder();
		$bounds 			= new google.maps.LatLngBounds();

		//var styledMap 		= new google.maps.StyledMapType(oGoogleMaps.styles, {name: "JLS Map"});
		var mapOptions 		= { 
								mapTypeId: google.maps.MapTypeId.ROADMAP,
		         	 		 	disableDefaultUI: true,
		         	 		 	mapTypeControlOptions: {
							      mapTypeIds: [google.maps.MapTypeId.ROADMAP]
							    }
		     			 	};

     	$map = new google.maps.Map(document.getElementById(sMapId),mapOptions);

  		var iMarkerCount = 0;
  		$content.find('.addresscontent').each(function(){
  			oGoogleMaps.createMarker($(this), sMapId);
  			iMarkerCount += 1;
  		})

		$map.fitBounds($bounds);	

		if(iMarkerCount == 1){
			var listener = new google.maps.event.addListener($map, "idle", function () {
		        $map.setZoom(14);
		        google.maps.event.removeListener(listener);
		    });
		}
	},
	createMarker: function($addresscontent, sMapId){

		var sLatitude   	= $addresscontent.find('div.latitude').text();
		var sLongitude  	= $addresscontent.find('div.longitude').text();
		var sMarker  		= $addresscontent.find('div.marker').text();
		var sAddressInfo  	= $addresscontent.find('div.address').html();

		var sInfo 		= '<div class="info">'+ sAddressInfo +'</div>';

		var infowindow = new google.maps.InfoWindow({
						      content: sInfo
						  });

		var latLng 		= new google.maps.LatLng(sLatitude, sLongitude);
		var marker 		= new google.maps.Marker({
			position: latLng,
			icon: sMarker,
			map: $map
		});

		var infowindowevent = new google.maps.event.addListener(marker, 'click', function() {
		    infowindow.open($map ,this);
		});
		google.maps.event.addListener(infowindow, 'domready', function() {

		   $('div#'+sMapId+' div.directions a.dir').bind('click', function(e){

		   		e.preventDefault();

		   		if($(this).hasClass('start')){
		   			$('div#'+sMapId+' div.directions form.directiondestination').hide();
		   			$('div#'+sMapId+' div.directions form.directionstart').show();
		   		}else{
		   			$('div#'+sMapId+' div.directions form.directionstart').hide();
		   			$('div#'+sMapId+' div.directions form.directiondestination').show();
		   		}
		   });
		});
		$bounds.extend(latLng);
	}
};

/***********************************************************************************
	ACCORDIONS
***********************************************************************************/
var oAccordions											= {
	$:							null,
	init:						function() {

		var urlhash = document.location.hash;
		var sOpenId = '';

		// ex accordion-4587-1
		if(urlhash.indexOf('accordion') >= 0){
			var hashPart = urlhash.split('-');
			var objectID = hashPart[1];
			var accPartID = hashPart[2];

			var sOpenId = objectID + '-acc-' + accPartID;

		}

		oAccordions.$.parent().each(function(){
			if($(this).hasClass('open') || $(this).attr('id') == sOpenId) {
				$(this).height($(this).find('.accordionContent').innerHeight() + $(this).find('.accordionToggle').outerHeight());
			} else {
				$(this).height($(this).find('.accordionToggle').outerHeight());
			}
		});
	},
	toggle:						function(oElement) {

		oElement.toggleClass('open');

		if(oElement.hasClass('open')) {
			oElement.height(oElement.find('.accordionContent').innerHeight() + oElement.find('.accordionToggle').outerHeight());
			oElement.bind('webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd', function(){
				oElement.addClass('noTransition').css('height', 'auto').css('overflow', 'visible').find('.accordionContent').css('overflow', 'visible');
				oElement.unbind('webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd');
			});

		} else {
			oElement.attr('style', '').height(oElement.find('.accordionContent').innerHeight() + oElement.find('.accordionToggle').outerHeight()).height(oElement.find('.accordionToggle').outerHeight()).removeClass('noTransition').find('.accordionContent').removeAttr('style');
		}
	}
};

/***********************************************************************************
	SHARE
***********************************************************************************/
var oShare											= {
	$:							null,
	$triggerButton: 			null,
	init:						function() {
		$triggerButton = oShare.$.find('#share-title');
		oShare.bind();
		setTimeout(this.checkvisibility,1000);
	},
	bind: 						function(){
		$triggerButton.on('click', function(e){
			e.preventDefault();
			oShare.toggle();
		});

		var url 			= $(document).find('meta[property="og:url"]').attr('content');

		if(!url.length){
			url = $(document).find('link[rel="canonical"]').attr('href');
		}

		var twittertitle 	= $(document).find('meta[name="twitter:title"]').attr('content');
		var title 			= $(document).find('meta[property="og:title"]').attr('content');
		var textwhatsapp    = title+' -- ' +url;

		if(oShare.$.find('#twitter').length){
			oShare.$.find('#twitter').bind('click', function(e){
				e.preventDefault();
				oShare.openWindow('https://twitter.com/share?url=' + url + "&text=" + twittertitle + "&via=Energie360AG");
			});
		}

		if(oShare.$.find('#facebook').length){
			oShare.$.find('#facebook').bind('click', function(e){
				e.preventDefault();
				oShare.openWindow('https://www.facebook.com/share.php?u=' + url);
			});
		}

		if(oShare.$.find('#googleplus').length){
			oShare.$.find('#googleplus').bind('click', function(e){
				e.preventDefault();
				oShare.openWindow('https://plusone.google.com/_/+1/confirm?hl=de&url=' + url);
			});
		}

		if(oShare.$.find('#linkedin').length){
			oShare.$.find('#linkedin').bind('click', function(e){
				e.preventDefault();
				oShare.openWindow('http://www.linkedin.com/shareArticle?mini=true&url=' + url);
			});
		}

		if(oShare.$.find('#xing').length){
			oShare.$.find('#xing').bind('click', function(e){
				e.preventDefault();
				oShare.openWindow('https://www.xing.com/app/user?op=share&url=' + url);
			});
		}

		if(oShare.$.find('#whatsapp').length){
			var sWhatsAppUrl = 'whatsapp://send?text=' +  encodeURIComponent(textwhatsapp);
			oShare.$.find('#whatsapp').attr('href', sWhatsAppUrl);
		}

	},
	toggle:						function() {

		var iInnerHeight = $('.social-media', oShare.$).outerHeight();
		
		if(oShare.$.hasClass('open')){
			oShare.$.stop().animate({
	        	'height': 34
		    }, 400, 'swing', function () {
		       oShare.$.toggleClass('open');
		    });
		}else{
			oShare.$.stop().animate({
	        	'height': iInnerHeight+34
		    }, 400, 'swing', function () {
		       oShare.$.toggleClass('open');
		    });
		}

	},openWindow: function(url){
		window.open(url,'t','toolbar=0,resizable=1,status=0,width=640,height=528');
	},triggerBlank: function(url){
		window.open(url);
	},show: function(){

		if(Modernizr.touch){
			oShare.$.css('bottom', '0px');
			oShare.$.toggleClass('isvisible');
		}else{
			oShare.$.stop().animate({
	        	'bottom': 0
		    }, 400, 'swing', function () {
		       oShare.$.toggleClass('isvisible');
		    });
		}
	},
	hide: function(){

		if(Modernizr.touch){
			oShare.$.css('bottom', '-34px');
			oShare.$.toggleClass('isvisible');
		}else{
			oShare.$.stop().animate({
	        	'bottom': -34
		    }, 400, 'swing', function () {
		       oShare.$.toggleClass('isvisible');
		    });
		}

	},
	checkvisibility: function(){

		if(oWindow.iCurrentScrollTop > 400){
			if(!oShare.$.hasClass('isvisible')){
				oShare.show();
			}
		}else{
			if(oShare.$.hasClass('isvisible')){
				oShare.hide();
			}
		}
	}
};

/***********************************************************************************
	EVENT APPLICATION FORM
***********************************************************************************/
var oEventApplicationForm											= {
	$:							null,
	init:						function() {
		if(oEventApplicationForm.$.length){

			oEventApplicationForm.bind();
			oEventApplicationForm.setparticipate();
		}
	},
	bind: 						function(){
		$('input#participation-yes', oEventApplicationForm.$).change(function(){
			if(this.checked){
				oEventApplicationForm.setparticipate();
			}else{
				oEventApplicationForm.setnotparticipate();
			}
		});

		$('input#participation-no', oEventApplicationForm.$).change(function(){
			if(this.checked){
				oEventApplicationForm.setnotparticipate();
			}else{
				oEventApplicationForm.setparticipate();
			}
		});
	},
	setparticipate: 		function(){
		$('fieldset#additionalperson', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-noeventinvitation', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-noinvitation', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-companyfunction', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-pobox', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-street', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-streetnumber', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-postalcode', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-city', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-phone', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-mobile', oEventApplicationForm.$).removeClass('hidden');
	},
	setnotparticipate: 		function(){
		$('fieldset#additionalperson', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-noeventinvitation', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-noinvitation', oEventApplicationForm.$).removeClass('hidden');
		$('fieldset#contactparticipate div#inputrow-companyfunction', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-pobox', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-street', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-streetnumber', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-postalcode', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-city', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-phone', oEventApplicationForm.$).addClass('hidden');
		$('fieldset#contactparticipate div#inputrow-mobile', oEventApplicationForm.$).addClass('hidden');
	}
};

/***********************************************************************************
	NEWSLETTER FORM
***********************************************************************************/
var oNewsletterForm												= {
	$: null,
	init: function() {
		oNewsletterForm.$.submit(function(e){
			e.preventDefault();

			var $form = $(this);
			var jsonData = {
				evalancheUrl: $form.attr('action'),
				form_NAME: $form.find('#form_NAME').val(),
				form_FIRSTNAME: $form.find('#form_FIRSTNAME').val(),
				form_EMAIL: $form.find('#form_EMAIL').val(),
				form_SALUTATION: $form.find('#form_SALUTATION').val()
			}

			$form.find('input[name="submit"]').prop('disabled', true);
			$form.find('input,select,textarea').removeClass('validationerror formerror mandatoryerror');

			$.ajax({
				url: '/fileadmin/rpc/newsletterform.php',
				data: jsonData,
				type: 'POST',
				async: true,
				cache: false,
				success: function(result) {
					if($.trim($(result).text()).indexOf('http') === 0) {
						window.location.href = $.trim($(result).text());
					} else {
						var array_matches = /<body[^>]*>((.|[\n\r])*)<\/body>/im.exec(result);

						if(array_matches != null && typeof array_matches[1] != 'undefined') {
							oNewsletterForm.$.html($('<div>' + array_matches[1] + '</div>').find('#newsletterform').html())
						} else {
							$form.find('input[name="submit"]').prop('disabled', false);
						}
					}
				},
				error: function(){
					$form.find('input[name="submit"]').prop('disabled', false);
				}
			});
		});
	}
};

/***********************************************************************************
	OBJECT FIT IMAGE
***********************************************************************************/
var oObjectFitImage = {
	$: null,
	init: function(){
		objectFitImages('img.ofi');
	}
}

/***********************************************************************************
	REFERENCE SEARCH
***********************************************************************************/
var oReferenceSearch												= {
	$: null,
	sFormHash: '#form',
	sResHash: '#result',
	init: function() {
		if(oReferenceSearch.$.length){
			oReferenceSearch.initSelect();
			oReferenceSearch.bindSelect();

			if(document.location.hash == oReferenceSearch.sFormHash){
				oReferenceSearch.jumpToForm('reference-search');
			}else if(document.location.hash == oReferenceSearch.sResHash){
				oReferenceSearch.jumpToForm('result-count');
			}
		}else if($('#reference-resultlist').length){
			// if searchform is commented out
			if(document.location.hash == oReferenceSearch.sFormHash){
				oReferenceSearch.jumpToForm('result-count');
			}else if(document.location.hash == oReferenceSearch.sResHash){
				oReferenceSearch.jumpToForm('result-count');
			}
		}
	},
	initSelect: function(){
		$('select', oReferenceSearch.$).niceSelect();
	},
	bindSelect: function(){
		$('select', oReferenceSearch.$).on('change', function(){
			oReferenceSearch.$.submit();
		});
	},
	jumpToForm: function(stargetid){
		var $target = $('#'+stargetid);

		if($target.length){
			var top = $target.offset().top-600;

			$('html, body').stop().animate({
		        'scrollTop': top
		    }, 900, 'swing', function () {
		       
		    });
		}
		
	}
};

/***********************************************************************************
	MEDIARELEASE SEARCH
***********************************************************************************/
var oMediareleaseSearch												= {
	$: null,
	sFormHash: '#form',
	sResHash: '#result',
	init: function() {
		if(oMediareleaseSearch.$.length){
			oMediareleaseSearch.initSelect();
			oMediareleaseSearch.bindSelect();
			oMediareleaseSearch.bindDateField();

			if(document.location.hash == oMediareleaseSearch.sFormHash){
				oMediareleaseSearch.jumpToForm('mediarelease-search');
			}else if(document.location.hash == oMediareleaseSearch.sResHash){
				oMediareleaseSearch.jumpToForm('mediarelease-results');
			}
		}else if($('#mediarelease-resultlist').length){
			// if searchform is commented out
			if(document.location.hash == oMediareleaseSearch.sFormHash){
				oMediareleaseSearch.jumpToForm('mediarelease-results');
			}else if(document.location.hash == oMediareleaseSearch.sResHash){
				oMediareleaseSearch.jumpToForm('mediarelease-results');
			}
		}
	},
	initSelect: function(){
		$('select', oMediareleaseSearch.$).niceSelect();
	},
	bindSelect: function(){
		$('select', oMediareleaseSearch.$).on('change', function(){
			oMediareleaseSearch.$.submit();
		});
	},
	bindDateField: function(){

		var oTranslations = {
		    de: {
		        month: [
		            'Januar',
		            'Februar',
		            'März',
		            'April',
		            'Mai',
		            'Juni',
		            'Juli',
		            'August',
		            'September',
		            'Oktober',
		            'November',
		            'Dezember'
		        ],
		        day: [
		            'So',
		            'Mo',
		            'Di',
		            'Mi',
		            'Do',
		            'Fr',
		            'Sa'
		        ]
		    },
		    fr: {
		        month: [
		            'Janvier',
		            'Février',
		            'Mars',
		            'Avril',
		            'Mai',
		            'Juin',
		            'Juillet',
		            'Août',
		            'Septembre',
		            'Octobre',
		            'Novembre',
		            'Décembre'
		        ],
		        day: [
		            'Dim',
		            'Lun',
		            'Mar',
		            'Mer',
		            'Jeu',
		            'Ven',
		            'Sam'
		        ]
		    }
		};

		var oDatePickerTranslations = oTranslations[oGlobals.sLanguage];

		$('input#fromdate', oMediareleaseSearch.$).datepicker({ 
			buttonImage: '/fileadmin/templates/img/datepicker/calendar-icon.png',
			dayNamesMin: oDatePickerTranslations.day,
			monthNames: oDatePickerTranslations.month,
			showOn: 'button',
			buttonImageOnly: true,
			maxDate: new Date(),
			minDate: new Date(2010, 1 - 1, 1),
			changeYear: true,
			onSelect: function(strDate){
				var fromDate = $(this).datepicker('getDate');
				var minToDate = new Date(fromDate.getTime());
				$('input#todate', oMediareleaseSearch.$).datepicker('option', {minDate: minToDate});
			}
		});

		$('input#todate', oMediareleaseSearch.$).datepicker({
			buttonImage: '/fileadmin/templates/img/datepicker/calendar-icon.png',
			dayNamesMin: oDatePickerTranslations.day, 
			monthNames: oDatePickerTranslations.month,
			showOn: 'button',
			buttonImageOnly: true,
			maxDate: new Date(),
			minDate: new Date(2010, 1 - 1, 1),
			changeYear: true,
			onSelect: function(strDate){
				var toDate = $(this).datepicker('getDate');
				var maxFromDate = new Date(toDate.getTime());
				$('input#fromdate', oMediareleaseSearch.$).datepicker('option', {maxDate: maxFromDate});
			}
		});

		var currentFromDate = $('input#fromdate', oMediareleaseSearch.$).datepicker('getDate');
		var currentToDate = $('input#todate', oMediareleaseSearch.$).datepicker('getDate');
		
		if(currentToDate != null){
			var maxFromDate = new Date(currentToDate.getTime());
			$('input#fromdate', oMediareleaseSearch.$).datepicker('option', {maxDate: maxFromDate});
		}

		if(currentFromDate != null){
			var minToDate = new Date(currentFromDate.getTime());
			$('input#todate', oMediareleaseSearch.$).datepicker('option', {minDate: minToDate});
		}

	},
	jumpToForm: function(stargetid){
		var $target = $('#'+stargetid);

		if($target.length){
			var top = $target.offset().top-600;

			$('html, body').stop().animate({
		        'scrollTop': top
		    }, 900, 'swing', function () {
		       
		    });	
		}
	}
};

/***********************************************************************************
	INDEXED SEARCH
***********************************************************************************/
var oIndexedSearch												= {
	$: null,
	sResHash: '#result',
	init: function() {
		if(oIndexedSearch.$.length){
			if(document.location.hash == oIndexedSearch.sResHash){
				oIndexedSearch.jumpToForm('tx_indexedsearch');
			}
		}
	},
	jumpToForm: function(stargetid){
		var $target = $('#'+stargetid);
		var top = $target.offset().top + parseInt(oIndexedSearch.$.outerHeight());

		$('html, body').stop().animate({
	        'scrollTop': top
	    }, 900, 'swing', function () {
	       
	    });
	}
};

/***********************************************************************************
	SEARCH WORD SWORD
***********************************************************************************/
var oSearchWord												= {
	$: null,
	init: function() {
		if(oSearchWord.$.length && !$('#faqsearch').length){
			
			setTimeout(oSearchWord.jumpToWord(),300);
		}
	},
	jumpToWord: function(){
		var top = oSearchWord.$.offset().top - (oWindow.$.height() / 2);

		$('html, body').stop().animate({
	        'scrollTop': top
	    }, 900, 'swing', function () {
	       
	    });
	}
};


/***********************************************************************************
	CONTENT SLIDER
***********************************************************************************/
var oContentSlider = {
	$slider: null,
	init: function(){
		oContentSlider.$slider.each(function(){
			$(this).anyslider({
				touch: false,
				animation: 'slide',
				showBullets: false,
				showControls: true,
				pauseOnHover: true,
				interval: 8000,
				speed: 1000,
				responsive: true,
				nextLabel: '',
				prevLabel: '',
				beforeChange: function() {
					$this = $(this);
				},
				afterChange: function() {
					$this = $(this);
				},
				afterSetup: function() {
				}
			});
		});
	}
}

/***********************************************************************************
	CONTENT IMAGE SLIEDER
***********************************************************************************/
var oContentImageSlider = {
	$slider: null,
	init: function(){
		oContentImageSlider.$slider.each(function(){
			$(this).anyslider({
				touch: true,
				animation: 'slide',
				showBullets: true,
				showControls: true,
				pauseOnHover: true,
				interval: 0,
				speed: 1000,
				responsive: true,
				nextLabel: '',
				prevLabel: '',
				beforeChange: function() {
					$this = $(this);
				},
				afterChange: function() {
					$this = $(this);
				},
				afterSetup: function() {
				}
			});
		});
	},
}

/***********************************************************************************
	TOOL TIP
***********************************************************************************/
var oToolTips 											= {
	$: 							null,
	setClass: 					function(){
		
		oToolTips.$.each(function(){
			var iconLeft 	= $(this).offset().left;

			if(oWindow.$.width() > 400){
				if(iconLeft > (oWindow.$.width() / 2)){
					$(this).removeClass('posbottom');
					$(this).removeClass('posright');
					$(this).addClass('posleft');
				}else{
					$(this).removeClass('posbottom');
					$(this).removeClass('posleft');
					$(this).addClass('posright');
				}
			}else{
				$(this).removeClass('posright');
				$(this).removeClass('posleft');
				$(this).addClass('posbottom');
			}
			
		});
	}
}

/***********************************************************************************
	FILEUPLOAD
***********************************************************************************/
var oFileUpload 											= {
	$: 							null,
	init: function(){
		oFileUpload.$.each(function(){
			oFileUpload.bind($(this));
		});
	},
	bind: function($inputElement){

		var $label = $inputElement.next();
		var sLabelValue = $label.html();

		$inputElement.bind('change', function(e){

			var sFilename = '';

			if($(this).files && $(this).files.length > 1 ){
				sFilename = ( $(this).getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', $(this).files.length );
			}else{
				sFilename = e.target.value.split( '\\' ).pop();
			}
				
			if( sFilename ){
				$('span', $label).html(sFilename);
			}else{
				$label.html(sLabelValue);
			}
		});
	}
}

/***********************************************************************************
	PODCAST
***********************************************************************************/
var oPodCast 											= {
	$: 							null,
	init: function(){
		oPodCast.$.each(function(){

			var iId 		= $(this).attr('id');
			var sPlayerId 	= 'podcast-'+iId;

			var oAudioData		= $('.audiodata', $(this));
			var sAudioUrl		= $.trim($('div.audiofile', oAudioData).text());
			var iRowHeight 		= $('#rowcontainer-'+iId, oPodCast.$).outerHeight();

			oPodCast.initPlayer(sPlayerId, sAudioUrl);

			/*$('#podcastplay-'+iId).bind('click', function(e){
				e.preventDefault();
				var iId = $(this).data('playerid');

				$(this).toggleClass('active');

				jwplayer(iId).play();
				
			});*/

		});
	},
	initPlayer: function(sDomObjectId, sFile){

		jwplayer(sDomObjectId).setup({
			file: sFile,
			width: '100%',
			height: 40,
			base: "fileadmin/templates/js/jwplayer/" ,
			skin: {name: 'e360podcast'}
		});
		
	}
}

/***********************************************************************************
	OWL CAROUSEL
***********************************************************************************/
var oOwlCarousel = {
	$: null,
	init: function(){
		oOwlCarousel.$.each(function(){
			var carouselId = $(this).attr('id');
			var carouselNavId = '#nav-'+carouselId;

			if($(this).hasClass('one')){
				$('#'+carouselId).owlCarousel({
				    loop:true,
				    margin:20,
				    dots: false,
				    navContainer: carouselNavId,
				    autoplay: true,
				    autoplayTimeout: 5000,
				    autoplayHoverPause: true,
				    autoplaySpeed: 1000,
				    navSpeed: 1000,
				    responsiveClass:true,
				    responsive:{
				        0:{
				            items:1,
				            nav:false
				        },
				        600:{
				            items:1,
				            nav:false
				        },
				        1000:{
				            items:1,
				            nav:true
				        }
				    }
				});
			}else{
				$('#'+carouselId).owlCarousel({
				    loop:true,
				    margin:20,
				    dots: false,
				    navContainer: carouselNavId,
				    autoplay: true,
				    autoplayTimeout: 5000,
				    autoplayHoverPause: true,
				     autoplaySpeed: 1000,
				    navSpeed: 1000,
				    responsiveClass:true,
				    responsive:{
				        0:{
				            items:1,
				            nav:false
				        },
				        600:{
				            items:2,
				            nav:false
				        },
				        1000:{
				            items:3,
				            nav:true
				        }
				    }
				});
			}
			
		});
	}
}

/***********************************************************************************
	HOMESTAGE
***********************************************************************************/
var oHomestage = {
	$: null,
	aImages: [],
	init: function(){

		if($('#homestageimages', oHomestage.$).length){
			var sImageURL1 = $('#homestageimages', oHomestage.$).data('image1');
			oHomestage.aImages.push(sImageURL1);

			var sImageURL2 = $('#homestageimages', oHomestage.$).data('image2');
			oHomestage.aImages.push(sImageURL2);

			oHomestage.getRandomImage();
		}

	},
	getRandomImage: function(){
		var size = oHomestage.aImages.length
		var x = Math.floor(size*Math.random())

		$('#randomimage').attr('src',oHomestage.aImages[x]);
	}
}


/***********************************************************************************
	MAP SUPPLY AREA
***********************************************************************************/
var oMapSupplyArea = {
	$: null,
	init: function(){

		$("head").append($("<link rel='stylesheet' href=' https://js.arcgis.com/4.10/esri/css/main.css' type='text/css' media='screen' />"));

		var mapId = oMapSupplyArea.$.data('mapid');
 		var scriptUrl = "https://js.arcgis.com/4.10/";
		$.getScript( scriptUrl, function() {
				
			// Benötigte Module laden
			require([
				"esri/views/MapView",
				"esri/WebMap",
				"esri/widgets/Legend",
				"esri/widgets/Search",
				"esri/widgets/Expand"
			],
			function( MapView, WebMap, Legend, Search, Expand) {

				if(oGlobals.sLanguage == 'fr'){
					var sSearchLabel = 'Recherche de communauté';
				}else{
					var sSearchLabel = 'Gemeinde Suchen';
				}

				// Erstellen einer WebMap
				// Konsumiert werden mit der JavaScript API nicht WebApps, sonder WebMaps.
				var webmap = new WebMap({
						portalItem: {
						id: mapId // ID zu ihrer WebMap
					}
				});

				// "Sicht" auf WebMap erstellen
				var view = new MapView({
					map: webmap,
					container: "map-supplyarea"
				});

				// Deaktivieren der Einklappfunktion von Popups
  				view.popup.collapseEnabled = false;

				/* 
				Weiter können unterschiedlichste Widgets aus der JS API einfach eingebunden werden. Z.B. Legende:
				1. Modul laden ("esri/widgets/Legend")
				2. Legende erstellen
				*/
				var legend = new Legend({
					view: view
				});

				/* Initial Wird überprüft wie gross das Browserfenster ist. Ist das Fenster in diesem Fall breiter als 360px, so wird die Legende offen geladen. Ist das Display weniger breit als 360px so wird das Expand-Widget nicht automatisch geöffnet */
				var legendOpenOnStartup = window.innerWidth > 500

				/* 
				Die Legende kann in ein Expand-Widget gewrappt werden. Somit lässt sich diese ein-/ausklappen. Mit der property 'mode' kann ein bestimmter Expandierungstype erzwungen werden.
				1. Modul laden ("esri/widgets/Expand")
				2. Expand erstellen
				3. Legende als Content hinzufügen 
				4. Expand der 'Ansicht' (MapView) hinzufügen
				*/
				var expand = new Expand({
					view: view,
					mode: 'floating',
					content: legend,
					expanded: legendOpenOnStartup
				})

				view.ui.add(expand, "top-left");

				/* 
				Beispiel Suchfunktion:
				1. Modul laden ("esri/widgets/Search")
				2. Search erstellen
				3. Search der "Ansicht" (MapView) hinzufügen

				Hinzufügen eigener Quellen: https://developers.arcgis.com/javascript/latest/sample-code/widgets-search-multiplesource/index.html
				*/
				var search = new Search({
					view: view,
					includeDefaultSources: false, // Standard suche entfernen
					sources: [{
					featureLayer: {
					url: "https://services8.arcgis.com/MiivZpbvZybZNNTq/arcgis/rest/services/e360_gas_open_WFL1/FeatureServer/1" //URL der Quelle
				},
				searchFields: ["TEXT_"], // Suchfeld
					suggestionTemplate: "{TEXT_}", // Template der Vorschläge
					outFields: "*", 
					displayField: "TEXT_", // Anzeigename
					placeholder: sSearchLabel // Placeholder in Suchfeld
					}]
				});

				view.ui.add(search, "top-right");

			});
		});
	}
}

/***********************************************************************************
	MAP DECOMMISSIONING GAS NETWORK
***********************************************************************************/
var oMapDecommissioningGasNetwork = {
	$: null,
	init: function(){
		$("head").append($("<link rel='stylesheet' href=' https://js.arcgis.com/4.15/esri/themes/light/main.css' type='text/css' media='screen' />"));
		var mapId = oMapDecommissioningGasNetwork.$.data('mapid');
 		var scriptUrl = "https://js.arcgis.com/4.15/";
		$.getScript( scriptUrl, function() {
			// Benötigte Module laden
			require([
				"esri/views/MapView",
			    "esri/WebMap",
			    "esri/widgets/Legend",
			    "esri/widgets/Expand",
			    "esri/widgets/Search",
			    "esri/widgets/Compass",
			    "esri/config"
			],
			function( MapView, WebMap, Legend, Expand, Search, Compass, esriConfig) {
				 // Erstellen einer WebMap
			    // Konsumiert werden mit der JavaScript API nicht WebApps, sonder WebMaps.
			    var webmap = new WebMap({
			        portalItem: {
			            id: mapId
			        }
			    });
			    // "Sicht" auf WebMap erstellen
			    var view = new MapView({
			        map: webmap,
			        container: "map-decommissioning-gas-network"
			    });
			    /*
			    Weiter können unterschiedlichste Widgets aus der JS API einfach eingebunden werden. Z.B. Legende:
			     1. Modul laden ("esri/widgets/Legend")
			     2. Legende erstellen
			     */
			    var legend = new Legend({
			        view: view
			    });
			    var compass = new Compass({
			        view: view
			    });
			    /* Initial Wird überprüft wie gross das Browserfenster ist. Ist das Fenster in diesem Fall breiter als 360px, so wird die Legende offen geladen. Ist das Display weniger breit als 360px so wird das Expand-Widget nicht automatisch geöffnet */
			    var legendOpenOnStartup = true;
			    /*
			    Die Legende kann in ein Expand-Widget gewrappt werden. Somit lässt sich diese ein-/ausklappen. Mit der property 'mode' kann ein bestimmter Expandierungstype erzwungen werden.
			     1. Modul laden ("esri/widgets/Expand")
			     2. Expand erstellen
			     3. Legende als Content hinzufügen
			     4. Expand der 'Ansicht' (MapView) hinzufügen
			     */
			    var expand = new Expand({
			        view: view,
			        mode: 'floating',
			        content: legend,
			        expanded: legendOpenOnStartup
			    })
			    view.ui.add(compass, "top-left");
			    view.ui.add(expand, "top-left");
			    /*
			    Beispiel Suchfunktion:
			    1. Modul laden ("esri/widgets/Search")
			    2. Search erstellen
			    3. Search der "Ansicht" (MapView) hinzufügen
			    */
			    var search = new Search({
			        view: view
			    });
			    view.ui.add(search, "top-right");
			    if(!!view.popup){
			        view.popup.collapseEnabled = false;
			    }
			});
		});
	}
}
/***********************************************************************************
	STAGE VIDEO ON LANDINGPAGES
***********************************************************************************/
var oStageVideo 										= {
	$: null,
	$imagecontainer: null,
	$videocontainer: null,
	iTopCorrection: 	100,
	bIsTouch: false,
	init: function(){

		oStageVideo.bIsTouch = Modernizr.touch;

		if(!oStageVideo.bIsTouch){
			oStageVideo.$videocontainer = $('#videocontainer', oStageVideo.$);
			oStageVideo.initVideo();
		}else{
			oStageVideo.$imagecontainer = $('#imagecontainer', oStageVideo.$);
		}

		$('a#video', oStageVideo.$).bind('click', function(e){
			e.preventDefault();
			oStageVideo.jump($(this).data('targetid'));
		});
	},
	jump: function(sTargetid){
		var $target = $('#'+sTargetid);

		if(oGlobals.oResponsiveHelper.currentBreakpoint.codeName == 's' || oGlobals.oResponsiveHelper.currentBreakpoint.codeName == 'tp'){
			var top = $target.offset().top - oAnchorNavigation.iTopCorrection + 40;
		}else{
			var top = $target.offset().top - oAnchorNavigation.iTopCorrection;
		}
		$('html, body').animate({
	        'scrollTop': top
	    }, 900, 'swing', function () {
	    });
	},
	initVideo: function(){
		var oVideoData					= $('.videodata', oStageVideo.$);
		var sVideoUrl					= oVideoData.data('video');
		var sVideoThumbnail				= oVideoData.data('thumbnail');

		jwplayer('videocontainer').setup({
			file			: sVideoUrl,
			//image: 			sVideoThumbnail,
			//skin			: '/fileadmin/templates/js/jwplayer/skins/five.xml',
			controls		: false,
			icons			: false,
			autostart		: false,
			repeat 			: false,
			base 			: "fileadmin/templates/js/jwplayer/",
			width 			: "100%",
  			aspectratio 	: "334:225",
            mute: true
		});

		jwplayer('videocontainer').on('setupError', function(){
			oStageVideo.showThumb()
		});

		jwplayer('videocontainer').on('ready', function(callback){
			oStageVideo.videoPlay();

			setTimeout(function() { 
			    oStageVideo.hideThumb() },
			2000);
		});

		jwplayer('videocontainer').on('time', function(callback){
			oStageVideo.videoOntime(callback);
		});
	},
	hideThumb: function(){
		$('#videomobileimage', oStageVideo.$).stop().animate({
	        	'opacity': 0
		    }, 4000, 'linear', function () {
		});
	},
	showThumb: function(){
		$('#videomobileimage', oStageVideo.$).stop().animate({
	        	'opacity': 1
		    }, 500, 'linear', function () {
		});
	},
	videoPlay: function(){
		jwplayer('videocontainer').play();
	},
	videoOntime: function(callback){
		var iDifference = callback.duration - callback.position;
		if(iDifference < 0.5){
			jwplayer('videocontainer').pause();
			jwplayer('videocontainer').seek(0);
			oStageVideo.videoPlay();
		}
	}
}


/*V6*/
/*var oStageVideo 										= {
	$: null,
	$imagecontainer: null,
	$videocontainer: null,
	iTopCorrection: 	100,
	bIsTouch: false,
	init: function(){

		oStageVideo.bIsTouch = Modernizr.touch;

		if(!oStageVideo.bIsTouch){
			oStageVideo.$videocontainer = $('#videocontainer', oStageVideo.$);
			oStageVideo.initVideo();
		}else{
			oStageVideo.$imagecontainer = $('#imagecontainer', oStageVideo.$);
		}

		$('a#video', oStageVideo.$).bind('click', function(e){
			e.preventDefault();
			oStageVideo.jump($(this).data('targetid'));
		});
	},
	jump: function(sTargetid){
		var $target = $('#'+sTargetid);

		if(oGlobals.oResponsiveHelper.currentBreakpoint.codeName == 's' || oGlobals.oResponsiveHelper.currentBreakpoint.codeName == 'tp'){
			var top = $target.offset().top - oAnchorNavigation.iTopCorrection + 40;
		}else{
			var top = $target.offset().top - oAnchorNavigation.iTopCorrection;
		}
		$('html, body').animate({
	        'scrollTop': top
	    }, 900, 'swing', function () {
	    });
	},
	initVideo: function(){
		var oVideoData					= $('.videodata', oStageVideo.$);
		var sVideoUrl					= oVideoData.data('video');
		var sVideoThumbnail				= oVideoData.data('thumbnail');

		jwplayer('videocontainer').setup({
			file			: sVideoUrl,
			image: 			sVideoThumbnail,
			skin			: '/fileadmin/templates/js/jwplayer/skins/five.xml',
			controls		: false,
			icons			: false,
			autostart		: false,
			repeat 			: true,
			base 			: "fileadmin/templates/js/jwplayer/",
			width 			: "100%",
  			aspectratio 	: "334:225",
  			backcolor: 'transparent',
            wmode: 'transparent',
            mute: true
		});

		jwplayer('videocontainer').setMute(true);


		jwplayer('videocontainer').onReady(function(){



			oStageVideo.videoPlay();
			jwplayer('videocontainer').onTime(oStageVideo.videoOntime);

			setTimeout(oStageVideo.hideThumb(),4000);
		});
	},
	hideThumb: function(){
		$('#videomobileimage', oStageVideo.$).stop().animate({
	        	'opacity': 0
		    }, 4000, 'linear', function () {
		});
	},
	videoPlay: function(){
		jwplayer('videocontainer').play();
	},
	videoOntime: function(callback){
		var iDifference = callback.duration - callback.position;
		if(iDifference < 0.5){
			jwplayer('videocontainer').pause();
			jwplayer('videocontainer').seek(0);
			oStageVideo.videoPlay();
		}
	}
}*/

/***********************************************************************************
	DOCUMENT READY
***********************************************************************************/
$(document).ready(function(){
	oGlobals.cacheJQueryObjects();
	oGlobals.init();

	if($('.cookie-message').length){
		$('.cookie-message').cookieBar({ closeButton : '.close', name: 'e360consentbanner',domain: '.energie360.ch' });
	}
	oAccordions.init();
	oAccordions.$.bind('click', function(e){
		e.preventDefault();
		oAccordions.toggle($(this).parent());
	});

	$('.nextform').nextformvalidator({
		errorClass: 'formerror',
		validateOnBlur: true,
		debugMode: false,

		beforeValidate: function(oForm, oSubmit){
			if(oSubmit.hasClass('novalidate')){
				oForm.addClass('ignorevalidation');
			}else{
				oForm.removeClass('ignorevalidation');
			}
		},

		onValidate: function(oForm, bIsValid){
			if(oForm.hasClass('ignorevalidation')){
				return true;
			}else{
				return bIsValid;
			}
		}
	});

	if($('form.powermail_form').length){
		window.Parsley.on('form:error', function() {

		$('div.errorhinttext', this.$element).addClass('visible');
		  //console.log('Validation failed for: ', this.$element);
		});

		var oTranslations = {
		    de: {
		        month: [
		            'Januar',
		            'Februar',
		            'März',
		            'April',
		            'Mai',
		            'Juni',
		            'Juli',
		            'August',
		            'September',
		            'Oktober',
		            'November',
		            'Dezember'
		        ],
		        day: [
		            'So',
		            'Mo',
		            'Di',
		            'Mi',
		            'Do',
		            'Fr',
		            'Sa'
		        ]
		    },
		    fr: {
		        month: [
		            'Janvier',
		            'Février',
		            'Mars',
		            'Avril',
		            'Mai',
		            'Juin',
		            'Juillet',
		            'Août',
		            'Septembre',
		            'Octobre',
		            'Novembre',
		            'Décembre'
		        ],
		        day: [
		            'Dim',
		            'Lun',
		            'Mar',
		            'Mer',
		            'Jeu',
		            'Ven',
		            'Sam'
		        ]
		    }
		};

		var oDatePickerTranslations = oTranslations[oGlobals.sLanguage];

		$('form.powermail_form input.datepicker').each(function(){
			if($(this).hasClass('pastdate')){
				$(this).datepicker({ buttonImage: '/fileadmin/templates/img/datepicker/calendar-icon.png', dayNamesMin: oDatePickerTranslations.day,  monthNames: oDatePickerTranslations.month, showOn: 'button', buttonImageOnly: true, maxDate: new Date() });
			}else if($(this).hasClass('futuredate')){
				$(this).datepicker({ buttonImage: '/fileadmin/templates/img/datepicker/calendar-icon.png', dayNamesMin: oDatePickerTranslations.day,  monthNames: oDatePickerTranslations.month, showOn: 'button', buttonImageOnly: true, minDate: new Date() });
			}else{
				$(this).datepicker({ buttonImage: '/fileadmin/templates/img/datepicker/calendar-icon.png', dayNamesMin: oDatePickerTranslations.day,  monthNames: oDatePickerTranslations.month, showOn: 'button', buttonImageOnly: true});
			}
			
		});

	}

	// fix postition fixed problem when ipad keypad is open
	if (Modernizr.touch) {
		$(document).on('focus', 'input, textarea', function() {
			if(oShare.$ && oShare.$.length) {
				oShare.$.addClass('hidden');
			}
			if($('#habla_beta_container_do_not_rely_on_div_classes_or_names').length){
				$('#habla_beta_container_do_not_rely_on_div_classes_or_names').addClass('hidden');
			}
	       	
	       
	    })
	    .on('blur', 'input, textarea', function () {
	       	if(oShare.$ && oShare.$.length) {
				oShare.$.removeClass('hidden');
			}
			if($('#habla_beta_container_do_not_rely_on_div_classes_or_names').length){
				$('#habla_beta_container_do_not_rely_on_div_classes_or_names').removeClass('hidden');
			}
	       
	      
	    });
	}

	if(oBody.$.hasClass('home') && $('#darksiteisactive').length) {
		if(oCookie.get('blackpagevisited') == null){
			window.location.href = $('#darksiteisactive #darksitepath').html();
		}
	}

	if($('#darksitehomelink').length){
		$('#darksitehomelink a').bind('click', function(){
			oCookie.set('blackpagevisited', 'yes');
		});
	}

	if($('#animation_container').length){
		initAnimation();
	}

	if(!Modernizr.touch){
		$('img.light-zoom').lightzoom({
	        zoomPower   : 3,    //Default
	        glassSize   : 180,  //Default
	    });
	}

});
