
Cognito.ready('libraryScripts', function($) { var jQuery = $; 
;(function() { if (Cognito.config.scripts.indexOf('cognito-datepicker') >= 0) return; else Cognito.config.scripts.push('cognito-datepicker');(function($){function UTCDate(){return new Date(Date.UTC.apply(Date,arguments))}function opts_from_el(el,prefix){var data=$(el).data(),out={},inkey,replace=new RegExp("^"+prefix.toLowerCase()+"([A-Z])"),prefix=new RegExp("^"+prefix.toLowerCase());for(var key in data)prefix.test(key)&&(inkey=key.replace(replace,function(_,a){return a.toLowerCase()}),out[inkey]=data[key]);return out}function opts_from_locale(lang){var out={},d;if(dates[lang]||(lang=lang.split("-")[0],dates[lang]))return d=dates[lang],$.each(locale_opts,function(i,k){k in d&&(out[k]=d[k])}),out}var $window=$(window),Datepicker=function(element,options){var that=this;this._process_options(options);this.element=$(element);this.isInline=!1;this.isInput=!0;this.component=this.element.parent().parent().find(".c-editor-date-icon:first");this.hasInput=!1;this.component&&this.component.length===0&&(this.component=!1);this.picker=$(DPGlobal.template);this._buildEvents();this._attachEvents();this.isInline?this.picker.addClass("cognito-datepicker-inline").appendTo(this.element):this.picker.addClass("cognito-datepicker-dropdown cognito-dropdown-menu");this.o.rtl&&(this.picker.addClass("cognito-datepicker-rtl"),this.picker.find(".prev i, .next i").toggleClass("icon-arrow-left icon-arrow-right"));this.viewMode=this.o.startView;this.o.calendarWeeks&&this.picker.find("tfoot th.today").attr("colspan",function(i,val){return parseInt(val)+1});this._allow_update=!1;this.setStartDate(this._o.startDate);this.setEndDate(this._o.endDate);this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);this.fillDow();this.fillMonths();this._allow_update=!0;this.update();this.showMode();this.isInline&&this.show()},DateRangePicker,old,defaults,locale_opts,dates,DPGlobal;Datepicker.prototype={constructor:Datepicker,_process_options:function(opts){var o,lang,format,plc,_plc;this._o=$.extend({},this._o,opts);o=this.o=$.extend({},this._o);opts.dates&&$.extend(dates,opts.dates);lang=o.language;dates[lang]||(lang=lang.split("-")[0],dates[lang]||(lang=defaults.language));o.language=lang;switch(o.startView){case 2:case"decade":o.startView=2;break;case 1:case"year":o.startView=1;break;default:o.startView=0}switch(o.minViewMode){case 1:case"months":o.minViewMode=1;break;case 2:case"years":o.minViewMode=2;break;default:o.minViewMode=0}if(o.startView=Math.max(o.startView,o.minViewMode),o.weekStart%=7,o.weekEnd=(o.weekStart+6)%7,format=DPGlobal.parseFormat(o.format),o.startDate!==-Infinity&&(o.startDate=o.startDate?o.startDate instanceof Date?this._local_to_utc(this._zero_time(o.startDate)):DPGlobal.parseDate(o.startDate,format,o.language):-Infinity),o.endDate!==Infinity&&(o.endDate=o.endDate?o.endDate instanceof Date?this._local_to_utc(this._zero_time(o.endDate)):DPGlobal.parseDate(o.endDate,format,o.language):Infinity),o.daysOfWeekDisabled=o.daysOfWeekDisabled||[],$.isArray(o.daysOfWeekDisabled)||(o.daysOfWeekDisabled=o.daysOfWeekDisabled.split(/[,\s]*/)),o.daysOfWeekDisabled=$.map(o.daysOfWeekDisabled,function(d){return parseInt(d,10)}),plc=String(o.orientation).toLowerCase().split(/\s+/g),_plc=o.orientation.toLowerCase(),plc=$.grep(plc,function(word){return/^auto|left|right|top|bottom$/.test(word)}),o.orientation={x:"auto",y:"auto"},_plc&&_plc!=="auto")if(plc.length===1)switch(plc[0]){case"top":case"bottom":o.orientation.y=plc[0];break;case"left":case"right":o.orientation.x=plc[0]}else _plc=$.grep(plc,function(word){return/^left|right$/.test(word)}),o.orientation.x=_plc[0]||"auto",_plc=$.grep(plc,function(word){return/^top|bottom$/.test(word)}),o.orientation.y=_plc[0]||"auto"},_events:[],_secondaryEvents:[],_applyEvents:function(evs){for(var i=0,el,ev;i<evs.length;i++){el=evs[i][0];ev=evs[i][1];el.on(ev)}},_unapplyEvents:function(evs){for(var i=0,el,ev;i<evs.length;i++)el=evs[i][0],ev=evs[i][1],el.off(ev)},toggleWidget:function(){$(this.picker).is(":visible")?this.hide():this.show()},_buildEvents:function(){this.isInput?this._events=[[this.element,{focus:$.proxy(function(e){this.element.is(".icon-picker-only, .suppress-picker")||this.show(e)},this),keyup:$.proxy(this.update,this),keydown:$.proxy(this.keydown,this)}],[this.element.parent().parent().find(".c-editor-date-icon"),{click:$.proxy(this.toggleWidget,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:$.proxy(this.show,this)}]];this._secondaryEvents=[[this.picker,{click:$.proxy(this.click,this)}],[$(window),{resize:$.proxy(this.place,this)}],[$(document),{mousedown:$.proxy(function(e){this.element.is(e.target)||this.picker.is(e.target)||this.picker.find(e.target).length||(e.target.className.indexOf("c-editor-date")>-1||e.target.className.indexOf("icon-calendar")>-1||e.target.className.indexOf("date-icon")>-1||this.picker.is(e.target))&&$(e.target).parents(".c-date-date")[0]===$(this.element).parents(".c-date-date")[0]||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents();this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents();this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(event,altdate){var date=altdate||this.date,local_date=this._utc_to_local(date);this.element.trigger({type:event,date:local_date,format:$.proxy(function(altformat){var format=altformat||this.o.format;return DPGlobal.formatDate(date,format,this.o.language)},this)})},show:function(e){$(this.picker).is(":visible")||(this.isInline||this.picker.appendTo("body"),this.picker.show(),this.height=this.component?this.component.outerHeight():this.element.outerHeight(),this.place(),this._attachSecondaryEvents(),e&&e.preventDefault(),this.element.val()!==""&&(this.date=new Date(this.element.val()),this.update()),this._trigger("show"))},hide:function(){this.isInline||this.picker.is(":visible")&&(this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this._trigger("hide"))},remove:function(){this.hide();this._detachEvents();this._detachSecondaryEvents();this.picker.remove();delete this.element.data().datepicker;this.isInput||delete this.element.data().date},_utc_to_local:function(utc){return new Date(utc.getTime()+utc.getTimezoneOffset()*6e4)},_local_to_utc:function(local){return new Date(local.getTime()-local.getTimezoneOffset()*6e4)},_zero_time:function(local){return new Date(local.getFullYear(),local.getMonth(),local.getDate())},_zero_utc_time:function(utc){return new Date(Date.UTC(utc.getUTCFullYear(),utc.getUTCMonth(),utc.getUTCDate()))},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){return this.date},setDate:function(d){this.setUTCDate(this._local_to_utc(d))},setUTCDate:function(d){this.date=d;this.setValue()},setValue:function(){var formatted=this.getFormattedDate();this.isInput?this.element.val(formatted).change():this.component&&this.element.find("input").val(formatted).change()},getFormattedDate:function(format){return format===undefined&&(format=this.o.format),DPGlobal.formatDate(this.date,format,this.o.language)},setStartDate:function(startDate){this._process_options({startDate:startDate});this.update();this.updateNavArrows()},setEndDate:function(endDate){this._process_options({endDate:endDate});this.update();this.updateNavArrows()},setDaysOfWeekDisabled:function(daysOfWeekDisabled){this._process_options({daysOfWeekDisabled:daysOfWeekDisabled});this.update();this.updateNavArrows()},place:function(){var yorient,top_overflow,bottom_overflow;if(!this.isInline){var calendarWidth=this.picker.outerWidth(),calendarHeight=this.picker.outerHeight(),visualPadding=10,windowWidth=$window.width(),windowHeight=$window.height(),scrollTop=$window.scrollTop(),zIndex=parseInt(this.element.parents().filter(function(){return $(this).css("z-index")!="auto"}).first().css("z-index"))+10,offset=this.element.offset(),height=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),width=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),left=offset.left,top=offset.top;this.picker.removeClass("cognito-datepicker-orient-top cognito-datepicker-orient-bottom cognito-datepicker-orient-right cognito-datepicker-orient-left cognito-datepicker-center-arrow");this.o.orientation.x!=="auto"?(this.picker.addClass("cognito-datepicker-orient-"+this.o.orientation.x),this.o.orientation.x==="right"&&(left-=calendarWidth-width)):(this.picker.addClass("cognito-datepicker-orient-left"),offset.left<0?left-=offset.left-visualPadding:offset.left+calendarWidth>windowWidth&&(left=windowWidth-calendarWidth-visualPadding));left+calendarWidth+visualPadding>=windowWidth&&this.picker.addClass("cognito-datepicker-center-arrow");yorient=this.o.orientation.y;yorient==="auto"&&(top_overflow=-scrollTop+offset.top-calendarHeight,bottom_overflow=scrollTop+windowHeight-(offset.top+height+calendarHeight),yorient=Math.max(top_overflow,bottom_overflow)===bottom_overflow?"top":"bottom");this.picker.addClass("cognito-datepicker-orient-"+yorient);yorient==="top"?top+=height+6:top-=calendarHeight+parseInt(this.picker.css("padding-top"));this.picker.css({top:top,left:left,zIndex:zIndex})}},_allow_update:!0,update:function(){var oldDate,date,fromArgs,keys;this._allow_update&&(oldDate=new Date(this.date),fromArgs=!1,arguments&&arguments.length&&(typeof arguments[0]=="string"||arguments[0]instanceof Date)?(date=arguments[0],date instanceof Date&&(date=this._local_to_utc(date)),fromArgs=!0):(date=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),delete this.element.data().date),this.date=DPGlobal.parseDate(date,this.o.format,this.o.language),fromArgs&&this.setValue(),this.date<this.o.startDate?(this.viewDate=new Date(this.o.startDate),this.date=new Date(this.o.startDate)):this.date>this.o.endDate?(this.viewDate=new Date(this.o.endDate),this.date=new Date(this.o.endDate)):(this.viewDate=new Date(this.date),this.date=new Date(this.date)),this.fill(),keys=["37","38","39","40"],arguments&&arguments.length&&keys.indexOf(arguments[0].keyCode)!==-1&&arguments[0].stopPropagation())},fillDow:function(){var dowCnt=this.o.weekStart,html="<tr>",cell;for(this.o.calendarWeeks&&(cell='<th class="cw">&nbsp;<\/th>',html+=cell,this.picker.find(".cognito-datepicker-days thead tr:first-child").prepend(cell));dowCnt<this.o.weekStart+7;)html+='<th class="dow">'+dates[this.o.language].daysMin[dowCnt++%7]+"<\/th>";html+="<\/tr>";this.picker.find(".cognito-datepicker-days thead").append(html)},fillMonths:function(){for(var html="",i=0;i<12;)html+='<span class="month">'+dates[this.o.language].monthsShort[i++]+"<\/span>";this.picker.find(".cognito-datepicker-months td").html(html)},setRange:function(range){range&&range.length?this.range=$.map(range,function(d){return d.valueOf()}):delete this.range;this.fill()},getClassNames:function(date){var cls=[],year=this.viewDate.getUTCFullYear(),month=this.viewDate.getUTCMonth(),currentDate=this.date.valueOf(),today=new Date;return date.getUTCFullYear()<year||date.getUTCFullYear()==year&&date.getUTCMonth()<month?cls.push("old"):(date.getUTCFullYear()>year||date.getUTCFullYear()==year&&date.getUTCMonth()>month)&&cls.push("new"),this.o.todayHighlight&&date.getUTCFullYear()==today.getFullYear()&&date.getUTCMonth()==today.getMonth()&&date.getUTCDate()==today.getDate()&&cls.push("today"),currentDate&&date.valueOf()==currentDate&&cls.push("active"),(date.valueOf()<this.o.startDate||date.valueOf()>this.o.endDate||$.inArray(date.getUTCDay(),this.o.daysOfWeekDisabled)!==-1)&&cls.push("disabled"),this.range&&(date>this.range[0]&&date<this.range[this.range.length-1]&&cls.push("range"),$.inArray(date.valueOf(),this.range)!=-1&&cls.push("selected")),cls},fill:function(){var d=new Date(this.viewDate),year=d.getUTCFullYear(),month=d.getUTCMonth(),startYear=this.o.startDate!==-Infinity?this.o.startDate.getUTCFullYear():-Infinity,startMonth=this.o.startDate!==-Infinity?this.o.startDate.getUTCMonth():-Infinity,endYear=this.o.endDate!==Infinity?this.o.endDate.getUTCFullYear():Infinity,endMonth=this.o.endDate!==Infinity?this.o.endDate.getUTCMonth():Infinity,currentDate=this.date&&this.date.valueOf(),tooltip,prevMonth,day,nextMonth,html,clsName,before,currentYear,months,yearCont,i;for(this.picker.find(".cognito-datepicker-days thead th.datepicker-switch").text(dates[this.o.language].months[month]+" "+year),this.picker.find("tfoot th.today").text(dates[this.o.language].today).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot th.clear").text(dates[this.o.language].clear).toggle(this.o.clearBtn!==!1),this.updateNavArrows(),this.fillMonths(),prevMonth=UTCDate(year,month-1,28,0,0,0,0),day=DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(),prevMonth.getUTCMonth()),prevMonth.setUTCDate(day),prevMonth.setUTCDate(day-(prevMonth.getUTCDay()-this.o.weekStart+7)%7),nextMonth=new Date(prevMonth),nextMonth.setUTCDate(nextMonth.getUTCDate()+42),nextMonth=nextMonth.valueOf(),html=[];prevMonth.valueOf()<nextMonth;){if(prevMonth.getUTCDay()==this.o.weekStart&&(html.push("<tr>"),this.o.calendarWeeks)){var ws=new Date(+prevMonth+(this.o.weekStart-prevMonth.getUTCDay()-7)%7*864e5),th=new Date(+ws+(11-ws.getUTCDay())%7*864e5),yth=new Date(+(yth=UTCDate(th.getUTCFullYear(),0,1))+(11-yth.getUTCDay())%7*864e5),calWeek=(th-yth)/6048e5+1;html.push('<td class="cw">'+calWeek+"<\/td>")}clsName=this.getClassNames(prevMonth);clsName.push("day");this.o.beforeShowDay!==$.noop&&(before=this.o.beforeShowDay(this._utc_to_local(prevMonth)),before===undefined?before={}:typeof before=="boolean"?before={enabled:before}:typeof before=="string"&&(before={classes:before}),before.enabled===!1&&clsName.push("disabled"),before.classes&&(clsName=clsName.concat(before.classes.split(/\s+/))),before.tooltip&&(tooltip=before.tooltip));clsName=$.unique(clsName);html.push('<td class="'+clsName.join(" ")+'"'+(tooltip?' title="'+tooltip+'"':"")+">"+prevMonth.getUTCDate()+"<\/td>");prevMonth.getUTCDay()==this.o.weekEnd&&html.push("<\/tr>");prevMonth.setUTCDate(prevMonth.getUTCDate()+1)}for(this.picker.find(".cognito-datepicker-days tbody").empty().append(html.join("")),currentYear=this.date&&this.date.getUTCFullYear(),months=this.picker.find(".cognito-datepicker-months").find("th:eq(1)").text(year).end().find("span").removeClass("active"),currentYear&&currentYear==year&&months.eq(this.date.getUTCMonth()).addClass("active"),(year<startYear||year>endYear)&&months.addClass("disabled"),year==startYear&&months.slice(0,startMonth).addClass("disabled"),year==endYear&&months.slice(endMonth+1).addClass("disabled"),html="",year=parseInt(year/10,10)*10,yearCont=this.picker.find(".cognito-datepicker-years").find("th:eq(1)").text(year+"-"+(year+9)).end().find("td"),year-=1,i=-1;i<11;i++)html+='<span class="year'+(i==-1?" old":i==10?" new":"")+(currentYear==year?" active":"")+(year<startYear||year>endYear?" disabled":"")+'">'+year+"<\/span>",year+=1;yearCont.html(html)},updateNavArrows:function(){if(this._allow_update){var d=new Date(this.viewDate),year=d.getUTCFullYear(),month=d.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-Infinity&&year<=this.o.startDate.getUTCFullYear()&&month<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"});this.o.endDate!==Infinity&&year>=this.o.endDate.getUTCFullYear()&&month>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-Infinity&&year<=this.o.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"});this.o.endDate!==Infinity&&year>=this.o.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(e){var target,dir,date,which,element;if(e.preventDefault(),target=$(e.target).closest("span, td, th"),target.length==1)switch(target[0].nodeName.toLowerCase()){case"th":switch(target[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":dir=DPGlobal.modes[this.viewMode].navStep*(target[0].className=="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,dir);this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,dir);this.viewMode===1&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":date=new Date;date=UTCDate(date.getFullYear(),date.getMonth(),date.getDate(),0,0,0);this.showMode(-2);which=this.o.todayBtn=="linked"?null:"view";this._setDate(date,which);break;case"clear":this.isInput?element=this.element:this.component&&(element=this.element.find("input"));element&&element.val("").change();this._trigger("changeDate");this.update();this.o.autoclose&&this.hide()}break;case"span":if(!target.is(".disabled")){if(this.viewDate.setUTCDate(1),target.is(".month")){var day=1,month=target.parent().find("span").index(target),year=this.viewDate.getUTCFullYear();this.viewDate.setUTCMonth(month);this._trigger("changeMonth",this.viewDate);this.o.minViewMode===1&&this._setDate(UTCDate(year,month,day,0,0,0,0))}else{var year=parseInt(target.text(),10)||0,day=1,month=0;this.viewDate.setUTCFullYear(year);this._trigger("changeYear",this.viewDate);this.o.minViewMode===2&&this._setDate(UTCDate(year,month,day,0,0,0,0))}this.showMode(-1);this.fill()}break;case"td":if(target.is(".day")&&!target.is(".disabled")){var day=parseInt(target.text(),10)||1,year=this.viewDate.getUTCFullYear(),month=this.viewDate.getUTCMonth();target.is(".old")?month===0?(month=11,year-=1):month-=1:target.is(".new")&&(month==11?(month=0,year+=1):month+=1);this._setDate(UTCDate(year,month,day,0,0,0,0))}}},_setDate:function(date,which){which&&which!="date"||(this.date=new Date(date));which&&which!="view"||(this.viewDate=new Date(date));this.fill();this.setValue();this._trigger("changeDate");var element;this.isInput?element=this.element:this.component&&(element=this.element.find("input"));element&&element.change();this.o.autoclose&&(!which||which=="date")&&this.hide()},moveMonth:function(date,dir){var i;if(!dir)return date;var new_date=new Date(date.valueOf()),day=new_date.getUTCDate(),month=new_date.getUTCMonth(),mag=Math.abs(dir),new_month,test;if(dir=dir>0?1:-1,mag==1)test=dir==-1?function(){return new_date.getUTCMonth()==month}:function(){return new_date.getUTCMonth()!=new_month},new_month=month+dir,new_date.setUTCMonth(new_month),(new_month<0||new_month>11)&&(new_month=(new_month+12)%12);else{for(i=0;i<mag;i++)new_date=this.moveMonth(new_date,dir);new_month=new_date.getUTCMonth();new_date.setUTCDate(day);test=function(){return new_month!=new_date.getUTCMonth()}}while(test())new_date.setUTCDate(--day),new_date.setUTCMonth(new_month);return new_date},moveYear:function(date,dir){return this.moveMonth(date,dir*12)},dateWithinRange:function(date){return date>=this.o.startDate&&date<=this.o.endDate},keydown:function(e){var dateChanged,dir,newDate,newViewDate,originalElementValue,newElementValue,element;if(this.picker.is(":not(:visible)")){(e.keyCode==27||e.altKey&&e.keyCode===40)&&(this.show(e),e.stopPropagation());return}if(e.altKey&&e.keyCode===38){e.preventDefault();e.stopPropagation();this.hide();return}dateChanged=!1;switch(e.keyCode){case 27:this.hide();e.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;dir=e.keyCode==37?-1:1;e.ctrlKey?(newDate=this.moveYear(this.date,dir),newViewDate=this.moveYear(this.viewDate,dir),this._trigger("changeYear",this.viewDate)):e.shiftKey?(newDate=this.moveMonth(this.date,dir),newViewDate=this.moveMonth(this.viewDate,dir),this._trigger("changeMonth",this.viewDate)):(newDate=new Date(this.date),newDate.setUTCDate(this.date.getUTCDate()+dir),newViewDate=new Date(this.viewDate),newViewDate.setUTCDate(this.viewDate.getUTCDate()+dir));this.dateWithinRange(newDate)&&(this.date=newDate,this.viewDate=newViewDate,this.setValue(),this.update(),e.preventDefault(),dateChanged=!0);e.stopPropagation();break;case 38:case 40:if(!this.o.keyboardNavigation)break;dir=e.keyCode==38?-1:1;e.ctrlKey?(newDate=this.moveYear(this.date,dir),newViewDate=this.moveYear(this.viewDate,dir),this._trigger("changeYear",this.viewDate)):e.shiftKey?(newDate=this.moveMonth(this.date,dir),newViewDate=this.moveMonth(this.viewDate,dir),this._trigger("changeMonth",this.viewDate)):(newDate=new Date(this.date),newDate.setUTCDate(this.date.getUTCDate()+dir*7),newViewDate=new Date(this.viewDate),newViewDate.setUTCDate(this.viewDate.getUTCDate()+dir*7));this.dateWithinRange(newDate)&&(this.date=newDate,this.viewDate=newViewDate,this.setValue(),this.update(),e.preventDefault(),dateChanged=!0);e.stopPropagation();break;case 13:originalElementValue=this.element.val();this.setValue();newElementValue=this.element.val();newElementValue&&newElementValue!==originalElementValue&&(dateChanged=!0);this.hide();e.preventDefault();e.stopPropagation();break;case 9:this.hide()}dateChanged&&(this._trigger("changeDate"),this.isInput?element=this.element:this.component&&(element=this.element.find("input")),element&&element.change())},showMode:function(dir){dir&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+dir)));this.picker.find(">div").hide().filter(".cognito-datepicker-"+DPGlobal.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()}};DateRangePicker=function(element,options){this.element=$(element);this.inputs=$.map(options.inputs,function(i){return i.jquery?i[0]:i});delete options.inputs;$(this.inputs).datepicker(options).bind("changeDate",$.proxy(this.dateUpdated,this));this.pickers=$.map(this.inputs,function(i){return $(i).data("datepicker")});this.updateDates()};DateRangePicker.prototype={updateDates:function(){this.dates=$.map(this.pickers,function(i){return i.date});this.updateRanges()},updateRanges:function(){var range=$.map(this.dates,function(d){return d.valueOf()});$.each(this.pickers,function(i,p){p.setRange(range)})},dateUpdated:function(e){var dp=$(e.target).data("datepicker"),new_date=dp.getUTCDate(),i=$.inArray(e.target,this.inputs),l=this.inputs.length;if(i!=-1){if(new_date<this.dates[i])while(i>=0&&new_date<this.dates[i])this.pickers[i--].setUTCDate(new_date);else if(new_date>this.dates[i])while(i<l&&new_date>this.dates[i])this.pickers[i++].setUTCDate(new_date);this.updateDates()}},remove:function(){$.map(this.pickers,function(p){p.remove()});delete this.element.data().datepicker}};old=$.fn.datepicker;$.fn.datepicker=function(option){var args=Array.apply(null,arguments),internal_return;return args.shift(),this.each(function(){var $this=$(this),data=$this.data("datepicker"),options=typeof option=="object"&&option,ropts;if(!data){var elopts=opts_from_el(this,"date"),xopts=$.extend({},defaults,elopts,options),locopts=opts_from_locale(xopts.language),opts=$.extend({},defaults,locopts,options,elopts);$this.is(".input-daterange")||opts.inputs?(ropts={inputs:opts.inputs||$this.find("input").toArray()},$this.data("datepicker",data=new DateRangePicker(this,$.extend(opts,ropts)))):$this.data("datepicker",data=new Datepicker(this,opts))}if(typeof option=="string"&&typeof data[option]=="function"&&(internal_return=data[option].apply(data,args),internal_return!==undefined))return!1}),internal_return!==undefined?internal_return:this};defaults=$.fn.datepicker.defaults={autoclose:!0,beforeShowDay:$.noop,calendarWeeks:!1,clearBtn:!1,daysOfWeekDisabled:[],endDate:Infinity,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,orientation:"auto",rtl:!1,startDate:-Infinity,startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0};locale_opts=$.fn.datepicker.locale_opts=["format","rtl","weekStart"];$.fn.datepicker.Constructor=Datepicker;dates=$.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}};DPGlobal={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(year){return year%4==0&&year%100!=0||year%400==0},getDaysInMonth:function(year,month){return[31,DPGlobal.isLeapYear(year)?29:28,31,30,31,30,31,31,30,31,30,31][month]},validParts:/dd?|DD?|mmm|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(format){var separators=format.replace(this.validParts,'\0').split('\0'),parts=format.match(this.validParts);if(!separators||!separators.length||!parts||parts.length===0)throw new Error("Invalid date format.");return{separators:separators,parts:parts}},parseDate:function(date,format,language){var part_re,parts,part,dir,fparts,cnt,i,_date,s;if(date instanceof Date)return date;if(typeof format=="string"&&(format=DPGlobal.parseFormat(format)),/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){for(part_re=/([\-+]\d+)([dmwy])/,parts=date.match(/([\-+]\d+)([dmwy])/g),date=new Date,i=0;i<parts.length;i++){part=part_re.exec(parts[i]);dir=parseInt(part[1]);switch(part[2]){case"d":date.setUTCDate(date.getUTCDate()+dir);break;case"m":date=Datepicker.prototype.moveMonth.call(Datepicker.prototype,date,dir);break;case"w":date.setUTCDate(date.getUTCDate()+dir*7);break;case"y":date=Datepicker.prototype.moveYear.call(Datepicker.prototype,date,dir)}}return UTCDate(date.getUTCFullYear(),date.getUTCMonth(),date.getUTCDate(),0,0,0)}var parts=date&&date.match(this.nonpunctuation)||[],date=new Date,parsed={},setters_order=["yyyy","yy","M","MM","m","mm","d","dd"],setters_map={yyyy:function(d,v){return d.setUTCFullYear(v)},yy:function(d,v){return d.setUTCFullYear(2e3+v)},m:function(d,v){if(isNaN(d))return d;for(v-=1;v<0;)v+=12;for(v%=12,d.setUTCMonth(v);d.getUTCMonth()!=v;)d.setUTCDate(d.getUTCDate()-1);return d},d:function(d,v){return d.setUTCDate(v)}},val,filtered,part;if(setters_map.M=setters_map.MM=setters_map.mm=setters_map.m,setters_map.dd=setters_map.d,date=UTCDate(date.getFullYear(),date.getMonth(),date.getDate(),0,0,0),fparts=format.parts.slice(),parts.length!=fparts.length&&(fparts=$(fparts).filter(function(i,p){return $.inArray(p,setters_order)!==-1}).toArray()),parts.length==fparts.length){for(i=0,cnt=fparts.length;i<cnt;i++){if(val=parseInt(parts[i],10),part=fparts[i],isNaN(val))switch(part){case"MM":filtered=$(dates[language].months).filter(function(){var m=this.slice(0,parts[i].length),p=parts[i].slice(0,m.length);return m==p});val=$.inArray(filtered[0],dates[language].months)+1;break;case"M":filtered=$(dates[language].monthsShort).filter(function(){var m=this.slice(0,parts[i].length),p=parts[i].slice(0,m.length);return m==p});val=$.inArray(filtered[0],dates[language].monthsShort)+1}parsed[part]=val}for(i=0;i<setters_order.length;i++)s=setters_order[i],s in parsed&&!isNaN(parsed[s])&&(_date=new Date(date),setters_map[s](_date,parsed[s]),isNaN(_date)||(date=_date))}return date},formatDate:function(date,format,language){var val,date,seps,i,cnt;for(typeof format=="string"&&(format=DPGlobal.parseFormat(format)),val={d:date.getUTCDate(),D:dates[language].daysShort[date.getUTCDay()],DD:dates[language].days[date.getUTCDay()],m:date.getUTCMonth()+1,mmm:dates[language].monthsShort[date.getUTCMonth()],M:dates[language].monthsShort[date.getUTCMonth()],MM:dates[language].months[date.getUTCMonth()],yy:date.getUTCFullYear().toString().substring(2),yyyy:date.getUTCFullYear()},val.dd=(val.d<10?"0":"")+val.d,val.mm=(val.m<10?"0":"")+val.m,date=[],seps=$.extend([],format.separators),i=0,cnt=format.parts.length;i<=cnt;i++)seps.length&&date.push(seps.shift()),date.push(val[format.parts[i]]);return date.join("")},headTemplate:'<thead><tr><th class="prev">&laquo;<\/th><th colspan="5" class="datepicker-switch"><\/th><th class="next">&raquo;<\/th><\/tr><\/thead>',contTemplate:'<tbody><tr><td colspan="7"><\/td><\/tr><\/tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"><\/th><\/tr><tr><th colspan="7" class="clear"><\/th><\/tr><\/tfoot>'};DPGlobal.template='<div class="cognito-datepicker"><div class="cognito-datepicker-days"><table class=" table-condensed">'+DPGlobal.headTemplate+"<tbody><\/tbody>"+DPGlobal.footTemplate+'<\/table><\/div><div class="cognito-datepicker-months"><table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+'<\/table><\/div><div class="cognito-datepicker-years"><table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+"<\/table><\/div><\/div>";$.fn.datepicker.DPGlobal=DPGlobal;$.fn.datepicker.noConflict=function(){return $.fn.datepicker=old,this};$(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(e){var $this=$(this);$this.data("datepicker")||(e.preventDefault(),$this.datepicker("show"))});$(function(){$('[data-provide="datepicker-inline"]').datepicker()})})(jQuery)
})();
;(function() { if (Cognito.config.scripts.indexOf('cognito-timepicker') >= 0) return; else Cognito.config.scripts.push('cognito-timepicker');/*!
 * Timepicker Component for Twitter Bootstrap
 *
 * Copyright 2013 Joris de Wit
 *
 * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
(function($,window,document,undefined){"use strict";var Timepicker=function(element,options){this.widget="";this.$element=$(element);this.defaultTime=options.defaultTime;this.disableFocus=options.disableFocus;this.isOpen=options.isOpen;this.minuteStep=options.minuteStep;this.modalBackdrop=options.modalBackdrop;this.secondStep=options.secondStep;this.showInputs=options.showInputs;this.showMeridian=options.showMeridian;this.timeSeparator=options.timeSeparator;this.showMeridian&&(this.AMDesignator=options.AMDesignator,this.PMDesignator=options.PMDesignator);this.showSeconds=options.showSeconds;this.template=options.template;this.appendWidgetTo=options.appendWidgetTo;this.twoDigitHourFormat=options.twoDigitHourFormat;this._init()};Timepicker.prototype={constructor:Timepicker,_init:function(){var self=this;if(this.$element.parent().hasClass("c-editor-time")){this.$element.parent(".c-editor-time").parent().find(".c-editor-time-icon").on({"click.timepicker":$.proxy(this.toggleWidget,this)});this.$element.on({"focus.timepicker":$.proxy(function(e){this.$element.is(".icon-picker-only, .suppress-picker")||this.showOrHighlight(e)},this),"click.timepicker":$.proxy(function(e){this.$element.is(".icon-picker-only")||this.showOrHighlight(e)},this),"keydown.timepicker":$.proxy(this.elementKeydown,this),"blur.timepicker":$.proxy(this.blurElement,this)})}else if(this.template)this.$element.on({"focus.timepicker":$.proxy(this.toggleWidget,this),"click.timepicker":$.proxy(this.toggleWidget,this),"blur.timepicker":$.proxy(this.blurElement,this)});else this.$element.on({"focus.timepicker":$.proxy(this.showOrHighlight,this),"click.timepicker":$.proxy(this.showOrHighlight,this),"keydown.timepicker":$.proxy(this.elementKeydown,this),"blur.timepicker":$.proxy(this.blurElement,this)});this.$widget=this.template!==!1?$(this.getTemplate()).appendTo("body").on("click",$.proxy(this.widgetClick,this)):!1;this.showInputs&&this.$widget!==!1&&this.$widget.find("input").each(function(){$(this).on({"click.timepicker":function(){$(this).select()},"keydown.timepicker":$.proxy(self.widgetKeydown,self),"change.timepicker":$.proxy(self.updateFromWidgetInputs,self),"input.timepicker":function(){self.widgetModified=!0}})});this.setDefaultTime(this.defaultTime)},blurElement:function(){this.highlightedUnit=undefined;this.updateFromElementVal()},decrementHour:function(){if(this.showMeridian)if(this.hour===1)this.hour=12;else{if(this.hour===12)return this.hour--,this.toggleMeridian();if(this.hour===0)return this.hour=11,this.toggleMeridian();this.hour--}else this.hour===0?this.hour=23:this.hour--;this.update()},decrementMinute:function(step){var newVal;newVal=step?this.minute-step:this.minute-this.minuteStep;newVal<0?(this.decrementHour(),this.minute=newVal+60):this.minute=newVal;this.update()},decrementSecond:function(){var newVal=this.second-this.secondStep;newVal<0?(this.decrementMinute(!0),this.second=newVal+60):this.second=newVal;this.update()},elementKeydown:function(e){switch(e.keyCode){case 9:if(this.updateFromElementVal(),this.$element.val())if(e.shiftKey)this.highlightedUnit==="hour"?this.hideWidget():(e.preventDefault(),this.highlightPrevUnit());else switch(this.highlightedUnit){case"hour":e.preventDefault();this.highlightNextUnit();break;case"minute":this.showMeridian||this.showSeconds?(e.preventDefault(),this.highlightNextUnit()):this.hideWidget();break;case"second":this.showMeridian?(e.preventDefault(),this.highlightNextUnit()):this.hideWidget();break;default:this.hideWidget()}else this.hideWidget();break;case 13:e.preventDefault();this.updateFromElementVal();this.isOpen&&(e.stopPropagation(),this.hideWidget());break;case 27:this.updateFromElementVal();this.hideWidget();break;case 37:if(e.preventDefault(),this.isOpen&&e.stopPropagation(),!this.$element.val())break;this.highlightedUnit?(this.highlightPrevUnit(),this.updateFromElementVal()):this.highlightUnit();break;case 38:if(e.preventDefault(),this.isOpen){if(e.stopPropagation(),e.altKey)return this.hideWidget()}else break;switch(this.highlightedUnit){case"hour":this.incrementHour();this.highlightHour();break;case"minute":this.incrementMinute();this.highlightMinute();break;case"second":this.incrementSecond();this.highlightSecond();break;case"meridian":this.toggleMeridian();this.highlightMeridian()}break;case 39:if(e.preventDefault(),this.isOpen&&e.stopPropagation(),!this.$element.val())break;this.highlightedUnit?(this.updateFromElementVal(),this.highlightNextUnit()):this.highlightUnit();break;case 40:if(e.preventDefault(),!this.isOpen&&e.altKey){this.showWidget();e.stopPropagation();break}if(this.isOpen)e.stopPropagation();else break;switch(this.highlightedUnit){case"hour":this.decrementHour();this.highlightHour();break;case"minute":this.decrementMinute();this.highlightMinute();break;case"second":this.decrementSecond();this.highlightSecond();break;case"meridian":this.toggleMeridian();this.highlightMeridian()}}},formatTime:function(hour,minute,second,meridian){return hour=this.twoDigitHourFormat&hour<10?"0"+hour:hour,minute=minute<10?"0"+minute:minute,second=second<10?"0"+second:second,hour+this.timeSeparator+minute+(this.showSeconds?this.timeSeparator+second:"")+(this.showMeridian?" "+meridian:"")},getCursorPosition:function(){var input=this.$element.get(0),sel,selLen;return"selectionStart"in input?input.selectionStart:document.selection?(input.focus(),sel=document.selection.createRange(),selLen=document.selection.createRange().text.length,sel.moveStart("character",-input.value.length),sel.text.length-selLen):void 0},getTemplate:function(){var template,hourTemplate,minuteTemplate,secondTemplate,meridianTemplate,templateContent;this.showInputs?(hourTemplate='<input type="text" name="hour" class="cognito-timepicker-hour" maxlength="2"/>',minuteTemplate='<input type="text" name="minute" class="cognito-timepicker-minute" maxlength="2"/>',secondTemplate='<input type="text" name="second" class="cognito-timepicker-second" maxlength="2"/>',meridianTemplate='<input type="text" name="meridian" class="cognito-timepicker-meridian" maxlength="2"/>'):(hourTemplate='<span class="cognito-timepicker-hour"><\/span>',minuteTemplate='<span class="cognito-timepicker-minute"><\/span>',secondTemplate='<span class="cognito-timepicker-second"><\/span>',meridianTemplate='<span class="cognito-timepicker-meridian"><\/span>');templateContent='<table><tr><td><a href="#" data-action="incrementHour"><i class="icon-chevron-up"><\/i><\/a><\/td><td class="separator">&nbsp;<\/td><td><a href="#" data-action="incrementMinute"><i class="icon-chevron-up"><\/i><\/a><\/td>'+(this.showSeconds?'<td class="separator">&nbsp;<\/td><td><a href="#" data-action="incrementSecond"><i class="icon-chevron-up"><\/i><\/a><\/td>':"")+(this.showMeridian?'<td class="separator">&nbsp;<\/td><td class="meridian-column"><a href="#" data-action="toggleMeridian"><i class="icon-chevron-up"><\/i><\/a><\/td>':"")+"<\/tr><tr><td>"+hourTemplate+'<\/td> <td class="separator">'+this.timeSeparator+"<\/td><td>"+minuteTemplate+"<\/td> "+(this.showSeconds?'<td class="separator">'+this.timeSeparator+"<\/td><td>"+secondTemplate+"<\/td>":"")+(this.showMeridian?'<td class="separator">&nbsp;<\/td><td>'+meridianTemplate+"<\/td>":"")+'<\/tr><tr><td><a href="#" data-action="decrementHour"><i class="icon-chevron-down"><\/i><\/a><\/td><td class="separator"><\/td><td><a href="#" data-action="decrementMinute"><i class="icon-chevron-down"><\/i><\/a><\/td>'+(this.showSeconds?'<td class="separator">&nbsp;<\/td><td><a href="#" data-action="decrementSecond"><i class="icon-chevron-down"><\/i><\/a><\/td>':"")+(this.showMeridian?'<td class="separator">&nbsp;<\/td><td><a href="#" data-action="toggleMeridian"><i class="icon-chevron-down"><\/i><\/a><\/td>':"")+"<\/tr><\/table>";switch(this.template){case"modal":template='<div class="cognito-timepicker-widget modal hide fade in" data-backdrop="'+(this.modalBackdrop?"true":"false")+'"><div class="modal-header"><a href="#" class="close" data-dismiss="modal">×<\/a><h3>Pick a Time<\/h3><\/div><div class="modal-content">'+templateContent+'<\/div><div class="modal-footer"><a href="#" class="btn btn-primary" data-dismiss="modal">OK<\/a><\/div><\/div>';break;case"dropdown":template='<div class="cognito-timepicker-widget cognito-dropdown-menu">'+templateContent+"<\/div>"}return template},getTime:function(){return this.formatTime(this.hour,this.minute,this.second,this.meridian)},hideWidget:function(){this.isOpen!==!1&&(this.showInputs&&this.$widget!==!1&&this.widgetModified&&this.updateFromWidgetInputs(),this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.template==="modal"&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),$(document).off("mousedown.timepicker"),$(document).off("resize.timepicker"),this.isOpen=!1)},showOrHighlight:function(){this.isOpen||this.showWidget();this.highlightUnit()},highlightUnit:function(){this.position=this.getCursorPosition();this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian&&this.highlightMeridian();break;case"second":this.showMeridian&&this.highlightMeridian()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightElement:function(startIndex,endIndex){var $element=this.$element.get(0),mod=!this.twoDigitHourFormat&&this.hour<10?-1:0;startIndex=startIndex+mod<0?0:startIndex+mod;endIndex=endIndex+mod>$($element).val().length?$($element).val().length:endIndex+mod;$element.setSelectionRange&&setTimeout(function(){$element.setSelectionRange(startIndex,endIndex)},0)},highlightHour:function(){this.highlightedUnit="hour";this.highlightElement(0,2)},highlightMinute:function(){this.highlightedUnit="minute";this.highlightElement(3,5)},highlightSecond:function(){this.highlightedUnit="second";this.highlightElement(6,8)},highlightMeridian:function(){this.highlightedUnit="meridian";this.showSeconds?this.highlightElement(9,11):this.highlightElement(6,8)},incrementHour:function(){if(this.showMeridian){if(this.hour===11)return this.hour++,this.toggleMeridian();this.hour===12&&(this.hour=0)}this.hour===23?this.hour=0:this.hour++;this.update()},incrementMinute:function(step){var newVal;newVal=step?this.minute+step:this.minute+this.minuteStep-this.minute%this.minuteStep;newVal>59?(this.incrementHour(),this.minute=newVal-60):this.minute=newVal;this.update()},incrementSecond:function(){var newVal=this.second+this.secondStep-this.second%this.secondStep;newVal>59?(this.incrementMinute(!0),this.second=newVal-60):this.second=newVal;this.update()},remove:function(){$("document").off(".timepicker");this.$widget&&this.$widget.remove();delete this.$element.data().timepicker},setDefaultTime:function(defaultTime){if(this.$element.val())this.updateFromElementVal();else if(defaultTime==="current"){var dTime=new Date,hours=dTime.getHours(),minutes=Math.floor(dTime.getMinutes()/this.minuteStep)*this.minuteStep,seconds=Math.floor(dTime.getSeconds()/this.secondStep)*this.secondStep,meridian=this.AMDesignator;this.showMeridian&&(hours===0?hours=12:hours>=12?(hours>12&&(hours=hours-12),meridian=this.PMDesignator):meridian=this.AMDesignator);this.hour=hours;this.minute=minutes;this.second=seconds;this.meridian=meridian}else defaultTime===!1?(this.hour=0,this.minute=0,this.second=0,this.meridian=this.AMDesignator):this.setTime(defaultTime)},setTime:function(time){var arr,timeArray;this.showMeridian?(arr=time.split(" "),timeArray=arr[0].split(this.timeSeparator),this.meridian=time.substr(time.indexOf(" ")+1)):timeArray=time.split(this.timeSeparator);this.hour=parseInt(timeArray[0],10);this.minute=parseInt(timeArray[1],10);this.second=parseInt(timeArray[2],10);isNaN(this.hour)&&(this.hour=0);isNaN(this.minute)&&(this.minute=0);this.showMeridian?(this.hour>12?this.hour=12:this.hour<1&&(this.hour=12),this.meridian.toUpperCase()!==this.AMDesignator.toUpperCase()&&this.meridian.toUpperCase()!==this.PMDesignator.toUpperCase()&&(this.meridian=this.AMDesignator)):this.hour>=24?this.hour=23:this.hour<0&&(this.hour=0);this.minute<0?this.minute=0:this.minute>=60&&(this.minute=59);this.showSeconds&&(isNaN(this.second)?this.second=0:this.second<0?this.second=0:this.second>=60&&(this.second=59));this.update()},place:function(){var scrollTop=$(window).scrollTop(),widgetWidth=this.$widget.width(),widgetHeight=this.$widget.height(),windowWidth=$(window).width(),windowHeight=$(window).height(),offset=this.$element.offset(),height=this.$element.outerHeight(!1),width=this.$element.outerWidth(!1),top=offset.top,left=offset.left,yorient,topOverflow,bottomOverflow;this.$widget.removeClass("cognito-timepicker-orient-top cognito-timepicker-orient-bottom");topOverflow=-scrollTop+offset.top-widgetHeight;bottomOverflow=scrollTop+windowHeight-(offset.top+height+widgetHeight);yorient=Math.max(topOverflow,bottomOverflow)===bottomOverflow?"top":"bottom";this.$widget.addClass("cognito-timepicker-orient-"+yorient);yorient==="top"?top+=height+6:top-=widgetHeight+parseInt(this.$widget.css("padding-top"))+8;this.$widget.css({top:top,left:left})},toggleWidget:function(){this.isOpen===!0?this.hideWidget():this.showWidget()},showWidget:function(){if(!this.isOpen&&!this.$element.is(":disabled")){this.widgetModified=!1;(this.$element.val()===""||this.getTime()=="0"+this.timeSeparator+"00 "+this.AMDesignator)&&this.setDefaultTime(this.defaultTime);this.updateWidget();this.place();var self=this;$(document).on("mousedown.timepicker",function(e){$(e.target).closest(".cognito-timepicker-widget").length!==0||(self.$element.is(e.target)||e.target.className.indexOf("c-editor-time")>-1||e.target.className.indexOf("icon-time")>-1||e.target.className.indexOf("time-icon")>-1)&&$(e.target).parents(".c-date-time")[0]===$(self.$element).parents(".c-date-time")[0]||self.hideWidget()});$(document).on("resize.timepicker",function(){self.place()});if(this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.disableFocus&&this.$element.blur(),this.updateFromElementVal(),this.template==="modal"&&this.$widget.modal)this.$widget.modal("show").on("hidden",$.proxy(this.hideWidget,this));else this.isOpen===!1&&this.$widget.addClass("open");this.isOpen=!0}},toggleMeridian:function(){this.meridian=this.meridian===this.AMDesignator?this.PMDesignator:this.AMDesignator;this.update()},update:function(){this.updateElement();this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}});this.updateWidget()},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){var val=this.$element.val();val&&this.setTime(val)},updateWidget:function(){if(this.$widget!==!1){var hour=this.hour<10?"0"+this.hour:this.hour,minute=this.minute<10?"0"+this.minute:this.minute,second=this.second<10?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.cognito-timepicker-hour").val(hour),this.$widget.find("input.cognito-timepicker-minute").val(minute),this.showSeconds&&this.$widget.find("input.cognito-timepicker-second").val(second),this.showMeridian&&this.$widget.find("input.cognito-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.cognito-timepicker-hour").text(hour),this.$widget.find("span.cognito-timepicker-minute").text(minute),this.showSeconds&&this.$widget.find("span.cognito-timepicker-second").text(second),this.showMeridian&&this.$widget.find("span.cognito-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(this.$widget!==!1){var time=$("input.cognito-timepicker-hour",this.$widget).val()+this.timeSeparator+$("input.cognito-timepicker-minute",this.$widget).val()+(this.showSeconds?this.timeSeparator+$("input.cognito-timepicker-second",this.$widget).val():"")+(this.showMeridian?" "+$("input.cognito-timepicker-meridian",this.$widget).val():"");this.setTime(time)}},widgetClick:function(e){e.stopPropagation();e.preventDefault();var action=$(e.target).closest("a").data("action");action&&this[action]()},widgetKeydown:function(e){var $input=$(e.target).closest("input"),name=$input.attr("name");switch(e.keyCode){case 9:if(this.showMeridian){if(name==="meridian")return this.hideWidget()}else if(this.showSeconds){if(name==="second")return this.hideWidget()}else if(name==="minute")return this.hideWidget();this.updateFromWidgetInputs();break;case 27:this.hideWidget();break;case 38:e.preventDefault();switch(name){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}break;case 40:e.preventDefault();switch(name){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}}}};$.fn.timepicker=function(option){var args=Array.apply(null,arguments);return args.shift(),this.each(function(){var $this=$(this),data=$this.data("timepicker"),options=typeof option=="object"&&option;data||$this.data("timepicker",data=new Timepicker(this,$.extend({},$.fn.timepicker.defaults,options,$(this).data())));typeof option=="string"&&data[option].apply(data,args)})};$.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,secondStep:15,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:".cognito-timepicker",timeSeparator:":",AMDesignator:"AM",PMDesignator:"PM",twoDigitHourFormat:!1};$.fn.timepicker.Constructor=Timepicker})(jQuery,window,document)
})();
;(function() { if (Cognito.config.scripts.indexOf('cognito-typeahead') >= 0) return; else Cognito.config.scripts.push('cognito-typeahead');!function($){"use strict";var Typeahead=function(element,options){this.$element=$(element);this.options=$.extend({},$.fn.typeahead.defaults,options);this.matcher=this.options.matcher||this.matcher;this.sorter=this.options.sorter||this.sorter;this.highlighter=this.options.highlighter||this.highlighter;this.updater=this.options.updater||this.updater;this.source=this.options.source||$.map(this.$element[0].__msajaxbindings[0]._source.get_options(),function(val){return val.get_displayValue()});this.$menu=$(this.options.menu);this.shown=!1;this.listen()},old;Typeahead.prototype={constructor:Typeahead,select:function(){var val=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(val)).change(),$simulateMutationEvent(this.$element.get(0),"change",!1,!0),this.hide()},updater:function(item){return item},show:function(){var pos=$.extend({},this.$element.position(),{height:this.$element[0].offsetHeight}),$pageContainer,currentHeight,maxHeight,$modal,menuInitialHeight,menuNewHeight;return this.$menu.insertAfter(this.$element).css({top:pos.top+pos.height,left:pos.left}).show(),$pageContainer=this.$element.closest(".c-forms-pages"),$pageContainer.length&&(currentHeight=this.$menu.get(0).offsetHeight,maxHeight=$pageContainer.get(0).offsetHeight-(pos.top+pos.height),currentHeight>maxHeight&&this.$menu.css({height:maxHeight,overflow:"auto"})),$modal=this.$menu.closest(".c-modal.c-expression-builder-dialog--is-advanced"),$modal.length&&(menuInitialHeight=this.$menu.height(),menuNewHeight=$modal.height()+$modal.offset().top-this.$menu.offset().top,menuNewHeight<menuInitialHeight&&this.$menu.css({height:menuNewHeight})),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var items;return(this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength)?this.shown?this.hide():this:(items=$.isFunction(this.source)?this.source(this.query,$.proxy(this.process,this)):this.source,items?this.process(items):this)},process:function(items){var that=this;return(items=$.grep(items,function(item){return that.matcher(item)}),items=this.sorter(items),!items.length)?this.shown?this.hide():this:this.render(items.slice(0,this.options.items)).show()},matcher:function(item){return~item.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(items){for(var beginswith=[],caseSensitive=[],caseInsensitive=[],item;item=items.shift();)item.toLowerCase().indexOf(this.query.toLowerCase())?~item.indexOf(this.query)?caseSensitive.push(item):caseInsensitive.push(item):beginswith.push(item);return beginswith.concat(caseSensitive,caseInsensitive)},highlighter:function(item){var query=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return item.replace(new RegExp("("+query+")","ig"),function($1,match){return"<strong>"+match+"<\/strong>"})},render:function(items){var that=this;return items=$(items).map(function(i,item){return i=$(that.options.item).attr("data-value",item),i.find("a").html(that.highlighter(item)),i[0]}),items.first().addClass("active"),this.$menu.html(items),this},next:function(){var active=this.$menu.find(".active").removeClass("active"),next=active.next(),index,liPos;next.length||(next=$(this.$menu.find("li")[0]));next.addClass("active");index=parseInt(next.attr("data-index"));liPos=(index+1)*26;index==0?this.$menu.scrollTop(0):liPos>this.$menu.height()+this.$menu.scrollTop()&&this.$menu.scrollTop(liPos-this.$menu.height())},prev:function(){var active=this.$menu.find(".active").removeClass("active"),prev=active.prev(),isLast=!1,index,liPos;prev.length||(prev=this.$menu.find("li").last(),isLast=!0);prev.addClass("active");index=parseInt(prev.attr("data-index"));liPos=index*26;isLast?this.$menu.scrollTop(liPos):liPos<this.$menu.scrollTop()&&this.$menu.scrollTop(liPos)},listen:function(){this.$element.on("focus",$.proxy(this.focus,this)).on("blur",$.proxy(this.blur,this)).on("keyup",$.proxy(this.keyup,this));if(this.eventSupported("keydown"))this.$element.on("keydown",$.proxy(this.keydown,this));this.$menu.on("click",$.proxy(this.click,this)).on("mouseenter","li",$.proxy(this.mouseenter,this)).on("mouseleave","li",$.proxy(this.mouseleave,this)).on("mouseenter",$.proxy(this.mouseentermenu,this)).on("mouseleave",$.proxy(this.mouseleavemenu,this)).on("mouseup",$.proxy(this.mouseup,this))},eventSupported:function(eventName){var isSupported=eventName in this.$element;return isSupported||(this.$element.setAttribute(eventName,"return;"),isSupported=typeof this.$element[eventName]=="function"),isSupported},move:function(e){if(this.shown){switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault();this.prev();break;case 40:e.preventDefault();this.next()}e.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~$.inArray(e.keyCode,[40,38,9,13,27]);this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation();e.preventDefault()},focus:function(){this.focused=!0},blur:function(){this.focused=!1;!this.mousedovermenu&&this.shown&&this.hide()},click:function(e){e.stopPropagation();e.preventDefault();this.select();this.$element.focus()},mouseenter:function(e){this.mousedover=!0;this.$menu.find(".active").removeClass("active");$(e.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1},mouseentermenu:function(){this.mousedovermenu=!0},mouseleavemenu:function(){this.mousedovermenu=!1},mouseup:function(){var selectedElement=this.$menu.find(".active");this.mousedovermenu&&!this.mousedover&&(this.focusItem=selectedElement,this.$element.focus())}};old=$.fn.typeahead;$.fn.typeahead=function(option){return this.each(function(){var $this=$(this),data=$this.data("typeahead"),options=typeof option=="object"&&option;data||$this.data("typeahead",data=new Typeahead(this,options));typeof option=="string"&&data[option]()})};$.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu scrollbar"><\/ul>',item:'<li><a href="#"><\/a><\/li>',minLength:1};$.fn.typeahead.Constructor=Typeahead;$.fn.typeahead.noConflict=function(){return $.fn.typeahead=old,this};$(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(){var $this=$(this);$this.data("typeahead")||$this.typeahead($this.data())})}(jQuery);!function($){"use strict";var BetterTypeahead={lookup:function(){var items;return(this.query=this.$element.val()||"",this.query.length<this.options.minLength)?this.shown?this.hide():this:(items=$.isFunction(this.source)?this.source(this.query,$.proxy(this.process,this)):this.source,items?this.process(items):this)},process:function(items){var that=this;if(items=$.grep(items,function(item){return that.matcher(item)}),items=this.sorter(items),!items.length)return this.shown?this.hide():this;if(this.query.length&&(items=items.slice(0,this.options.items)),this.focusItem){this.focusItem=null;return}return this.render(items).show()},render:function(items){var that=this;if(items=$(items).map(function(i,item){var li=$(that.options.item).attr("data-value",item);return li.attr("data-index",i),li.find("a").html(that.highlighter(item)),li[0]}),this.query.length>0){if(this.focusItem)return;items.first().addClass("active")}return this.$menu.html(items),this},move:function(e){if(this.shown)switch(e.keyCode){case 9:case 13:this.options.useTabToSelect===!0?e.preventDefault():this.shown&&(this.select(),this.hide());break;case 27:e.preventDefault();break;case 38:e.preventDefault();this.prev();e.stopPropagation();break;case 40:e.preventDefault();this.next();e.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~$.inArray(e.keyCode,[40,38,9,13,27]);this.move(e)},keyup:function(e){switch(e.keyCode){case 37:case 39:return;case 40:case 38:case 16:case 17:case 18:break;case 13:case 9:if(!this.shown)return;this.select();this.show();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation();e.preventDefault()},focus:function(e){this.focused=!0;this.mousedover||this.lookup(e)}};$.extend($.fn.typeahead.Constructor.prototype,BetterTypeahead)}(jQuery)
})();
;(function() { if (Cognito.config.scripts.indexOf('cognito-toggle') >= 0) return; else Cognito.config.scripts.push('cognito-toggle');/*! ============================================================
 * bootstrapSwitch v1.8 by Larentis Mattia @SpiritualGuru
 * http://www.larentis.eu/
 *
 * Enhanced for radiobuttons by Stein, Peter @BdMdesigN
 * http://www.bdmdesign.org/
 *
 * Project site:
 * http://www.larentis.eu/switch/
 * ============================================================
 * Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 * ============================================================ */
!function($){"use strict";$.fn.bootstrapSwitch=function(method){var methods={init:function(){return this.each(function(){var $element=$(this).parent(),$input=$(this),$div,$switchLeft,$switchRight,$label,$form=$element.closest("form"),myClasses="",classes=$element.attr("class"),color,moving,onLabel="ON",offLabel="OFF",icon=!1,textLabel=!1,changeStatus;$element.addClass("has-switch");$element.data("on")!==undefined&&(color="switch-"+$element.data("on"));$element.data("on-label")!==undefined&&(onLabel=$element.data("on-label"));$element.data("off-label")!==undefined&&(offLabel=$element.data("off-label"));$element.data("label-icon")!==undefined&&(icon=$element.data("label-icon"));$element.data("text-label")!==undefined&&(textLabel=$element.data("text-label"));$switchLeft=$("<span>").addClass("switch-left").addClass(myClasses).addClass(color).html(""+onLabel+"");color="";$element.data("off")!==undefined&&(color="switch-"+$element.data("off"));$switchRight=$("<span>").addClass("switch-right").addClass(myClasses).addClass(color).html(""+offLabel+"");$label=$("<label>").html("&nbsp;").addClass(myClasses).attr("for",$input.attr("id"));icon&&$label.html('<i class="icon '+icon+'"><\/i>');textLabel&&$label.html(""+textLabel+"");$div=$input.wrap($("<div>")).parent().data("animated",!1);$element.data("animated")!==!1&&$div.addClass("switch-animate").data("animated",!0);$div.append($switchLeft).append($label).append($switchRight);$element.find(">div").addClass($input.is(":checked")?"switch-on":"switch-off");$input.is(":disabled")&&$(this).addClass("deactivate");changeStatus=function($this){$element.parent("label").is(".label-change-switch")||$this.siblings("label").trigger("mousedown").trigger("mouseup").trigger("click")};$element.on("keydown",function(e){e.keyCode===32&&(e.stopImmediatePropagation(),e.preventDefault(),changeStatus($(e.target).find("span:first")))});$switchLeft.on("click",function(){changeStatus($(this))});$switchRight.on("click",function(){changeStatus($(this))});$input.on("change",function(e,skipOnChange){var $this=$(this),$element=$this.parent(),thisState=$this.is(":checked"),state=$element.is(".switch-off");if(e.preventDefault(),$element.css("left",""),state===thisState){if(thisState?$element.removeClass("switch-off").addClass("switch-on"):$element.removeClass("switch-on").addClass("switch-off"),$element.data("animated")!==!1&&$element.addClass("switch-animate"),typeof skipOnChange=="boolean"&&skipOnChange)return;$element.parent().trigger("switch-change",{el:$this,value:thisState})}});$element.find("label").on("mousedown touchstart",function(e){var $this=$(this);if(moving=!1,e.preventDefault(),e.stopImmediatePropagation(),$this.closest("div").removeClass("switch-animate"),$this.closest(".has-switch").is(".deactivate"))$this.unbind("click");else if($this.closest(".switch-on").parent().is(".radio-no-uncheck"))$this.unbind("click");else{$this.on("mousemove touchmove",function(e){var $element=$(this).parents(".has-switch"),relativeX=(e.pageX||e.originalEvent.targetTouches[0].pageX)-$element.offset().left,percent=relativeX/$element.width()*100,left=25,right=75;moving=!0;percent<left?percent=left:percent>right&&(percent=right);$element.find(">div").css("left",percent-right+"%")});$this.on("click touchend",function(e){var $this=$(this),$myInputBox=$this.siblings("input");e.stopImmediatePropagation();e.preventDefault();$this.unbind("mouseleave");moving?$myInputBox.prop("checked",!(parseInt($this.parent().css("left"))<-25)):$myInputBox.prop("checked",!$myInputBox.is(":checked"));moving=!1;$myInputBox.trigger("change")});$this.on("mouseleave",function(e){var $this=$(this),$myInputBox=$this.siblings("input");e.preventDefault();e.stopImmediatePropagation();$this.unbind("mouseleave mousemove");$this.trigger("mouseup");$myInputBox.prop("checked",!(parseInt($this.parent().css("left"))<-25)).trigger("change")});$this.on("mouseup",function(e){e.stopImmediatePropagation();e.preventDefault();$(this).trigger("mouseleave")})}});$form.data("bootstrapSwitch")!=="injected"&&($form.bind("reset",function(){setTimeout(function(){$form.find(".c-toggle").each(function(){$input.prop("checked",$input.is(":checked")).trigger("change")})},1)}),$form.data("bootstrapSwitch","injected"))})},toggleActivation:function(){var $element=$(this).parent(),$this=$(this);$element.toggleClass("deactivate");$this.prop("disabled",$element.is(".deactivate"))},isActive:function(){return!$(this).hasClass("deactivate")},setActive:function(active){var $element=$(this).parent(),$this=$(this);active?($element.removeClass("deactivate"),$this.removeAttr("disabled")):($element.addClass("deactivate"),$this.attr("disabled","disabled"))},toggleState:function(skipOnChange){var $input=$(this).find(":checkbox");$input.prop("checked",!$input.is(":checked")).trigger("change",skipOnChange)},toggleRadioState:function(skipOnChange){var $radioinput=$(this).find(":radio");$radioinput.not(":checked").prop("checked",!$radioinput.is(":checked")).trigger("change",skipOnChange)},toggleRadioStateAllowUncheck:function(uncheck,skipOnChange){var $radioinput=$(this).find(":radio");uncheck?$radioinput.not(":checked").trigger("change",skipOnChange):$radioinput.not(":checked").prop("checked",!$radioinput.is(":checked")).trigger("change",skipOnChange)},setState:function(value,skipOnChange){$(this).prop("checked",value).trigger("change",skipOnChange)},setOnLabel:function(value){var $switchLeft=$(this).find(".switch-left");$switchLeft.html(value)},setOffLabel:function(value){var $switchRight=$(this).find(".switch-right");$switchRight.html(value)},setOnClass:function(value){var $switchLeft=$(this).find(".switch-left"),color="";value!==undefined&&($(this).attr("data-on")!==undefined&&(color="switch-"+$(this).attr("data-on")),$switchLeft.removeClass(color),color="switch-"+value,$switchLeft.addClass(color))},setOffClass:function(value){var $switchRight=$(this).find(".switch-right"),color="";value!==undefined&&($(this).attr("data-off")!==undefined&&(color="switch-"+$(this).attr("data-off")),$switchRight.removeClass(color),color="switch-"+value,$switchRight.addClass(color))},setAnimated:function(value){var $element=$(this);value===undefined&&(value=!1);$element.data("animated",value);$element.attr("data-animated",value);$element.data("animated")!==!1?$element.addClass("switch-animate"):$element.removeClass("switch-animate")},setSizeClass:function(value){var $element=$(this),$switchLeft=$element.find(".switch-left"),$switchRight=$element.find(".switch-right"),$label=$element.find("label");$.each(["switch-mini","switch-small","switch-large"],function(i,el){el!==value?($switchLeft.removeClass(el),$switchRight.removeClass(el),$label.removeClass(el)):($switchLeft.addClass(el),$switchRight.addClass(el),$label.addClass(el))})},status:function(){return $(this).find(inputSelector).is(":checked")},destroy:function(){var $element=$(this),$div=$element.find("div"),$form=$element.closest("form"),$inputbox;return $div.find(":not(input)").remove(),$inputbox=$div.children(),$inputbox.unwrap().unwrap(),$inputbox.unbind("change"),$form&&($form.unbind("reset"),$form.removeData("bootstrapSwitch")),$inputbox}};if(methods[method])return methods[method].apply(this,Array.prototype.slice.call(arguments,1));if(typeof method!="object"&&method)$.error("Method "+method+" does not exist!");else return methods.init.apply(this,arguments)}}(jQuery)
})();
;(function() { if (Cognito.config.scripts.indexOf('cognito-messaging') >= 0) return; else Cognito.config.scripts.push('cognito-messaging');((typeof exports!="undefined"?exports:{}).exec=function(){window.Cognito=window.Cognito||{},function(window){function evalPath(obj,path){function index(obj,i){return obj[i]}return path.split(".").reduce(index,obj)}var _handlers={},Messaging=function(){var eventMethod=window.addEventListener?"addEventListener":"attachEvent",event=window.addEventListener?"message":"onmessage",eventer=window[eventMethod];eventer(event,this._handle,!1)};Messaging.prototype={_handle:function(event){var payload,handlerList;try{payload=JSON.parse(event.data)}catch(e){}payload&&payload.event&&(handlerList=_handlers[payload.event],handlerList&&handlerList.forEach(function(handler){handler.call(event,payload.data)}))},dispose:function(){_handlers={}},addHandler:function(name,handler){_handlers[name]=_handlers[name]||[];_handlers[name].push(handler)},removeHandler:function(name,handler){if(_handlers[name]){var idx=_handlers[name].indexOf(handler);idx>-1&&_handlers[name].splice(idx,1)}},trigger:function(){var event,options,payload,target,origin;arguments.length===2?(event=arguments[0],options=arguments[1]):arguments.length===1&&(typeof arguments[0]=="string"?event=arguments[0]:(options=arguments[0],event=options.event));payload={};payload.event=event;options&&options.data&&(payload.data=options.data);target=options&&options.target||window.parent;origin=options&&options.origin||"*";target.postMessage(JSON.stringify(payload),origin)},proxy:function(target,scope){function createProxy(fn){return function(){for(var type,j,obj,clean,prop,val,args=[],i=0;i<arguments.length;i++){if(arg=arguments[i],arg instanceof ExoWeb.Model.Entity)type=arg.meta.type.get_fullName(),arg=Cognito.serialize(arg),arg.$type=arg.$type||type;else if(arg instanceof Array&&arg.length>0&&arg[0]instanceof ExoWeb.Model.Entity)for(j=0;j<arg.length;j++)type=arg[j].meta.type.get_fullName(),arg[j]=Cognito.serialize(arg[j]),arg[j].$type=arg[j].$type||type;else if(arg instanceof Array){if(arg.length>0&&arg[0]instanceof Object)for(j=0;j<arg.length;j++){obj=arg[j];clean={};for(prop in obj)(val=obj[prop],val instanceof ExoWeb.Model.Entity||val instanceof Array&&val.length>0&&val[0]instanceof ExoWeb.Model.Entity)||(clean[prop]=val);arg[j]=clean}}else if(arg instanceof Object){clean={};for(prop in arg)(val=arg[prop],val instanceof ExoWeb.Model.Entity||val instanceof Array&&val.length>0&&val[0]instanceof ExoWeb.Model.Entity)||(clean[prop]=val);arg=clean}args.push(arg)}Cognito.Messaging.trigger("proxy",{target:target,data:{scope:scope,fn:fn,args:args}})}}var fnSet=evalPath(target,scope),proxy={};for(var fn in fnSet)proxy[fn]=createProxy(fn);return proxy}};window.Cognito.Messaging=new Messaging;Cognito.Messaging.addHandler("proxy",function(data){for(var type,j,entity,i=0;i<data.args.length;i++)if(arg=data.args[i],arg&&arg.$type&&(entity=null,arg.Id&&(type=context.model.meta.type(arg.$type).get_jstype(),entity=type.meta.get(arg.Id.toString())),data.args[i]=Cognito.deserialize(null,arg,entity)),arg&&arg instanceof Array&&arg.length>0&&arg[0].$type)for(type=context.model.meta.type(arg[0].$type).get_jstype(),j=0;j<arg.length;j++)entity=null,arg[j].Id&&(entity=type.meta.get(arg.Id.toString())),arg[j]=Cognito.deserialize(null,arg[j],entity);evalPath(window,data.scope)[data.fn].apply(window,data.args)})}(window)})()
})();
;(function() { if (Cognito.config.scripts.indexOf('cognito-scrollintoview') >= 0) return; else Cognito.config.scripts.push('cognito-scrollintoview');(function($){$.fn.scrollIntoView=function(){var $parent,parentTagName,offset;return Cognito.config.embedMode=="iframe"?(this.get(0).scrollIntoView(),this):($parent=this.parents().filter(function(){return this.clientHeight<this.scrollHeight-1&&($(this).css("overflow-y")!="visible"||this.tagName.toLowerCase()=="html"||this.tagName.toLowerCase()=="body")}),$parent.length>0?(parentTagName=$parent.get(0).tagName.toLowerCase(),offset=this.get(0).offsetTop,(parentTagName=="body"||parentTagName=="html")&&($parent=ExoJQuery("html, body"),offset=this.offset().top-$parent.offset().top),$parent.animate({scrollTop:offset},300)):this.get(0).scrollIntoView(),this)}})(ExoJQuery||jQuery)
})();
;(function() { if (Cognito.config.scripts.indexOf('jquery.maskedinput') >= 0) return; else Cognito.config.scripts.push('jquery.maskedinput');(function($){var ua=navigator.userAgent,iPhone=/iphone/i.test(ua),chrome=/chrome/i.test(ua),android=/android/i.test(ua),caretTimeoutId;$.mask={definitions:{"#":"[0-9]","@":"[A-Za-z]"},autoclear:!0,autoinit:!0,dataName:"rawMaskFn",placeholder:"_"};$.fn.extend({caret:function(begin,end){var range;if(this.length!==0&&!this.is(":hidden")&&this.get(0)===document.activeElement)return typeof begin=="number"?(end=typeof end=="number"?end:begin,this.each(function(){this.setSelectionRange?this.setSelectionRange(begin,end):this.createTextRange&&(range=this.createTextRange(),range.collapse(!0),range.moveEnd("character",end),range.moveStart("character",begin),range.select())})):(this[0].setSelectionRange?(begin=this[0].selectionStart,end=this[0].selectionEnd):document.selection&&document.selection.createRange&&(range=document.selection.createRange(),begin=0-range.duplicate().moveStart("character",-1e5),end=begin+range.text.length),{begin:begin,end:end})},unmask:function(){return this.trigger("unmask")},mask:function(mask,settings){var input,defs,tests,hasPartialPosition,partialPosition,firstNonMaskPos,lastRequiredNonMaskPos,len,oldVal,fn,maskPart,maskPartFrequency,maskParts,maskIndex;if(!mask&&this.length>0)return input=$(this[0]),fn=input.data($.mask.dataName),fn?fn():undefined;for(settings=$.extend({autoclear:$.mask.autoclear,autoinit:$.mask.autoinit,placeholder:$.mask.placeholder,completed:null},settings),defs=$.mask.definitions,tests=[],hasPartialPosition=!1,partialPosition=null,len=mask.length,firstNonMaskPos=null,mask=String(mask),maskParts=mask.split(""),maskIndex=0;maskIndex<maskParts.length;maskIndex++)maskPart=maskParts[maskIndex],maskPart=="?"?(len--,hasPartialPosition=!0,partialPosition=maskIndex):maskPart=="*"||(defs[maskPart]?(maskPartFrequency="single",maskIndex<maskParts.length-1&&maskParts[maskIndex+1]==="*"&&(maskPartFrequency="multiple",len--),tests.push({expr:new RegExp(defs[maskPart]),freq:maskPartFrequency}),firstNonMaskPos===null&&(firstNonMaskPos=tests.length-1),(!hasPartialPosition||maskIndex<partialPosition)&&(lastRequiredNonMaskPos=tests.length-1),maskPartFrequency==="multiple"&&(maskIndex+=1)):tests.push(null));return this.trigger("unmask").each(function(){function tryFireCompleted(){if(settings.completed){for(var i=firstNonMaskPos;i<=lastRequiredNonMaskPos;i++)if(tests[i]&&buffer[i]===getPlaceholder(i))return;settings.completed.call(input)}}function getPlaceholder(i){return i<settings.placeholder.length?settings.placeholder.charAt(i):settings.placeholder.charAt(0)}function seekNext(pos){while(++pos<len&&!(tests[pos]||pos>=tests.length&&tests[tests.length-1].freq==="multiple"));return pos}function seekPrev(pos){while(--pos>=0&&!tests[pos]&&!(pos>=tests.length&&tests[tests.length-1].freq==="multiple"));return pos}function shiftL(begin,end){var i,j,maxLen=tests[tests.length-1].freq==="multiple"?buffer.length:len,test;if(!(begin<0)){for(i=begin,j=seekNext(end);i<maxLen;i++)if(test=tests[i],i>=tests.length&&tests[tests.length-1].freq==="multiple"&&(test=tests[tests.length-1]),test){if((j<maxLen||test.freq==="multiple")&&test.expr.test(buffer[j]))buffer[i]=buffer[j],buffer[j]=getPlaceholder(j);else break;j=seekNext(j)}buffer.join("")===defaultBuffer?(input.val()&&writeInputValue(""),clearBuffer(0,maxLen)):writeBuffer();input.caret(Math.max(firstNonMaskPos,begin))}}function shiftR(pos){for(var j,t,maxLen=tests[tests.length-1].freq==="multiple"?buffer.length:len,test,i=pos,c=getPlaceholder(pos);i<=maxLen;i++)if(test=tests[i],i>=tests.length&&tests[tests.length-1].freq==="multiple"&&(test=tests[tests.length-1]),test)if(j=seekNext(i),t=buffer[i],buffer[i]=c,(j<=maxLen||test.freq==="multiple")&&test.expr.test(t))c=t;else break}function androidInputEvent(){var curVal=input.val(),pos=input.caret();if(oldVal&&oldVal.length&&oldVal.length>curVal.length){for(checkVal(!0);pos.begin>0&&!tests[pos.begin-1];)pos.begin--;if(pos.begin===0)while(pos.begin<firstNonMaskPos&&!tests[pos.begin])pos.begin++;input.caret(pos.begin,pos.begin)}else{var inputIndex=pos.begin-1,pos2=checkVal(!0,inputIndex),lastEnteredValue=curVal.charAt(inputIndex);tests[inputIndex]?tests[inputIndex].expr.test(lastEnteredValue)&&inputIndex++:(inputIndex++,tests[inputIndex]&&tests[inputIndex].expr.test(lastEnteredValue)&&inputIndex++);input.caret(inputIndex,inputIndex)}tryFireCompleted()}function blurEvent(){checkVal();input.val()!=focusText&&simulateChangeEvent()}function keydownEvent(e){if(!input.prop("readonly")){var k=e.which||e.keyCode,pos,begin,end;oldVal=input.val();k===8||k===46||iPhone&&k===127?(pos=input.caret(),begin=pos.begin,end=pos.end,end-begin==0&&(begin=k!==46?seekPrev(begin):end=seekNext(begin-1),end=k===46?seekNext(end):end),clearBuffer(begin,end),shiftL(begin,end-1),e.preventDefault()):k===13?blurEvent.call(this,e):k===27&&(writeInputValue(focusText),input.caret(0,checkVal()),e.preventDefault())}}function keypressEvent(e){var k,pos,p,c,next,test,t,proxy;if(!input.prop("readonly")&&(k=e.which||e.keyCode,pos=input.caret(),!e.ctrlKey&&!e.altKey&&!e.metaKey&&!(k<32))&&k&&k!==13){if(pos.end-pos.begin!=0&&(clearBuffer(pos.begin,pos.end),shiftL(pos.begin,pos.end-1)),p=seekNext(pos.begin-1),c=String.fromCharCode(k),test=tests[p],!test)for(t=p;t>=0;t--)if(test=tests[t],test){test.freq!=="multiple"&&(test=null);break}test&&test.expr.test(c)?(shiftR(p),buffer[p]=c,writeBuffer(p),next=seekNext(p),android?(proxy=function(){$.proxy($.fn.caret,input,next)()},setTimeout(proxy,0)):input.caret(next),pos.begin<=lastRequiredNonMaskPos&&tryFireCompleted()):p>pos.begin&!tests[pos.begin]&&c===buffer[pos.begin]&&checkVal(!1,pos.begin);e.preventDefault()}}function clearBuffer(start,end){for(var maxLen=tests[tests.length-1].freq==="multiple"?buffer.length:len,i=start;i<end&&i<maxLen;i++)tests[i]?buffer[i]=getPlaceholder(i):i>=tests.length&&tests[tests.length-1].freq==="multiple"&&buffer.splice(i,1)}function writeInputValue(val){input.val(val)}function writeBuffer(lastTypedIndex){for(var test=buffer.join(""),str="",nonMatchedBuffer="",lastMatch=-1,lastNonMatch=-1,maxLen=tests[tests.length-1].freq==="multiple"?test.length:len,ph,c,t,i=0,pos=0;i<maxLen;i++)ph=getPlaceholder(i),lastNonMatch>=0?(c=test.charAt(pos-1),c===ph?nonMatchedBuffer+=ph:(nonMatchedBuffer&&(str+=nonMatchedBuffer,nonMatchedBuffer=""),str+=c)):(t=tests[i],i>=tests.length&&tests[tests.length-1].freq==="multiple"&&(t=tests[tests.length-1]),pos+=1,t?(c=test.charAt(pos-1),c===ph?lastNonMatch<0&&(lastNonMatch=i):t.expr.test(c)?(lastMatch=i,str+=c):(lastNonMatch=i,c===ph?nonMatchedBuffer+=ph:str+=c)):(c=test.charAt(pos),buffer[i]===c&&pos++,str+=buffer[i]));hasPartialPosition&&lastNonMatch>=partialPosition&&lastMatch<partialPosition&&(str=typeof lastTypedIndex=="number"&&lastMatch<lastTypedIndex&&lastNonMatch>lastTypedIndex?str.substring(0,lastTypedIndex+1):str.substring(0,partialPosition));writeInputValue(str)}function simulateChangeEvent(){input.each(function(){$simulateMutationEvent(this,"change",!1,!0)});input.change()}function checkVal(allow,lastTypedIndex){for(var test=input.val(),lastMatch=-1,maxLen=tests[tests.length-1].freq==="multiple"?len+1:len,isMultiMatch=!1,c,t,inputVal,writeToIndex,i=0,pos=0;i<maxLen;i++)if(t=tests[i],i>=tests.length&&tests[tests.length-1].freq==="multiple"&&(t=tests[tests.length-1],isMultiMatch=!0),t){for(buffer[i]=getPlaceholder(i);pos++<test.length;)if(t=tests[i],i>=tests.length&&tests[tests.length-1].freq==="multiple"&&(t=tests[tests.length-1],isMultiMatch=!0),c=test.charAt(pos-1),t.expr.test(c)){buffer[i]=c;lastMatch=i;isMultiMatch&&i===maxLen-1&&(maxLen+=1);break}if(pos>test.length){clearBuffer(i+1,maxLen);break}}else buffer[i]===test.charAt(pos)&&pos++,i<partialPosition&&(lastMatch=i);return i<buffer.length&&clearBuffer(i,buffer.length),allow?writeBuffer(lastTypedIndex):hasPartialPosition&&lastMatch+1<partialPosition?settings.autoclear||buffer.join("")===defaultBuffer?(input.val()&&writeInputValue(""),clearBuffer(0,maxLen)):writeBuffer(lastTypedIndex):(writeBuffer(lastTypedIndex),inputVal=input.val(),writeToIndex=lastMatch,typeof lastTypedIndex=="number"&&lastTypedIndex>lastMatch&!tests[lastTypedIndex]&&lastTypedIndex<inputVal.length&&inputVal[lastTypedIndex]===buffer[lastTypedIndex]&&(writeToIndex=lastTypedIndex),writeInputValue(input.val().substring(0,writeToIndex+1))),hasPartialPosition?lastMatch>=0?lastMatch+1:i:firstNonMaskPos}var input=$(this),buffer=mask.split("").filter(function(c){return c!=="?"&&c!=="*"}).map(function(c,i){return defs[c]?getPlaceholder(i):c}),defaultBuffer=buffer.join(""),focusText=input.val();input.data($.mask.dataName,function(){return $.map(buffer,function(c,i){return tests[i]&&c!=getPlaceholder(i)?c:null}).join("")});input.one("unmask",function(){input.off(".mask").removeData($.mask.dataName)}).on("focus.mask",function(){var pos,pos2;input.prop("readonly")||(clearTimeout(caretTimeoutId),pos=input.caret(),focusText=input.val(),pos2=checkVal(),caretTimeoutId=setTimeout(function(){if(input.get(0)===document.activeElement){var inputText=input.val();pos2==mask.replace("?","").length?input.caret(0,pos2):pos.begin===0&&pos.end===focusText.length?input.caret(0,inputText.length):inputText!==focusText&&input.caret(pos2)}},10))}).on("blur.mask",blurEvent).on("keydown.mask",keydownEvent).on("keypress.mask",keypressEvent).on("input.mask paste.mask",function(){input.prop("readonly")||setTimeout(function(){var pos=checkVal(!0);input.caret(pos);tryFireCompleted()},0)});if(chrome&&android)input.off("input.mask").on("input.mask",androidInputEvent);settings.autoinit&&checkVal()})}})})(jQuery)
})();
;(function() { if (Cognito.config.scripts.indexOf('cognito-tracking') >= 0) return; else Cognito.config.scripts.push('cognito-tracking');Cognito.ready("form-tracking",function($){function getPathnameFromUrl(url){var anchor=document.createElement("a");return anchor.setAttribute("href",url),anchor.pathname}function wrapCallbackWithTimeout(callback,timeout){function fn(){timeoutId&&(timeoutId=clearTimeout(timeoutId));called||(called=!0,callback.apply(this,arguments))}var timeoutId,called=!1;return timeoutId=setTimeout(function(){called||(timeoutId=clearTimeout(timeoutId),fn())},timeout||1e3),fn}var exports=Cognito.tracking={},trackingEnabled=!1,trackingInitialized=null,trackingHostingPagePathname=null,trackingPixels=null;exports.enableFormTracking=function(options){trackingEnabled||options&&(trackingEnabled=!0,options.trackingPixels&&(trackingPixels=Object.prototype.toString.call(options.trackingPixels)==="[object Array]"?options.trackingPixels.slice():[options.trackingPixels]),Cognito.config.embedMode&&Cognito.config.embedMode==="iframe"&&!trackingHostingPagePathname||(trackingInitialized=!0))};exports.recordSubmission=function(callback,options){var timeout,submissionOps;if(!trackingEnabled||!trackingInitialized){callback&&callback instanceof Function&&callback(new Error("Tracking is not yet enabled."));return}timeout=1e3;options&&options.timeout&&typeof options.timeout=="number"&&(timeout=options.timeout);submissionOps=new ExoWeb.Signal("Form Submission Tracking");trackingPixels&&trackingPixels.length>0&&trackingPixels.forEach(function(pixel){var imgCheckInterval,signalTrackingPixelDone=wrapCallbackWithTimeout(submissionOps.pending(function(img){if(imgCheckInterval&&(imgCheckInterval=window.clearInterval(imgCheckInterval)),!img)try{throw new Error("Unable to load tracking pixel '"+pixel.name+"'.");}catch(e){window.appInsights&&appInsights.trackException(e,"recordSubmission")}}),timeout),imgId=ExoWeb.randomText(16,!0),imgCheckCount;$(".c-forms-confirmation").append('<img id="'+imgId+'" height="1" width="1" style="display:none" src="'+pixel.url+'" />');imgCheckCount=0;imgCheckInterval=setInterval(function(){var img;try{if(++imgCheckCount>=100)throw new Error("Too many status checks while loading tracking pixel '"+pixel.name+"'.");else if(img=document.getElementById(imgId),img&&img.complete)if(img.naturalHeight>0)signalTrackingPixelDone(img);else throw new Error("Tracking pixel '"+pixel.name+"' has no content.");}catch(e){imgCheckInterval&&(imgCheckInterval=window.clearInterval(imgCheckInterval));img=document.getElementById(imgId);signalTrackingPixelDone(img);window.appInsights&&appInsights.trackException(e,"recordSubmission")}},100)});submissionOps.waitForAll(function(){callback&&callback instanceof Function&&callback()})};exports.recordConfirmation=function(callback){if(!trackingEnabled||!trackingInitialized){callback&&callback instanceof Function&&callback(new Error("Tracking is not yet enabled."));return}var confirmationOps=new ExoWeb.Signal;confirmationOps.waitForAll(function(){callback&&callback instanceof Function&&callback()})};exports.initHostingPage=function(url){trackingHostingPagePathname=getPathnameFromUrl(url);trackingEnabled&&!trackingInitialized&&(trackingInitialized=!0)}})
})();
;(function() { if (Cognito.config.scripts.indexOf('cognito-nobots') >= 0) return; else Cognito.config.scripts.push('cognito-nobots');Cognito.ready("detect-bots",function($){function DetectBots(challenge,timeout,immediate){function encode(string){function RotateLeft(lValue,iShiftBits){return lValue<<iShiftBits|lValue>>>32-iShiftBits}function AddUnsigned(lX,lY){var lX4,lY4,lX8,lY8,lResult;return(lX8=lX&2147483648,lY8=lY&2147483648,lX4=lX&1073741824,lY4=lY&1073741824,lResult=(lX&1073741823)+(lY&1073741823),lX4&lY4)?lResult^2147483648^lX8^lY8:lX4|lY4?lResult&1073741824?lResult^3221225472^lX8^lY8:lResult^1073741824^lX8^lY8:lResult^lX8^lY8}function F(x,y,z){return x&y|~x&z}function G(x,y,z){return x&z|y&~z}function H(x,y,z){return x^y^z}function I(x,y,z){return y^(x|~z)}function FF(a,b,c,d,x,s,ac){return a=AddUnsigned(a,AddUnsigned(AddUnsigned(F(b,c,d),x),ac)),AddUnsigned(RotateLeft(a,s),b)}function GG(a,b,c,d,x,s,ac){return a=AddUnsigned(a,AddUnsigned(AddUnsigned(G(b,c,d),x),ac)),AddUnsigned(RotateLeft(a,s),b)}function HH(a,b,c,d,x,s,ac){return a=AddUnsigned(a,AddUnsigned(AddUnsigned(H(b,c,d),x),ac)),AddUnsigned(RotateLeft(a,s),b)}function II(a,b,c,d,x,s,ac){return a=AddUnsigned(a,AddUnsigned(AddUnsigned(I(b,c,d),x),ac)),AddUnsigned(RotateLeft(a,s),b)}function ConvertToWordArray(string){for(var lWordCount,lMessageLength=string.length,lNumberOfWords_temp1=lMessageLength+8,lNumberOfWords_temp2=(lNumberOfWords_temp1-lNumberOfWords_temp1%64)/64,lNumberOfWords=(lNumberOfWords_temp2+1)*16,lWordArray=Array(lNumberOfWords-1),lBytePosition=0,lByteCount=0;lByteCount<lMessageLength;)lWordCount=(lByteCount-lByteCount%4)/4,lBytePosition=lByteCount%4*8,lWordArray[lWordCount]=lWordArray[lWordCount]|string.charCodeAt(lByteCount)<<lBytePosition,lByteCount++;return lWordCount=(lByteCount-lByteCount%4)/4,lBytePosition=lByteCount%4*8,lWordArray[lWordCount]=lWordArray[lWordCount]|128<<lBytePosition,lWordArray[lNumberOfWords-2]=lMessageLength<<3,lWordArray[lNumberOfWords-1]=lMessageLength>>>29,lWordArray}function WordToHex(lValue){for(var WordToHexValue="",WordToHexValue_temp="",lByte,lCount=0;lCount<=3;lCount++)lByte=lValue>>>lCount*8&255,WordToHexValue_temp="0"+lByte.toString(16),WordToHexValue=WordToHexValue+WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);return WordToHexValue}function Utf8Encode(string){var utftext,n,c;for(string=string.replace(/\r\n/g,"\n"),utftext="",n=0;n<string.length;n++)c=string.charCodeAt(n),c<128?utftext+=String.fromCharCode(c):c>127&&c<2048?(utftext+=String.fromCharCode(c>>6|192),utftext+=String.fromCharCode(c&63|128)):(utftext+=String.fromCharCode(c>>12|224),utftext+=String.fromCharCode(c>>6&63|128),utftext+=String.fromCharCode(c&63|128));return utftext}var x=Array(),k,AA,BB,CC,DD,a,b,c,d,S11=7,S12=12,S13=17,S14=22,S21=5,S22=9,S23=14,S24=20,S31=4,S32=11,S33=16,S34=23,S41=6,S42=10,S43=15,S44=21,temp;for(string=Utf8Encode(string),x=ConvertToWordArray(string),a=1732584193,b=4023233417,c=2562383102,d=271733878,k=0;k<x.length;k+=16)AA=a,BB=b,CC=c,DD=d,a=FF(a,b,c,d,x[k+0],S11,3614090360),d=FF(d,a,b,c,x[k+1],S12,3905402710),c=FF(c,d,a,b,x[k+2],S13,606105819),b=FF(b,c,d,a,x[k+3],S14,3250441966),a=FF(a,b,c,d,x[k+4],S11,4118548399),d=FF(d,a,b,c,x[k+5],S12,1200080426),c=FF(c,d,a,b,x[k+6],S13,2821735955),b=FF(b,c,d,a,x[k+7],S14,4249261313),a=FF(a,b,c,d,x[k+8],S11,1770035416),d=FF(d,a,b,c,x[k+9],S12,2336552879),c=FF(c,d,a,b,x[k+10],S13,4294925233),b=FF(b,c,d,a,x[k+11],S14,2304563134),a=FF(a,b,c,d,x[k+12],S11,1804603682),d=FF(d,a,b,c,x[k+13],S12,4254626195),c=FF(c,d,a,b,x[k+14],S13,2792965006),b=FF(b,c,d,a,x[k+15],S14,1236535329),a=GG(a,b,c,d,x[k+1],S21,4129170786),d=GG(d,a,b,c,x[k+6],S22,3225465664),c=GG(c,d,a,b,x[k+11],S23,643717713),b=GG(b,c,d,a,x[k+0],S24,3921069994),a=GG(a,b,c,d,x[k+5],S21,3593408605),d=GG(d,a,b,c,x[k+10],S22,38016083),c=GG(c,d,a,b,x[k+15],S23,3634488961),b=GG(b,c,d,a,x[k+4],S24,3889429448),a=GG(a,b,c,d,x[k+9],S21,568446438),d=GG(d,a,b,c,x[k+14],S22,3275163606),c=GG(c,d,a,b,x[k+3],S23,4107603335),b=GG(b,c,d,a,x[k+8],S24,1163531501),a=GG(a,b,c,d,x[k+13],S21,2850285829),d=GG(d,a,b,c,x[k+2],S22,4243563512),c=GG(c,d,a,b,x[k+7],S23,1735328473),b=GG(b,c,d,a,x[k+12],S24,2368359562),a=HH(a,b,c,d,x[k+5],S31,4294588738),d=HH(d,a,b,c,x[k+8],S32,2272392833),c=HH(c,d,a,b,x[k+11],S33,1839030562),b=HH(b,c,d,a,x[k+14],S34,4259657740),a=HH(a,b,c,d,x[k+1],S31,2763975236),d=HH(d,a,b,c,x[k+4],S32,1272893353),c=HH(c,d,a,b,x[k+7],S33,4139469664),b=HH(b,c,d,a,x[k+10],S34,3200236656),a=HH(a,b,c,d,x[k+13],S31,681279174),d=HH(d,a,b,c,x[k+0],S32,3936430074),c=HH(c,d,a,b,x[k+3],S33,3572445317),b=HH(b,c,d,a,x[k+6],S34,76029189),a=HH(a,b,c,d,x[k+9],S31,3654602809),d=HH(d,a,b,c,x[k+12],S32,3873151461),c=HH(c,d,a,b,x[k+15],S33,530742520),b=HH(b,c,d,a,x[k+2],S34,3299628645),a=II(a,b,c,d,x[k+0],S41,4096336452),d=II(d,a,b,c,x[k+7],S42,1126891415),c=II(c,d,a,b,x[k+14],S43,2878612391),b=II(b,c,d,a,x[k+5],S44,4237533241),a=II(a,b,c,d,x[k+12],S41,1700485571),d=II(d,a,b,c,x[k+3],S42,2399980690),c=II(c,d,a,b,x[k+10],S43,4293915773),b=II(b,c,d,a,x[k+1],S44,2240044497),a=II(a,b,c,d,x[k+8],S41,1873313359),d=II(d,a,b,c,x[k+15],S42,4264355552),c=II(c,d,a,b,x[k+6],S43,2734768916),b=II(b,c,d,a,x[k+13],S44,1309151649),a=II(a,b,c,d,x[k+4],S41,4149444226),d=II(d,a,b,c,x[k+11],S42,3174756917),c=II(c,d,a,b,x[k+2],S43,718787259),b=II(b,c,d,a,x[k+9],S44,3951481745),a=AddUnsigned(a,AA),b=AddUnsigned(b,BB),c=AddUnsigned(c,CC),d=AddUnsigned(d,DD);return temp=WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d),temp.toLowerCase()}function validate(){$("<input>").attr("type","hidden").appendTo("form").attr({name:"NoBots",id:"c-nobots",value:challenge+"|"+encode(challenge)})}function userDetected(){validate();for(var i=0;i<events.length;++i)$("body").off(events[i],userDetected)}var events,i;if(window.DetectBots=null,events=["mousedown","keydown"],immediate)validate();else{for(i=0;i<events.length;++i)$("body").on(events[i],userDetected);timeout>0&&window.setTimeout(function(){for(var i=0;i<events.length;++i)$("body").unbind(events[i],userDetected),$("body").bind(events[i],function(){alert("The page has expired and must be reloaded before you can continue.  Click OK to reload it.");$("body").hide();window.location.href=window.location.href})},timeout)}}window.DetectBots=DetectBots})
})();
;(function() { if (Cognito.config.scripts.indexOf('fileupload') >= 0) return; else Cognito.config.scripts.push('fileupload');((typeof exports!="undefined"?exports:{}).exec=function(){(function($){function getFileUpload(e){var eventTarget=e.target||e.srcElement,editor=$(eventTarget).closest(".c-fileupload").first(),input,inputs=editor.find("input[type='file']");return input=inputs.length>1?$(eventTarget).is("input")?eventTarget:editor.find("input:visible")[0]:inputs[0],{input:input,editor:editor,form:editor.find("form"),adapter:$parentContextData(editor.children(0)[0]),validation:editor.find(".c-validation"),allowedTypes:editor.attr("data-allowed-types")?(editor.attr("data-allowed-types")||"").toLowerCase().split(","):null,excludedTypes:((editor.attr("data-excluded-types")||"")+Cognito.config.excludedFileTypes).toLowerCase().split(","),maxSize:parseFloat(editor.attr("data-max-file-size")),maxFileCount:parseInt(editor.attr("data-max-file-count"))}}function validate(fileUpload,file){var extension=file.get_Name().split(".").pop().toLowerCase();return fileUpload.allowedTypes&&!fileUpload.allowedTypes.contains(extension)?(showError(fileUpload,Cognito.resources["fileupload-invalid-file-type-message"].replace("{allowedTypes}",fileUpload.allowedTypes.join(", "))),!1):fileUpload.excludedTypes&&fileUpload.excludedTypes.contains(extension)?(showError(fileUpload,Cognito.resources["fileupload-excluded-file-type-message"]),!1):!file.get_Id()&&fileUpload.maxFileCount&&fileUpload.adapter.get_isEntityList()&&fileUpload.adapter.get_rawValue().length>=fileUpload.maxFileCount?(showError(fileUpload,Cognito.resources["fileupload-max-file-count-exceeded-message"].replace("{maxFileCount}",fileUpload.maxFileCount)),!1):file.get_Size()===0?(showError(fileUpload,Cognito.resources["fileupload-zero-byte-file-message"]),!1):fileUpload.maxSize&&file.get_Size()&&file.get_Size()/1048576>fileUpload.maxSize?(showError(fileUpload,Cognito.resources["fileupload-max-size-exceeded-message"].replace("{maxSize}",fileUpload.maxSize)),!1):!0}function upload(fileUpload,files){var pendingFiles,file,fileData,newFiles,i;for(fileUpload.validation.text().length!=0&&fileUpload.validation.slideUp().empty(),pendingFiles=[],i=0;i<files.length;i++)(file=files[i],fileData=new Cognito.FileDataRef({Name:file.name,Size:file.size||0,Progress:"0%"}),validate(fileUpload,fileData))&&(fileUpload.adapter.get_isEntityList()?fileUpload.adapter.get_rawValue().add(fileData):fileUpload.adapter.get_propertyChain().value(fileUpload.adapter.get_target(),fileData),pendingFiles.push([fileUpload,file,fileData]));for(fileUpload.validation.slideDown(),fileUpload.adapter._propertyPath&&fileUpload.adapter.get_isEntityList()&&(newFiles=fileUpload.editor.find(".c-fileupload-file :gt("+(fileUpload.adapter.get_rawValue().length-1)+")"),newFiles.css({opacity:0}).animate({opacity:1},500)),i=0;i<pendingFiles.length;i++)uploadFile.apply(this,pendingFiles[i])}function showError(fileUpload,message){fileUpload.validation.html().indexOf(message)<0&&fileUpload.validation.append(message)}function uploadFile(fileUpload,file,fileData){var $field=$(fileUpload.input).parents(".c-field");$field.length>0&&$field.addClass("c-upload-in-progress");var uploadError=new ExoWeb.Model.Condition(uploadInProgress,null,fileUpload.adapter.get_target(),[fileUpload.adapter.get_propertyPath()]),success=function(data){var newFileData=Cognito.deserialize(Cognito.FileDataRef,data),fileList,index,jqEvent;if(!validate(fileUpload,newFileData)){deleteFile(fileUpload,fileData);return}fileUpload.adapter.get_isEntityList()?(fileList=fileUpload.adapter.get_rawValue(),index=fileList.indexOf(fileData),fileList.beginUpdate(),fileList.removeAt(index),fileList.insert(index,newFileData),fileList.endUpdate()):fileUpload.adapter.get_propertyChain().value(fileUpload.adapter.get_target(),newFileData);uploadError.destroy();$field.length>0&&$field.removeClass("c-upload-in-progress");fileUpload.maxFileCount!=1&&fileUpload.adapter.get_isEntityList()?$(".c-edge, .c-ie").length!==0&&fileUpload.editor.find(".c-upload-button button").get(0).focus():$(".c-edge, .c-ie").length!==0&&fileUpload.editor.find("a").get(0).focus();jqEvent=Cognito.fire("uploadFile.cognito",{data:{file:{name:newFileData.get_Name(),id:newFileData.get_Id(),size:newFileData.get_Size()}}})},error=function(jqXHR){if(jqXHR.status!==401){if(fileUpload.adapter.get_isEntityList()){var fileList=fileUpload.adapter.get_rawValue(),index=fileList.indexOf(fileData);fileList.removeAt(index)}else fileUpload.adapter.get_propertyChain().value(fileUpload.adapter.get_target(),null);uploadError.destroy();showError(fileUpload,Cognito.resources["fileupload-failed-upload-message"].replace("{fileName}",file.name));fileUpload.validation.height()==0&&fileUpload.validation.slideDown()}},formData=new FormData;formData.append("file",file);Cognito.serviceRequest({endpoint:"forms/"+Cognito.config.mode+"/file"+(Cognito.config.encryptUploads?"?encrypt=":""),method:"POST",data:formData,processData:!1,contentType:!1,overrideContentType:!0,uploadProgress:function(event,position,total,percentComplete){fileData.set_Progress((percentComplete>98?98:percentComplete)+"%")},success:success,error:error})}function deleteFile(fileUpload,fileData){fileUpload.validation.text().length!=0&&fileUpload.validation.slideUp().empty();fileUpload.adapter.get_isEntityList()?fileUpload.adapter.get_rawValue().remove(fileData):fileUpload.adapter.get_propertyChain().value(fileUpload.adapter.get_target(),null)}var uploadInProgress,supportsFileApi,supportsPaste;Cognito.getThumbnailUrl=function(fileId,fileName){if(!fileId)return"";var extension=fileName.split(".");extension=extension[extension.length-1].toLowerCase();switch(extension){case"png":case"gif":case"jpg":case"jpeg":case"tif":case"tiff":case"bmp":return fileId?Cognito.config.baseUrl+"forms/"+Cognito.config.mode+"/thumbnail?id="+fileId:Cognito.config.baseUrl+"content/images/file-type-icon-default.png";case"doc":case"docx":return Cognito.config.baseUrl+"content/images/file-type-icon-doc.png";case"xls":case"xlsx":return Cognito.config.baseUrl+"content/images/file-type-icon-xls.png";case"ppt":case"pptx":return Cognito.config.baseUrl+"content/images/file-type-icon-ppt.png";case"pdf":return Cognito.config.baseUrl+"content/images/file-type-icon-pdf.png";case"zip":return Cognito.config.baseUrl+"content/images/file-type-icon-zip.png";default:return Cognito.config.baseUrl+"content/images/file-type-icon-default.png"}};$extend("Cognito.FileDataRef",function(type){uploadInProgress=new ExoWeb.Model.ConditionType.Error("Cognito.UploadInProgress",Cognito.resources["fileupload-upload-inprogress-message"],null,"client");type.meta.addProperty({name:"Progress",type:String});var downloadUrlProperty=type.meta.addProperty({name:"DownloadUrl",type:String});type.meta.addProperty({name:"Url",type:String}).calculated({fn:function(){var extension=this.get_Name().split("."),downloadUrl;extension=extension[extension.length-1].toLowerCase();downloadUrl=this.get_DownloadUrl();switch(extension){case"doc":case"docx":case"ppt":case"pptx":return this.get_Size()/1048576<10?"http://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(downloadUrl):downloadUrl;case"xls":case"xlsx":return this.get_Size()/1048576<5?"http://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(downloadUrl):downloadUrl;case"png":case"gif":case"jpg":case"jpeg":case"tif":case"tiff":case"bmp":case"pdf":return downloadUrl+"&at=0";default:return downloadUrl}},basedOn:["Name","DownloadUrl","Size"]});downloadUrlProperty.calculated({fn:function(){return Cognito.config.baseUrl+"forms/"+Cognito.config.mode+"/file?id="+this.get_Id()+"&ct="+encodeURIComponent(this.get_ContentType())},onChangeOf:["Id"]});type.meta.addProperty({name:"ThumbnailUrl",type:String}).calculated({fn:function(){return Cognito.getThumbnailUrl(this.get_Id(),this.get_Name())},onChangeOf:["Id","Name"]});type.meta.addProperty({name:"Description",type:String}).calculated({fn:function(){if(this.get_Progress())return Cognito.resources["fileupload-desc-progress-message"].replace("{progress}",this.get_Progress());var size=this.get_Size();return size<1024?Cognito.resources["fileupload-desc-size-in-bytes-message"].replace("{size}",size):size<1048576?(size/1024).toFixed(2)+" KB":size<1073741824?(size/1048576).toFixed(2)+" MB":(size/1073741824).toFixed(2)+" GB"},onChangeOf:["Progress","Size"]})});supportsFileApi=$("<input type='file'/>").get(0).files!==undefined;supportsPaste=!!navigator.userAgent&&!!navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/);Cognito.ready("register-fileupload-events","ExoWeb.dom",function($){$(Cognito.config.flags.AppNav?"body":".cognito").on("change",".c-fileupload input",function(e){var fileUpload=getFileUpload(e),dropzone;supportsFileApi?upload(fileUpload,fileUpload.input.files):upload(fileUpload,[{name:$(fileUpload.input).val(),size:-1}]);dropzone=fileUpload.editor.find(".c-fileupload-dropzone");dropzone.html(dropzone.html())}).on("click keypress",".c-fileupload-delete",function(e){if(e.type!=="keypress"||e.which===13||e.which===32){var fileUpload=getFileUpload(e),file=$(e.target||e.srcElement).parents(".c-fileupload-file");return file.animate({opacity:0},500,function(){if($(".c-edge, .c-ie").length!==0){var nextFocusableElement=$(fileUpload.input).prev().get(0),$nextFile=file.next();$nextFile.length>0&&(nextFocusableElement=$nextFile.find("a").get(0))}fileUpload.adapter.get_isEntityList()?deleteFile(fileUpload,$parentContextData(file[0])):deleteFile(fileUpload,fileUpload.adapter.get_propertyChain().value(fileUpload.adapter.get_target()));$(".c-edge, .c-ie").length!==0&&nextFocusableElement.focus()}),!1}}).on("click keypress",".c-fileupload-download",function(){var downloadUrl=$(this).find("button").val();window.open(downloadUrl,"_blank")}).on("click",".c-upload-button button",function(){$(this).next().click()});var pasteTarget;if(supportsPaste)$(Cognito.config.flags.AppNav?"body":".cognito").on("click",".c-fileupload",function(e){var fileUpload=getFileUpload(e);(!fileUpload.allowedTypes||fileUpload.allowedTypes.contains("png")||fileUpload.allowedTypes.contains("jpg"))&&(pasteTarget=fileUpload)}).on("paste",function(e){var i,item;if(pasteTarget)for(clipboardData=e.originalEvent.clipboardData,i=0;i<clipboardData.items.length;i++)if(item=clipboardData.items[i],item.type.match(/image.*/)&&item.kind==="file"){file=item.getAsFile();file.name=item.type.replace("/",".");upload(pasteTarget,[file]);e.preventDefault();e.stopPropagation();return}});if(supportsFileApi){$(Cognito.config.flags.AppNav?"body":".cognito").on("dragenter",".c-fileupload-dropzone",function(e){e.stopPropagation();e.preventDefault();$(this).addClass("c-fileupload-dropzone-active")}).on("dragenter dragover dragleave",".c-fileupload-dropzone .c-upload-button, .c-fileupload-dropzone .c-fileupload-dropzone-message",function(e){$(this).closest(".c-fileupload-dropzone").addClass("c-fileupload-dropzone-active");e.stopPropagation();e.preventDefault()}).on("dragover",".c-fileupload-dropzone",function(e){e.stopPropagation();e.preventDefault()}).on("dragleave",".c-fileupload-dropzone",function(e){e.stopPropagation();e.preventDefault();$(this).removeClass("c-fileupload-dropzone-active")}).on("drop",".c-fileupload-dropzone",function(e){e.stopPropagation();e.preventDefault();$(this).removeClass("c-fileupload-dropzone-active");var fileUpload=getFileUpload(e);upload(fileUpload,e.originalEvent.dataTransfer.files)});$(document).on("dragenter",function(e){e.stopPropagation();e.preventDefault()}).on("dragover",function(e){e.stopPropagation();e.preventDefault()}).on("drop",function(e){e.stopPropagation();e.preventDefault()})}else $(Cognito.config.flags.AppNav?"body":".cognito").addClass("c-fileupload-dropzone-hidden")})})(ExoJQuery)})(typeof exports=="undefined")
})();

});
