function slider_onSlide(n,t){if(t&&t.values[0]+5>=t.values[1])return!1;var r=$("#project-budget-slider-control").slider("values",0),i=$("#project-budget-slider-control").slider("values",1),f=formatBudgetDisplay(r),u=formatBudgetDisplay(i);$("#project-budget-min").val(r);$("#project-budget-max").val(i);i>=1e3&&(u+="+",$("#project-budget-max").val(999999));$("#project-budget-slider").val(f+" - "+u)}function slider_onChange(){clearInterval(searchTimer);searchTimer=setTimeout(function(){$("#project-budget-min").change()},2e3)}function CreateRow(n,t){var f=formatBudgetDisplay(t.properties.cost),u="",r,i;if(window.showExtraColumns||(u='target="_blank"'),r="",t.properties.municipalities!=null&&(r=t.properties.municipalities.join(", ")),i="",i+=window.showExtraColumns?"<tr class='result-item "+t.properties.status.toLowerCase()+"'>":"<tr class='result-item'>",window.showExtraColumns){var e=' data-allowApprove="'+t.permissions.allowApprove+'" ',o=' data-allowReject="'+t.permissions.allowReject+'" ',s=' data-allowPublish="'+t.permissions.allowPublish+'" ';i+='<td><input name="recordsToAction" value="'+t.properties.id+'" '+e+o+s+' type="checkbox" /><\/td>'}return i+="<td data-th='Name' data-value='"+t.properties.name.toLowerCase()+"'><a href='"+n+"' "+u+">"+t.properties.name+"<\/a><\/td>",window.showExtraColumns?(i+="<td data-th='Schedule Start' data-value='"+t.properties.schedule+"' >"+t.properties.schedule+"<\/td>",i+="<td data-th='Schedule End' data-value='"+t.properties.scheduleEnd+"' >"+t.properties.scheduleEnd+"<\/td>"):i+="<td data-th='Municipality'>"+r+"<\/td>",i+=t.properties.type!=null?"<td data-th='Sector / Type' data-value='"+t.properties.sector+" - "+t.properties.type+"'>"+t.properties.sector+" - "+t.properties.type+"<\/td>":"<td data-th='Sector / Type' data-value='"+t.properties.sector+"'>"+t.properties.sector+"<\/td>",i+="<td data-th='Budget' data-value='"+t.properties.cost+"' class='text-center'>"+f+"<\/td>",window.showExtraColumns?(i+="<td data-th='Action' data-value='"+t.properties.action+"' class='text-center'>"+t.properties.action+"<\/td>",i+="<td data-th='Status' data-value='"+t.properties.status+"' class='text-center'>"+t.properties.status+"<\/td>"):(i+="<td class='' data-th='Stage' data-value='"+t.properties.stageSort+"' class='text-center'>"+t.properties.stage+"<\/td>",i+="<td class='' data-th='Schedule' data-value='"+t.properties.schedule+"' class='text-center'>"+t.properties.schedule+"<\/td>"),i+"<\/tr>"}function GenerateHash(){if(store("activeMapListTab")){var n=window.location.hash,t="#"+store("activeMapListTab")+"/";window.location.hash.indexOf("#/")!==-1?(n=window.location.hash.replace("#/",t),window.location.hash=n):window.location.hash.indexOf("#list/")!==-1?(n=window.location.hash.replace("#list/",t),window.location.hash=n):window.location.hash.indexOf("#map/")!==-1?(n=window.location.hash.replace("#map/",t),window.location.hash=n):window.location.hash=t;$(document).trigger("hash-changed")}store("activeMapListTab",null)}function formatBudgetDisplay(n){var t="TBD";return n!=null&&(t=parseFloat(n).toFixed(0).length>=4?"$"+(parseFloat(n)/1e3).toFixed(1).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"B":"$"+parseFloat(n).toFixed(1).replace(/\d(?=(\d{3})+\.)/g,"$&,")+"M"),t}var searchTimer,tableSorterInitialized;Enumerable=function(){var n=function(n){this.GetEnumerator=n},s,u;n.Choice=function(){var t=arguments[0]instanceof Array?arguments[0]:arguments;return new n(function(){return new i(r.Blank,function(){return this.Yield(t[Math.floor(Math.random()*t.length)])},r.Blank)})};n.Cycle=function(){var t=arguments[0]instanceof Array?arguments[0]:arguments;return new n(function(){var n=0;return new i(r.Blank,function(){return n>=t.length&&(n=0),this.Yield(t[n++])},r.Blank)})};n.Empty=function(){return new n(function(){return new i(r.Blank,function(){return!1},r.Blank)})};n.From=function(e){if(e==null)return n.Empty();if(e instanceof n)return e;if(typeof e==f.Number||typeof e==f.Boolean)return n.Repeat(e,1);if(typeof e==f.String)return new n(function(){var n=0;return new i(r.Blank,function(){return n<e.length?this.Yield(e.charAt(n++)):!1},r.Blank)});if(typeof e!=f.Function){if(typeof e.length==f.Number)return new u(e);if(!(e instanceof Object)&&t.IsIEnumerable(e))return new n(function(){var t=!0,n;return new i(function(){n=new Enumerator(e)},function(){return t?t=!1:n.moveNext(),n.atEnd()?!1:this.Yield(n.item())},r.Blank)})}return new n(function(){var n=[],t=0;return new i(function(){for(var t in e)e[t]instanceof Function||n.push({Key:t,Value:e[t]})},function(){return t<n.length?this.Yield(n[t++]):!1},r.Blank)})};n.Return=function(t){return n.Repeat(t,1)};n.Matches=function(t,u,f){return f==null&&(f=""),u instanceof RegExp&&(f+=u.ignoreCase?"i":"",f+=u.multiline?"m":"",u=u.source),f.indexOf("g")===-1&&(f+="g"),new n(function(){var n;return new i(function(){n=new RegExp(u,f)},function(){var i=n.exec(t);return i?this.Yield(i):!1},r.Blank)})};n.Range=function(t,i,r){return r==null&&(r=1),n.ToInfinity(t,r).Take(i)};n.RangeDown=function(t,i,r){return r==null&&(r=1),n.ToNegativeInfinity(t,r).Take(i)};n.RangeTo=function(t,i,r){return r==null&&(r=1),t<i?n.ToInfinity(t,r).TakeWhile(function(n){return n<=i}):n.ToNegativeInfinity(t,r).TakeWhile(function(n){return n>=i})};n.Repeat=function(t,u){return u!=null?n.Repeat(t).Take(u):new n(function(){return new i(r.Blank,function(){return this.Yield(t)},r.Blank)})};n.RepeatWithFinalize=function(r,u){return r=t.CreateLambda(r),u=t.CreateLambda(u),new n(function(){var n;return new i(function(){n=r()},function(){return this.Yield(n)},function(){n!=null&&(u(n),n=null)})})};n.Generate=function(u,f){return f!=null?n.Generate(u).Take(f):(u=t.CreateLambda(u),new n(function(){return new i(r.Blank,function(){return this.Yield(u())},r.Blank)}))};n.ToInfinity=function(t,u){return t==null&&(t=0),u==null&&(u=1),new n(function(){var n;return new i(function(){n=t-u},function(){return this.Yield(n+=u)},r.Blank)})};n.ToNegativeInfinity=function(t,u){return t==null&&(t=0),u==null&&(u=1),new n(function(){var n;return new i(function(){n=t+u},function(){return this.Yield(n-=u)},r.Blank)})};n.Unfold=function(u,f){return f=t.CreateLambda(f),new n(function(){var t=!0,n;return new i(r.Blank,function(){return t?(t=!1,n=u,this.Yield(n)):(n=f(n),this.Yield(n))},r.Blank)})};n.prototype={CascadeBreadthFirst:function(r,u){var f=this;return r=t.CreateLambda(r),u=t.CreateLambda(u),new n(function(){var e,s=0,o=[];return new i(function(){e=f.GetEnumerator()},function(){for(;;){if(e.MoveNext())return o.push(e.Current()),this.Yield(u(e.Current(),s));var i=n.From(o).SelectMany(function(n){return r(n)});if(i.Any())s++,o=[],t.Dispose(e),e=i.GetEnumerator();else return!1}},function(){t.Dispose(e)})})},CascadeDepthFirst:function(r,u){var f=this;return r=t.CreateLambda(r),u=t.CreateLambda(u),new n(function(){var o=[],e;return new i(function(){e=f.GetEnumerator()},function(){for(;;){if(e.MoveNext()){var i=u(e.Current(),o.length);return o.push(e),e=n.From(r(e.Current())).GetEnumerator(),this.Yield(i)}if(o.length<=0)return!1;t.Dispose(e);e=o.pop()}},function(){try{t.Dispose(e)}finally{n.From(o).ForEach(function(n){n.Dispose()})}})})},Flatten:function(){var u=this;return new n(function(){var e,f=null;return new i(function(){e=u.GetEnumerator()},function(){for(;;){if(f!=null){if(f.MoveNext())return this.Yield(f.Current());f=null}if(e.MoveNext())if(e.Current()instanceof Array){t.Dispose(f);f=n.From(e.Current()).SelectMany(r.Identity).Flatten().GetEnumerator();continue}else return this.Yield(e.Current());return!1}},function(){try{t.Dispose(e)}finally{t.Dispose(f)}})})},Pairwise:function(r){var u=this;return r=t.CreateLambda(r),new n(function(){var n;return new i(function(){n=u.GetEnumerator();n.MoveNext()},function(){var t=n.Current();return n.MoveNext()?this.Yield(r(t,n.Current())):!1},function(){t.Dispose(n)})})},Scan:function(r,u,f){var e,o;return f!=null?this.Scan(r,u).Select(f):(u==null?(u=t.CreateLambda(r),e=!1):(u=t.CreateLambda(u),e=!0),o=this,new n(function(){var n,f,s=!0;return new i(function(){n=o.GetEnumerator()},function(){if(s){if(s=!1,e)return this.Yield(f=r);if(n.MoveNext())return this.Yield(f=n.Current())}return n.MoveNext()?this.Yield(f=u(f,n.Current())):!1},function(){t.Dispose(n)})}))},Select:function(r){var u=this;return r=t.CreateLambda(r),new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?this.Yield(r(n.Current(),f++)):!1},function(){t.Dispose(n)})})},SelectMany:function(r,u){var f=this;return r=t.CreateLambda(r),u==null&&(u=function(n,t){return t}),u=t.CreateLambda(u),new n(function(){var o,e=undefined,s=0;return new i(function(){o=f.GetEnumerator()},function(){if(e===undefined&&!o.MoveNext())return!1;do{if(e==null){var i=r(o.Current(),s++);e=n.From(i).GetEnumerator()}if(e.MoveNext())return this.Yield(u(o.Current(),e.Current()));t.Dispose(e);e=null}while(o.MoveNext());return!1},function(){try{t.Dispose(o)}finally{t.Dispose(e)}})})},Where:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){while(n.MoveNext())if(r(n.Current(),f++))return this.Yield(n.Current());return!1},function(){t.Dispose(n)})})},OfType:function(n){var t;switch(n){case Number:t=f.Number;break;case String:t=f.String;break;case Boolean:t=f.Boolean;break;case Function:t=f.Function;break;default:t=null}return t===null?this.Where(function(t){return t instanceof n}):this.Where(function(n){return typeof n===t})},Zip:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var e,o,s=0;return new i(function(){e=f.GetEnumerator();o=n.From(r).GetEnumerator()},function(){return e.MoveNext()&&o.MoveNext()?this.Yield(u(e.Current(),o.Current(),s++)):!1},function(){try{t.Dispose(e)}finally{t.Dispose(o)}})})},Join:function(u,f,e,o,s){f=t.CreateLambda(f);e=t.CreateLambda(e);o=t.CreateLambda(o);s=t.CreateLambda(s);var h=this;return new n(function(){var c,a,l=null,v=0;return new i(function(){c=h.GetEnumerator();a=n.From(u).ToLookup(e,r.Identity,s)},function(){for(var n,t;;){if(l!=null){if(n=l[v++],n!==undefined)return this.Yield(o(c.Current(),n));n=null;v=0}if(c.MoveNext())t=f(c.Current()),l=a.Get(t).ToArray();else return!1}},function(){t.Dispose(c)})})},GroupJoin:function(u,f,e,o,s){f=t.CreateLambda(f);e=t.CreateLambda(e);o=t.CreateLambda(o);s=t.CreateLambda(s);var h=this;return new n(function(){var c=h.GetEnumerator(),l=null;return new i(function(){c=h.GetEnumerator();l=n.From(u).ToLookup(e,r.Identity,s)},function(){if(c.MoveNext()){var n=l.Get(f(c.Current()));return this.Yield(o(c.Current(),n))}return!1},function(){t.Dispose(c)})})},All:function(n){n=t.CreateLambda(n);var i=!0;return this.ForEach(function(t){if(!n(t))return i=!1,!1}),i},Any:function(n){n=t.CreateLambda(n);var i=this.GetEnumerator();try{if(arguments.length==0)return i.MoveNext();while(i.MoveNext())if(n(i.Current()))return!0;return!1}finally{t.Dispose(i)}},Concat:function(r){var u=this;return new n(function(){var e,f;return new i(function(){e=u.GetEnumerator()},function(){if(f==null){if(e.MoveNext())return this.Yield(e.Current());f=n.From(r).GetEnumerator()}return f.MoveNext()?this.Yield(f.Current()):!1},function(){try{t.Dispose(e)}finally{t.Dispose(f)}})})},Insert:function(r,u){var f=this;return new n(function(){var o,e,s=0,h=!1;return new i(function(){o=f.GetEnumerator();e=n.From(u).GetEnumerator()},function(){return s==r&&e.MoveNext()?(h=!0,this.Yield(e.Current())):o.MoveNext()?(s++,this.Yield(o.Current())):!h&&e.MoveNext()?this.Yield(e.Current()):!1},function(){try{t.Dispose(o)}finally{t.Dispose(e)}})})},Alternate:function(t){return t=n.Return(t),this.SelectMany(function(i){return n.Return(i).Concat(t)}).TakeExceptLast()},Contains:function(n,i){i=t.CreateLambda(i);var r=this.GetEnumerator();try{while(r.MoveNext())if(i(r.Current())===n)return!0;return!1}finally{t.Dispose(r)}},DefaultIfEmpty:function(r){var u=this;return new n(function(){var n,f=!0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?(f=!1,this.Yield(n.Current())):f?(f=!1,this.Yield(r)):!1},function(){t.Dispose(n)})})},Distinct:function(t){return this.Except(n.Empty(),t)},Except:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var e,o;return new i(function(){e=f.GetEnumerator();o=new h(u);n.From(r).ForEach(function(n){o.Add(n)})},function(){while(e.MoveNext()){var n=e.Current();if(!o.Contains(n))return o.Add(n),this.Yield(n)}return!1},function(){t.Dispose(e)})})},Intersect:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var e,o,s;return new i(function(){e=f.GetEnumerator();o=new h(u);n.From(r).ForEach(function(n){o.Add(n)});s=new h(u)},function(){while(e.MoveNext()){var n=e.Current();if(!s.Contains(n)&&o.Contains(n))return s.Add(n),this.Yield(n)}return!1},function(){t.Dispose(e)})})},SequenceEqual:function(i,r){var f,u;r=t.CreateLambda(r);f=this.GetEnumerator();try{u=n.From(i).GetEnumerator();try{while(f.MoveNext())if(!u.MoveNext()||r(f.Current())!==r(u.Current()))return!1;return u.MoveNext()?!1:!0}finally{t.Dispose(u)}}finally{t.Dispose(f)}},Union:function(r,u){u=t.CreateLambda(u);var f=this;return new n(function(){var s,e,o;return new i(function(){s=f.GetEnumerator();o=new h(u)},function(){var t;if(e===undefined){while(s.MoveNext())if(t=s.Current(),!o.Contains(t))return o.Add(t),this.Yield(t);e=n.From(r).GetEnumerator()}while(e.MoveNext())if(t=e.Current(),!o.Contains(t))return o.Add(t),this.Yield(t);return!1},function(){try{t.Dispose(s)}finally{t.Dispose(e)}})})},OrderBy:function(n){return new e(this,n,!1)},OrderByDescending:function(n){return new e(this,n,!0)},Reverse:function(){var t=this;return new n(function(){var n,u;return new i(function(){n=t.ToArray();u=n.length},function(){return u>0?this.Yield(n[--u]):!1},r.Blank)})},Shuffle:function(){var t=this;return new n(function(){var n;return new i(function(){n=t.ToArray()},function(){if(n.length>0){var t=Math.floor(Math.random()*n.length);return this.Yield(n.splice(t,1)[0])}return!1},r.Blank)})},GroupBy:function(r,u,f,e){var o=this;return r=t.CreateLambda(r),u=t.CreateLambda(u),f!=null&&(f=t.CreateLambda(f)),e=t.CreateLambda(e),new n(function(){var n;return new i(function(){n=o.ToLookup(r,u,e).ToEnumerable().GetEnumerator()},function(){while(n.MoveNext())return f==null?this.Yield(n.Current()):this.Yield(f(n.Current().Key(),n.Current()));return!1},function(){t.Dispose(n)})})},PartitionBy:function(r,u,f,e){var s=this,o;return r=t.CreateLambda(r),u=t.CreateLambda(u),e=t.CreateLambda(e),f==null?(o=!1,f=function(n,t){return new c(n,t)}):(o=!0,f=t.CreateLambda(f)),new n(function(){var h,l,a,c=[];return new i(function(){h=s.GetEnumerator();h.MoveNext()&&(l=r(h.Current()),a=e(l),c.push(u(h.Current())))},function(){for(var t,i;(t=h.MoveNext())==!0;)if(a===e(r(h.Current())))c.push(u(h.Current()));else break;return c.length>0?(i=o?f(l,n.From(c)):f(l,c),t?(l=r(h.Current()),a=e(l),c=[u(h.Current())]):c=[],this.Yield(i)):!1},function(){t.Dispose(h)})})},BufferWithCount:function(r){var u=this;return new n(function(){var n;return new i(function(){n=u.GetEnumerator()},function(){for(var t=[],i=0;n.MoveNext();)if(t.push(n.Current()),++i>=r)return this.Yield(t);return t.length>0?this.Yield(t):!1},function(){t.Dispose(n)})})},Aggregate:function(n,t,i){return this.Scan(n,t,i).Last()},Average:function(n){n=t.CreateLambda(n);var i=0,r=0;return this.ForEach(function(t){i+=n(t);++r}),i/r},Count:function(n){n=n==null?r.True:t.CreateLambda(n);var i=0;return this.ForEach(function(t,r){n(t,r)&&++i}),i},Max:function(n){return n==null&&(n=r.Identity),this.Select(n).Aggregate(function(n,t){return n>t?n:t})},Min:function(n){return n==null&&(n=r.Identity),this.Select(n).Aggregate(function(n,t){return n<t?n:t})},MaxBy:function(n){return n=t.CreateLambda(n),this.Aggregate(function(t,i){return n(t)>n(i)?t:i})},MinBy:function(n){return n=t.CreateLambda(n),this.Aggregate(function(t,i){return n(t)<n(i)?t:i})},Sum:function(n){return n==null&&(n=r.Identity),this.Select(n).Aggregate(0,function(n,t){return n+t})},ElementAt:function(n){var t,i=!1;if(this.ForEach(function(r,u){if(u==n)return t=r,i=!0,!1}),!i)throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");return t},ElementAtOrDefault:function(n,t){var i,r=!1;return this.ForEach(function(t,u){if(u==n)return i=t,r=!0,!1}),r?i:t},First:function(n){if(n!=null)return this.Where(n).First();var t,i=!1;if(this.ForEach(function(n){return t=n,i=!0,!1}),!i)throw new Error("First:No element satisfies the condition.");return t},FirstOrDefault:function(n,t){if(t!=null)return this.Where(t).FirstOrDefault(n);var i,r=!1;return this.ForEach(function(n){return i=n,r=!0,!1}),r?i:n},Last:function(n){if(n!=null)return this.Where(n).Last();var t,i=!1;if(this.ForEach(function(n){i=!0;t=n}),!i)throw new Error("Last:No element satisfies the condition.");return t},LastOrDefault:function(n,t){if(t!=null)return this.Where(t).LastOrDefault(n);var i,r=!1;return this.ForEach(function(n){r=!0;i=n}),r?i:n},Single:function(n){if(n!=null)return this.Where(n).Single();var i,t=!1;if(this.ForEach(function(n){if(t)throw new Error("Single:sequence contains more than one element.");else t=!0,i=n}),!t)throw new Error("Single:No element satisfies the condition.");return i},SingleOrDefault:function(n,t){if(t!=null)return this.Where(t).SingleOrDefault(n);var r,i=!1;return this.ForEach(function(n){if(i)throw new Error("Single:sequence contains more than one element.");else i=!0,r=n}),i?r:n},Skip:function(r){var u=this;return new n(function(){var n,f=0;return new i(function(){for(n=u.GetEnumerator();f++<r&&n.MoveNext(););},function(){return n.MoveNext()?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},SkipWhile:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n,e=0,f=!1;return new i(function(){n=u.GetEnumerator()},function(){while(!f)if(n.MoveNext()){if(!r(n.Current(),e++))return f=!0,this.Yield(n.Current());continue}else return!1;return n.MoveNext()?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},Take:function(r){var u=this;return new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return f++<r&&n.MoveNext()?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},TakeWhile:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()&&r(n.Current(),f++)?this.Yield(n.Current()):!1},function(){t.Dispose(n)})})},TakeExceptLast:function(r){r==null&&(r=1);var u=this;return new n(function(){if(r<=0)return u.GetEnumerator();var n,f=[];return new i(function(){n=u.GetEnumerator()},function(){while(n.MoveNext()){if(f.length==r)return f.push(n.Current()),this.Yield(f.shift());f.push(n.Current())}return!1},function(){t.Dispose(n)})})},TakeFromLast:function(r){if(r<=0||r==null)return n.Empty();var u=this;return new n(function(){var o,f,e=[];return new i(function(){o=u.GetEnumerator()},function(){while(o.MoveNext())e.length==r&&e.shift(),e.push(o.Current());return f==null&&(f=n.From(e).GetEnumerator()),f.MoveNext()?this.Yield(f.Current()):!1},function(){t.Dispose(f)})})},IndexOf:function(n){var t=null;return this.ForEach(function(i,r){if(i===n)return t=r,!0}),t!==null?t:-1},LastIndexOf:function(n){var t=-1;return this.ForEach(function(i,r){i===n&&(t=r)}),t},ToArray:function(){var n=[];return this.ForEach(function(t){n.push(t)}),n},ToLookup:function(n,i,r){n=t.CreateLambda(n);i=t.CreateLambda(i);r=t.CreateLambda(r);var u=new h(r);return this.ForEach(function(t){var r=n(t),f=i(t),e=u.Get(r);e!==undefined?e.push(f):u.Add(r,[f])}),new a(u)},ToObject:function(n,i){n=t.CreateLambda(n);i=t.CreateLambda(i);var r={};return this.ForEach(function(t){r[n(t)]=i(t)}),r},ToDictionary:function(n,i,r){n=t.CreateLambda(n);i=t.CreateLambda(i);r=t.CreateLambda(r);var u=new h(r);return this.ForEach(function(t){u.Add(n(t),i(t))}),u},ToJSON:function(n,t){return JSON.stringify(this.ToArray(),n,t)},ToString:function(n,t){return n==null&&(n=""),t==null&&(t=r.Identity),this.Select(t).ToArray().join(n)},Do:function(r){var u=this;return r=t.CreateLambda(r),new n(function(){var n,f=0;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?(r(n.Current(),f++),this.Yield(n.Current())):!1},function(){t.Dispose(n)})})},ForEach:function(n){n=t.CreateLambda(n);var r=0,i=this.GetEnumerator();try{while(i.MoveNext())if(n(i.Current(),r++)===!1)break}finally{t.Dispose(i)}},Write:function(n,i){n==null&&(n="");i=t.CreateLambda(i);var r=!0;this.ForEach(function(t){r?r=!1:document.write(n);document.write(i(t))})},WriteLine:function(n){n=t.CreateLambda(n);this.ForEach(function(t){document.write(n(t));document.write("<br />")})},Force:function(){var n=this.GetEnumerator();try{while(n.MoveNext());}finally{t.Dispose(n)}},Let:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var f;return new i(function(){f=n.From(r(u)).GetEnumerator()},function(){return f.MoveNext()?this.Yield(f.Current()):!1},function(){t.Dispose(f)})})},Share:function(){var u=this,t;return new n(function(){return new i(function(){t==null&&(t=u.GetEnumerator())},function(){return t.MoveNext()?this.Yield(t.Current()):!1},r.Blank)})},MemoizeAll:function(){var f=this,t,u;return new n(function(){var n=-1;return new i(function(){u==null&&(u=f.GetEnumerator(),t=[])},function(){return(n++,t.length<=n)?u.MoveNext()?this.Yield(t[n]=u.Current()):!1:this.Yield(t[n])},r.Blank)})},Catch:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n;return new i(function(){n=u.GetEnumerator()},function(){try{return n.MoveNext()?this.Yield(n.Current()):!1}catch(t){return r(t),!1}},function(){t.Dispose(n)})})},Finally:function(r){r=t.CreateLambda(r);var u=this;return new n(function(){var n;return new i(function(){n=u.GetEnumerator()},function(){return n.MoveNext()?this.Yield(n.Current()):!1},function(){try{t.Dispose(n)}finally{r()}})})},Trace:function(n,i){return n==null&&(n="Trace"),i=t.CreateLambda(i),this.Do(function(t){console.log(n,":",i(t))})}};var r={Identity:function(n){return n},True:function(){return!0},Blank:function(){}},f={Boolean:"boolean",Number:"number",String:"string",Object:"object",Undefined:typeof undefined,Function:typeof function(){}},t={CreateLambda:function(n){if(n==null)return r.Identity;if(typeof n==f.String){if(n=="")return r.Identity;if(n.indexOf("=>")==-1)return new Function("$,$$,$$$,$$$$","return "+n);var t=n.match(/^[(\s]*([^()]*?)[)\s]*=>(.*)/);return new Function(t[1],"return "+t[2])}return n},IsIEnumerable:function(n){if(typeof Enumerator!=f.Undefined)try{return new Enumerator(n),!0}catch(t){}return!1},Compare:function(n,t){return n===t?0:n>t?1:-1},Dispose:function(n){n!=null&&n.Dispose()}},o={Before:0,Running:1,After:2},i=function(n,t,i){var u=new l,r=o.Before;this.Current=u.Current;this.MoveNext=function(){try{switch(r){case o.Before:r=o.Running;n();case o.Running:return t.apply(u)?!0:(this.Dispose(),!1);case o.After:return!1}}catch(i){this.Dispose();throw i;}};this.Dispose=function(){if(r==o.Running)try{i()}finally{r=o.After}}},l=function(){var n=null;this.Current=function(){return n};this.Yield=function(t){return n=t,!0}},e=function(n,i,r,u){this.source=n;this.keySelector=t.CreateLambda(i);this.descending=r;this.parent=u};e.prototype=new n;e.prototype.CreateOrderedEnumerable=function(n,t){return new e(this.source,n,t,this)};e.prototype.ThenBy=function(n){return this.CreateOrderedEnumerable(n,!1)};e.prototype.ThenByDescending=function(n){return this.CreateOrderedEnumerable(n,!0)};e.prototype.GetEnumerator=function(){var u=this,t,n,f=0;return new i(function(){t=[];n=[];u.source.ForEach(function(i,r){t.push(i);n.push(r)});var i=s.Create(u,null);i.GenerateKeys(t);n.sort(function(n,t){return i.Compare(n,t)})},function(){return f<n.length?this.Yield(t[n[f++]]):!1},r.Blank)};s=function(n,t,i){this.keySelector=n;this.descending=t;this.child=i;this.keys=null};s.Create=function(n,t){var i=new s(n.keySelector,n.descending,t);return n.parent!=null?s.Create(n.parent,i):i};s.prototype.GenerateKeys=function(n){for(var i=n.length,u=this.keySelector,r=new Array(i),t=0;t<i;t++)r[t]=u(n[t]);this.keys=r;this.child!=null&&this.child.GenerateKeys(n)};s.prototype.Compare=function(n,i){var r=t.Compare(this.keys[n],this.keys[i]);if(r==0){if(this.child!=null)return this.child.Compare(n,i);r=t.Compare(n,i)}return this.descending?-r:r};u=function(n){this.source=n};u.prototype=new n;u.prototype.Any=function(t){return t==null?this.source.length>0:n.prototype.Any.apply(this,arguments)};u.prototype.Count=function(t){return t==null?this.source.length:n.prototype.Count.apply(this,arguments)};u.prototype.ElementAt=function(t){return 0<=t&&t<this.source.length?this.source[t]:n.prototype.ElementAt.apply(this,arguments)};u.prototype.ElementAtOrDefault=function(n,t){return 0<=n&&n<this.source.length?this.source[n]:t};u.prototype.First=function(t){return t==null&&this.source.length>0?this.source[0]:n.prototype.First.apply(this,arguments)};u.prototype.FirstOrDefault=function(t,i){return i!=null?n.prototype.FirstOrDefault.apply(this,arguments):this.source.length>0?this.source[0]:t};u.prototype.Last=function(t){return t==null&&this.source.length>0?this.source[this.source.length-1]:n.prototype.Last.apply(this,arguments)};u.prototype.LastOrDefault=function(t,i){return i!=null?n.prototype.LastOrDefault.apply(this,arguments):this.source.length>0?this.source[this.source.length-1]:t};u.prototype.Skip=function(t){var u=this.source;return new n(function(){var n;return new i(function(){n=t<0?0:t},function(){return n<u.length?this.Yield(u[n++]):!1},r.Blank)})};u.prototype.TakeExceptLast=function(n){return n==null&&(n=1),this.Take(this.source.length-n)};u.prototype.TakeFromLast=function(n){return this.Skip(this.source.length-n)};u.prototype.Reverse=function(){var t=this.source;return new n(function(){var n;return new i(function(){n=t.length},function(){return n>0?this.Yield(t[--n]):!1},r.Blank)})};u.prototype.SequenceEqual=function(t,i){return(t instanceof u||t instanceof Array)&&i==null&&n.From(t).Count()!=this.Count()?!1:n.prototype.SequenceEqual.apply(this,arguments)};u.prototype.ToString=function(t,i){return i!=null||!(this.source instanceof Array)?n.prototype.ToString.apply(this,arguments):(t==null&&(t=""),this.source.join(t))};u.prototype.GetEnumerator=function(){var n=this.source,t=0;return new i(r.Blank,function(){return t<n.length?this.Yield(n[t++]):!1},r.Blank)};var h=function(){var t=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},u=function(n){return n===null?"null":n===undefined?"undefined":typeof n.toString===f.Function?n.toString():Object.prototype.toString.call(n)},s=function(n,t){this.Key=n;this.Value=t;this.Prev=null;this.Next=null},e=function(){this.First=null;this.Last=null},o;return e.prototype={AddLast:function(n){this.Last!=null?(this.Last.Next=n,n.Prev=this.Last,this.Last=n):this.First=this.Last=n},Replace:function(n,t){n.Prev!=null?(n.Prev.Next=t,t.Prev=n.Prev):this.First=t;n.Next!=null?(n.Next.Prev=t,t.Next=n.Next):this.Last=t},Remove:function(n){n.Prev!=null?n.Prev.Next=n.Next:this.First=n.Next;n.Next!=null?n.Next.Prev=n.Prev:this.Last=n.Prev}},o=function(n){this.count=0;this.entryList=new e;this.buckets={};this.compareSelector=n==null?r.Identity:n},o.prototype={Add:function(n,i){var h=this.compareSelector(n),o=u(h),e=new s(n,i),r,f;if(t(this.buckets,o)){for(r=this.buckets[o],f=0;f<r.length;f++)if(this.compareSelector(r[f].Key)===h){this.entryList.Replace(r[f],e);r[f]=e;return}r.push(e)}else this.buckets[o]=[e];this.count++;this.entryList.AddLast(e)},Get:function(n){var e=this.compareSelector(n),o=u(e),r,i,f;if(!t(this.buckets,o))return undefined;for(r=this.buckets[o],i=0;i<r.length;i++)if(f=r[i],this.compareSelector(f.Key)===e)return f.Value;return undefined},Set:function(n,i){var o=this.compareSelector(n),h=u(o),f,r,e;if(t(this.buckets,h))for(f=this.buckets[h],r=0;r<f.length;r++)if(this.compareSelector(f[r].Key)===o)return e=new s(n,i),this.entryList.Replace(f[r],e),f[r]=e,!0;return!1},Contains:function(n){var f=this.compareSelector(n),e=u(f),r,i;if(!t(this.buckets,e))return!1;for(r=this.buckets[e],i=0;i<r.length;i++)if(this.compareSelector(r[i].Key)===f)return!0;return!1},Clear:function(){this.count=0;this.buckets={};this.entryList=new e},Remove:function(n){var e=this.compareSelector(n),f=u(e),i,r;if(t(this.buckets,f))for(i=this.buckets[f],r=0;r<i.length;r++)if(this.compareSelector(i[r].Key)===e){this.entryList.Remove(i[r]);i.splice(r,1);i.length==0&&delete this.buckets[f];this.count--;return}},Count:function(){return this.count},ToEnumerable:function(){var t=this;return new n(function(){var n;return new i(function(){n=t.entryList.First},function(){if(n!=null){var t={Key:n.Key,Value:n.Value};return n=n.Next,this.Yield(t)}return!1},r.Blank)})}},o}(),a=function(t){this.Count=function(){return t.Count()};this.Get=function(i){return n.From(t.Get(i))};this.Contains=function(n){return t.Contains(n)};this.ToEnumerable=function(){return t.ToEnumerable().Select(function(n){return new c(n.Key,n.Value)})}},c=function(n,t){this.Key=function(){return n};u.call(this,t)};return c.prototype=new u,n}(),function(n){"use strict";var t=function(t,i){var u=this,p={allowFreeEntries:!0,allowDuplicates:!1,ajaxConfig:{},autoSelect:!0,selectFirst:!1,queryParam:"query",beforeSend:function(){},cls:"",data:null,dataUrlParams:{},disabled:!1,disabledField:null,displayField:"name",editable:!0,expanded:!1,expandOnFocus:!1,groupBy:null,hideTrigger:!1,highlight:!0,id:null,infoMsgCls:"",inputCfg:{},invalidCls:"ms-inv",matchCase:!1,maxDropHeight:290,maxEntryLength:null,maxEntryRenderer:function(n){return"Please reduce your entry by "+n+" character"+(n>1?"s":"")},maxSuggestions:null,maxSelection:10,maxSelectionRenderer:function(n){return"You cannot choose more than "+n+" item"+(n>1?"s":"")},method:"POST",minChars:0,minCharsRenderer:function(n){return"Please type "+n+" more character"+(n>1?"s":"")},mode:"local",name:null,noSuggestionText:"No suggestions",placeholder:"Type or click here",renderer:null,required:!1,resultAsString:!1,resultAsStringDelimiter:",",resultsField:"results",selectionCls:"",selectionContainer:null,selectionPosition:"inner",selectionRenderer:null,selectionStacked:!1,sortDir:"asc",sortOrder:null,strictSuggest:!1,style:"",toggleOnClick:!1,typeDelay:400,useTabKey:!1,useCommaKey:!0,useZebraStyle:!1,value:null,valueField:"id",vregex:null,vtype:null},w=n.extend({},i),r=n.extend(!0,{},p,w);this.addToSelection=function(t,i){if(!r.maxSelection||e.length<r.maxSelection){n.isArray(t)||(t=[t]);var o=!1;n.each(t,function(t,i){(r.allowDuplicates||n.inArray(i[r.valueField],u.getValue())===-1)&&(e.push(i),o=!0)});o===!0&&(f._renderSelection(),this.empty(),i!==!0&&n(this).trigger("selectionchange",[this,this.getSelection()]))}this.input.attr("placeholder",r.selectionPosition==="inner"&&this.getValue().length>0?"":r.placeholder)};this.clear=function(n){this.removeFromSelection(e.slice(0),n)};this.collapse=function(){r.expanded===!0&&(this.combobox.detach(),r.expanded=!1,n(this).trigger("collapse",[this]))};this.disable=function(){this.container.addClass("ms-ctn-disabled");r.disabled=!0;u.input.attr("disabled",!0)};this.empty=function(){this.input.val("")};this.enable=function(){this.container.removeClass("ms-ctn-disabled");r.disabled=!1;u.input.attr("disabled",!1)};this.expand=function(){!r.expanded&&(this.input.val().length>=r.minChars||this.combobox.children().size()>0)&&(this.combobox.appendTo(this.container),f._processSuggestions(),r.expanded=!0,n(this).trigger("expand",[this]))};this.isDisabled=function(){return r.disabled};this.isValid=function(){var t=r.required===!1||e.length>0;return(r.vtype||r.vregex)&&n.each(e,function(n,i){t=t&&f._validateSingleItem(i[r.valueField])}),t};this.getDataUrlParams=function(){return r.dataUrlParams};this.getName=function(){return r.name};this.getSelection=function(){return e};this.getRawValue=function(){return u.input.val()};this.getValue=function(){return n.map(e,function(n){return n[r.valueField]})};this.removeFromSelection=function(t,i){n.isArray(t)||(t=[t]);var o=!1;n.each(t,function(t,i){var f=n.inArray(i[r.valueField],u.getValue());f>-1&&(e.splice(f,1),o=!0)});o===!0&&(f._renderSelection(),i!==!0&&n(this).trigger("selectionchange",[this,this.getSelection()]),r.expandOnFocus&&u.expand(),r.expanded&&f._processSuggestions());this.input.attr("placeholder",r.selectionPosition==="inner"&&this.getValue().length>0?"":r.placeholder)};this.getData=function(){return a};this.setData=function(n){r.data=n;f._processSuggestions()};this.setName=function(t){r.name=t;t&&(r.name+=t.indexOf("[]")>0?"":"[]");u._valueContainer&&n.each(u._valueContainer.children(),function(n,t){t.name=r.name})};this.setSelection=function(n){this.clear();this.addToSelection(n)};this.setValue=function(t){var i=[];n.each(t,function(t,u){var e=!1,f;n.each(a,function(n,t){if(t[r.valueField]==u)return i.push(t),e=!0,!1});e||(typeof u=="object"?i.push(u):(f={},f[r.valueField]=u,f[r.displayField]=u,i.push(f)))});i.length>0&&this.addToSelection(i)};this.setDataUrlParams=function(t){r.dataUrlParams=n.extend({},t)};var e=[],h=0,y,c=!1,l=null,a=[],v=!1,o={BACKSPACE:8,TAB:9,ENTER:13,CTRL:17,ESC:27,SPACE:32,UPARROW:38,DOWNARROW:40,COMMA:188},f={_displaySuggestions:function(t){var i,e,o,s,c,a;if(u.combobox.show(),u.combobox.empty(),i=0,e=0,l===null)f._renderComboItems(t),i=h*t.length;else{for(o in l)e+=1,n("<div/>",{"class":"ms-res-group",html:o}).appendTo(u.combobox),f._renderComboItems(l[o].items,!0);s=u.combobox.find(".ms-res-group").outerHeight();s!==null?(c=e*s,i=h*t.length+c):i=h*(t.length+e)}i<u.combobox.height()||i<=r.maxDropHeight?u.combobox.height(i):i>=u.combobox.height()&&i>r.maxDropHeight&&u.combobox.height(r.maxDropHeight);t.length===1&&r.autoSelect===!0&&u.combobox.children().filter(":not(.ms-res-item-disabled):last").addClass("ms-res-item-active");r.selectFirst===!0&&u.combobox.children().filter(":not(.ms-res-item-disabled):first").addClass("ms-res-item-active");t.length===0&&u.getRawValue()!==""&&(a=r.noSuggestionText.replace(/\{\{.*\}\}/,u.input.val()),f._updateHelper(a),u.collapse());r.allowFreeEntries===!1&&(t.length===0?(n(u.input).addClass(r.invalidCls),u.combobox.hide()):n(u.input).removeClass(r.invalidCls))},_getEntriesFromStringArray:function(t){var i=[];return n.each(t,function(t,u){var f={};f[r.displayField]=f[r.valueField]=n.trim(u);i.push(f)}),i},_highlightSuggestion:function(t){var i=u.input.val(),f;return(n.each(["^","$","*","+","?",".","(",")",":","!","|","{","}","[","]"],function(n,t){i=i.replace(t,"\\"+t)}),i.length===0)?t:(f=r.matchCase===!0?"g":"gi",t.replace(new RegExp("("+i+")(?!([^<]+)?>)",f),"<em>$1<\/em>"))},_moveSelectedRow:function(n){r.expanded||u.expand();var i,t,f,e;i=u.combobox.find(".ms-res-item:not(.ms-res-item-disabled)");t=n==="down"?i.eq(0):i.filter(":last");f=u.combobox.find(".ms-res-item-active:not(.ms-res-item-disabled):first");f.length>0&&(n==="down"?(t=f.nextAll(".ms-res-item:not(.ms-res-item-disabled)").first(),t.length===0&&(t=i.eq(0)),e=u.combobox.scrollTop(),u.combobox.scrollTop(0),t[0].offsetTop+t.outerHeight()>u.combobox.height()&&u.combobox.scrollTop(e+h)):(t=f.prevAll(".ms-res-item:not(.ms-res-item-disabled)").first(),t.length===0&&(t=i.filter(":last"),u.combobox.scrollTop(h*i.length)),t[0].offsetTop<u.combobox.scrollTop()&&u.combobox.scrollTop(u.combobox.scrollTop()-h)));i.removeClass("ms-res-item-active");t.addClass("ms-res-item-active")},_processSuggestions:function(t){var e=null,i=t||r.data,o,s,h;if(i!==null){if(typeof i=="function"&&(i=i.call(u,u.getRawValue())),typeof i=="string"){n(u).trigger("beforeload",[u]);o={};o[r.queryParam]=u.input.val();s=n.extend(o,r.dataUrlParams);n.ajax(n.extend({type:r.method,url:i,data:s,beforeSend:r.beforeSend,success:function(t){e=typeof t=="string"?JSON.parse(t):t;f._processSuggestions(e);n(u).trigger("load",[u,e]);f._asyncValues&&(u.setValue(typeof f._asyncValues=="string"?JSON.parse(f._asyncValues):f._asyncValues),f._renderSelection(),delete f._asyncValues)},error:function(){throw"Could not reach server";}},r.ajaxConfig));return}a=i.length>0&&typeof i[0]=="string"?f._getEntriesFromStringArray(i):i[r.resultsField]||i;h=r.mode==="remote"?a:f._sortAndTrim(a);f._displaySuggestions(f._group(h))}},_render:function(t){u.setName(r.name);u.container=n("<div/>",{"class":"ms-ctn form-control "+(r.resultAsString?"ms-as-string ":"")+r.cls+(n(t).hasClass("input-lg")?" input-lg":"")+(n(t).hasClass("input-sm")?" input-sm":"")+(r.disabled===!0?" ms-ctn-disabled":"")+(r.editable===!0?"":" ms-ctn-readonly")+(r.hideTrigger===!1?"":" ms-no-trigger"),style:r.style,id:r.id});u.container.focus(n.proxy(s._onFocus,this));u.container.blur(n.proxy(s._onBlur,this));u.container.keydown(n.proxy(s._onKeyDown,this));u.container.keyup(n.proxy(s._onKeyUp,this));u.input=n("<input/>",n.extend({type:"text","class":r.editable===!0?"":" ms-input-readonly",readonly:!r.editable,placeholder:r.placeholder,disabled:r.disabled},r.inputCfg));u.input.focus(n.proxy(s._onInputFocus,this));u.input.click(n.proxy(s._onInputClick,this));u.combobox=n("<div/>",{"class":"ms-res-ctn dropdown-menu"}).height(r.maxDropHeight);u.combobox.on("click","div.ms-res-item",n.proxy(s._onComboItemSelected,this));u.combobox.on("mouseover","div.ms-res-item",n.proxy(s._onComboItemMouseOver,this));if(r.selectionContainer?(u.selectionContainer=r.selectionContainer,n(u.selectionContainer).addClass("ms-sel-ctn")):u.selectionContainer=n("<div/>",{"class":"ms-sel-ctn"}),u.selectionContainer.click(n.proxy(s._onFocus,this)),r.selectionPosition!=="inner"||r.selectionContainer?u.container.append(u.input):u.selectionContainer.append(u.input),u.helper=n("<span/>",{"class":"ms-helper "+r.infoMsgCls}),f._updateHelper(),u.container.append(u.helper),n(t).replaceWith(u.container),!r.selectionContainer)switch(r.selectionPosition){case"bottom":u.selectionContainer.insertAfter(u.container);r.selectionStacked===!0&&(u.selectionContainer.width(u.container.width()),u.selectionContainer.addClass("ms-stacked"));break;case"right":u.selectionContainer.insertAfter(u.container);u.container.css("float","left");break;default:u.container.append(u.selectionContainer)}r.hideTrigger===!1&&(u.trigger=n("<div/>",{"class":"ms-trigger",html:'<div class="ms-trigger-ico"><\/div>'}),u.trigger.click(n.proxy(s._onTriggerClick,this)),u.container.append(u.trigger));n(window).resize(n.proxy(s._onWindowResized,this));(r.value!==null||r.data!==null)&&(typeof r.data=="string"?(f._asyncValues=r.value,f._processSuggestions()):(f._processSuggestions(),r.value!==null&&(u.setValue(r.value),f._renderSelection())));n("body").click(function(t){u.container.hasClass("ms-ctn-focus")&&u.container.has(t.target).length===0&&n.inArray("ms-res-item",t.target.className)&&n.inArray("ms-close-btn",t.target.className)&&u.container[0]!==t.target&&s._onBlur()});r.expanded===!0&&(r.expanded=!1,u.expand())},_renderComboItems:function(t,i){var o=this,e="";n.each(t,function(t,u){var s=r.renderer!==null?r.renderer.call(o,u):u[r.displayField],h=r.disabledField!==null&&u[r.disabledField]===!0,c=n("<div/>",{"class":"ms-res-item "+(i?"ms-res-item-grouped ":"")+(h?"ms-res-item-disabled ":"")+(t%2==1&&r.useZebraStyle===!0?"ms-res-odd":""),html:r.highlight===!0?f._highlightSuggestion(s):s,"data-json":JSON.stringify(u)});e+=n("<div/>").append(c).html()});u.combobox.append(e);h=u.combobox.find(".ms-res-item:first").outerHeight()},_renderSelection:function(){var t=this,i=0,o=0,h=[],l=r.resultAsString===!0&&!c;u.selectionContainer.find(".ms-sel-item").remove();u._valueContainer!==undefined&&u._valueContainer.remove();n.each(e,function(i,u){var o,c,a=r.selectionRenderer!==null?r.selectionRenderer.call(t,u):u[r.displayField],v=f._validateSingleItem(u[r.displayField])?"":" ms-sel-invalid";l===!0?o=n("<div/>",{"class":"ms-sel-item ms-sel-text "+r.selectionCls+v,html:a+(i===e.length-1?"":r.resultAsStringDelimiter)}).data("json",u):(o=n("<div/>",{"class":"ms-sel-item "+r.selectionCls+v,html:a}).data("json",u),r.disabled===!1&&(c=n("<span/>",{"class":"ms-close-btn"}).data("json",u).appendTo(o),c.click(n.proxy(s._onTagTriggerClick,t))));h.push(o)});u.selectionContainer.prepend(h);u._valueContainer=n("<div/>",{style:"display: none;"});n.each(u.getValue(),function(t,i){var f=n("<input/>",{type:"hidden",name:r.name,value:i});f.appendTo(u._valueContainer)});u._valueContainer.appendTo(u.selectionContainer);r.selectionPosition!=="inner"||r.selectionContainer||(u.input.width(0),o=u.input.offset().left-u.selectionContainer.offset().left,i=u.container.width()-o-42,u.input.width(i));e.length===r.maxSelection?f._updateHelper(r.maxSelectionRenderer.call(this,e.length)):u.helper.hide()},_selectItem:function(n){r.maxSelection===1&&(e=[]);u.addToSelection(n.data("json"));n.removeClass("ms-res-item-active");(r.expandOnFocus===!1||e.length===r.maxSelection)&&u.collapse();c?c&&(r.expandOnFocus||v)&&(f._processSuggestions(),v&&u.expand()):u.input.focus()},_sortAndTrim:function(t){var f=u.getRawValue(),e=[],i=[],o=u.getValue();return f.length>0?n.each(t,function(n,t){var i=t[r.displayField];(r.matchCase===!0&&i.indexOf(f)>-1||r.matchCase===!1&&i.toLowerCase().indexOf(f.toLowerCase())>-1)&&(r.strictSuggest===!1||i.toLowerCase().indexOf(f.toLowerCase())===0)&&e.push(t)}):e=t,n.each(e,function(t,u){(r.allowDuplicates||n.inArray(u[r.valueField],o)===-1)&&i.push(u)}),r.sortOrder!==null&&i.sort(function(n,t){return n[r.sortOrder]<t[r.sortOrder]?r.sortDir==="asc"?-1:1:n[r.sortOrder]>t[r.sortOrder]?r.sortDir==="asc"?1:-1:0}),r.maxSuggestions&&r.maxSuggestions>0&&(i=i.slice(0,r.maxSuggestions)),i},_group:function(t){return r.groupBy!==null&&(l={},n.each(t,function(n,t){var u=r.groupBy.indexOf(".")>-1?r.groupBy.split("."):r.groupBy,i=t[r.groupBy];if(typeof u!="string")for(i=t;u.length>0;)i=i[u.shift()];l[i]===undefined?l[i]={title:i,items:[t]}:l[i].items.push(t)})),t},_updateHelper:function(n){u.helper.html(n);u.helper.is(":visible")||u.helper.fadeIn()},_validateSingleItem:function(n){if(r.vregex!==null&&r.vregex instanceof RegExp)return r.vregex.test(n);if(r.vtype!==null)switch(r.vtype){case"alpha":return/^[a-zA-Z_]+$/.test(n);case"alphanum":return/^[a-zA-Z0-9_]+$/.test(n);case"email":return/^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/.test(n);case"url":return/(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i.test(n);case"ipaddress":return/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)}return!0}},s={_onBlur:function(){if(u.container.removeClass("ms-ctn-focus"),u.collapse(),c=!1,u.getRawValue()!==""&&r.allowFreeEntries===!0){var t={};t[r.displayField]=t[r.valueField]=u.getRawValue().trim();u.addToSelection(t)}f._renderSelection();u.isValid()===!1?u.container.addClass(r.invalidCls):u.input.val()!==""&&r.allowFreeEntries===!1&&(u.empty(),f._updateHelper(""));n(u).trigger("blur",[u])},_onComboItemMouseOver:function(t){var i=n(t.currentTarget);i.hasClass("ms-res-item-disabled")||(u.combobox.children().removeClass("ms-res-item-active"),i.addClass("ms-res-item-active"))},_onComboItemSelected:function(t){var i=n(t.currentTarget);i.hasClass("ms-res-item-disabled")||f._selectItem(n(t.currentTarget))},_onFocus:function(){u.input.focus()},_onInputClick:function(){u.isDisabled()===!1&&c&&r.toggleOnClick===!0&&(r.expanded?u.collapse():u.expand())},_onInputFocus:function(){if(u.isDisabled()===!1&&!c){c=!0;u.container.addClass("ms-ctn-focus");u.container.removeClass(r.invalidCls);var t=u.getRawValue().length;r.expandOnFocus===!0&&u.expand();e.length===r.maxSelection?f._updateHelper(r.maxSelectionRenderer.call(this,e.length)):t<r.minChars&&f._updateHelper(r.minCharsRenderer.call(this,r.minChars-t));f._renderSelection();n(u).trigger("focus",[u])}},_onKeyDown:function(t){var h=u.combobox.find(".ms-res-item-active:not(.ms-res-item-disabled):first"),i=u.input.val();if(n(u).trigger("keydown",[u,t]),t.keyCode===o.TAB&&(r.useTabKey===!1||r.useTabKey===!0&&h.length===0&&u.input.val().length===0)){s._onBlur();return}switch(t.keyCode){case o.BACKSPACE:i.length===0&&u.getSelection().length>0&&r.selectionPosition==="inner"&&(e.pop(),f._renderSelection(),n(u).trigger("selectionchange",[u,u.getSelection()]),u.input.attr("placeholder",r.selectionPosition==="inner"&&u.getValue().length>0?"":r.placeholder),u.input.focus(),t.preventDefault());break;case o.TAB:case o.ESC:t.preventDefault();break;case o.ENTER:(i!==""||r.expanded)&&t.preventDefault();break;case o.COMMA:r.useCommaKey===!0&&t.preventDefault();break;case o.CTRL:v=!0;break;case o.DOWNARROW:t.preventDefault();f._moveSelectedRow("down");break;case o.UPARROW:t.preventDefault();f._moveSelectedRow("up");break;default:e.length===r.maxSelection&&t.preventDefault()}},_onKeyUp:function(t){var i=u.getRawValue(),c=n.trim(u.input.val()).length>0&&(!r.maxEntryLength||n.trim(u.input.val()).length<=r.maxEntryLength),s,h={};if(n(u).trigger("keyup",[u,t]),clearTimeout(y),t.keyCode===o.ESC&&r.expanded&&u.combobox.hide(),t.keyCode===o.TAB&&r.useTabKey===!1||t.keyCode>o.ENTER&&t.keyCode<o.SPACE){t.keyCode===o.CTRL&&(v=!1);return}switch(t.keyCode){case o.UPARROW:case o.DOWNARROW:t.preventDefault();break;case o.ENTER:case o.TAB:case o.COMMA:if(t.keyCode!==o.COMMA||r.useCommaKey===!0){if(t.preventDefault(),r.expanded===!0&&(s=u.combobox.find(".ms-res-item-active:not(.ms-res-item-disabled):first"),s.length>0)){f._selectItem(s);return}c===!0&&r.allowFreeEntries===!0&&(h[r.displayField]=h[r.valueField]=i.trim(),u.addToSelection(h),u.collapse(),u.input.focus());break}default:e.length===r.maxSelection?f._updateHelper(r.maxSelectionRenderer.call(this,e.length)):i.length<r.minChars?(f._updateHelper(r.minCharsRenderer.call(this,r.minChars-i.length)),r.expanded===!0&&u.collapse()):r.maxEntryLength&&i.length>r.maxEntryLength?(f._updateHelper(r.maxEntryRenderer.call(this,i.length-r.maxEntryLength)),r.expanded===!0&&u.collapse()):(u.helper.hide(),r.minChars<=i.length&&(y=setTimeout(function(){r.expanded===!0?f._processSuggestions():u.expand()},r.typeDelay)))}},_onTagTriggerClick:function(t){u.removeFromSelection(n(t.currentTarget).data("json"))},_onTriggerClick:function(){if(u.isDisabled()===!1&&!(r.expandOnFocus===!0&&e.length===r.maxSelection))if(n(u).trigger("triggerclick",[u]),r.expanded===!0)u.collapse();else{var t=u.getRawValue().length;t>=r.minChars?(u.input.focus(),u.expand()):f._updateHelper(r.minCharsRenderer.call(this,r.minChars-t))}},_onWindowResized:function(){f._renderSelection()}};t!==null&&f._render(t)};n.fn.magicSuggest=function(i){var r=n(this);return r.size()===1&&r.data("magicSuggest")?r.data("magicSuggest"):(r.each(function(){var f=n(this),u,r;f.data("magicSuggest")||(this.nodeName.toLowerCase()==="select"&&(i.data=[],i.value=[],n.each(this.children,function(t,r){r.nodeName&&r.nodeName.toLowerCase()==="option"&&(i.data.push({id:r.value,name:r.text}),n(r).attr("selected")&&i.value.push(r.value))})),u={},n.each(this.attributes,function(n,t){u[t.name]=t.name==="value"&&t.value!==""?JSON.parse(t.value):t.value}),r=new t(this,n.extend([],n.fn.magicSuggest.defaults,i,u)),f.data("magicSuggest",r),r.container.data("magicSuggest",r))}),r.size()===1)?r.data("magicSuggest"):r};n.fn.magicSuggest.defaults={}}(jQuery);Array.prototype.clean=function(n){for(var t=0;t<this.length;t++)this[t]==n&&(this.splice(t,1),t--);return this};$(document).ready(function(){$("#map").on("onInitialized",function(n,t){function f(n,t){var u=n.getValue(),f=u.length,i="",r,e;if(f!==0)for(r=0;r<f;r++)e=u[r],i!==""&&(i=i+" || "),i=i+"($.properties."+t+" == '"+e+"')";return i}function l(n){var u=n.getValue(),f=u.length,t="",i,r;if(f!==0)for(i=0;i<f;i++)r=u[i],t=t!==""?t+"|"+r:r;return t}function i(n,t){return t!==""?n===""?"("+t+")":n+" && ("+t+")":n}function a(){var n=$("#project-budget-min").val(),t=$("#project-budget-max").val();return"($.properties.cost >= "+n+" && $.properties.cost <= "+t+")"}function v(){return"($.properties.recentlyAdded == true)"}function s(){var n="",r="";r=l(e,"municipalities");u!=null&&(n=i(n,f(u,"sector")));n=i(n,f(o,"stage"));$("#status-filter").length&&(n=i(n,f(h,"status")));$("#project-budget-slider").length&&(n=i(n,a()));$("#project-recently-added").is(":checked")&&(n=i(n,v()));t.UpdateMapData(n,r);t.RenderMap();$("#map").trigger("onFilterChange",t);$("#map").trigger("onUpdateProjectSearch",t)}function r(n,i,r){var u;i||(i=n);distinctValues=n==="stage"?Enumerable.From(t.geoJson).Where("$.properties."+n+" != ''").OrderBy("$.properties."+i).Select("$.properties."+n).Distinct().ToArray().clean(null):n==="municipalities"?Enumerable.From(t.geoJson).OrderBy("$.properties."+i).SelectMany("$.properties."+n).Distinct().ToArray():Enumerable.From(t.geoJson).OrderBy("$.properties."+i).Select("$.properties."+n).Distinct().ToArray();var e={sortDir:"desc",data:distinctValues,allowFreeEntries:!1,placeholder:"All"},o=$.extend({},e,r),f=$("#"+n+"-filter");if(f.length===0)return null;u=f.magicSuggest(o);$(u).on("selectionchange",function(){s()});return u}var e=r("municipalities"),u=r("sector","sector"),o=r("stage","stageSort"),h=r("status"),c={municipality:e,sector:u,stage:o};return t.AddMagicSuggestControls(c),$("#project-budget-slider-control").slider({range:!0,min:5,max:1020,step:5,values:[5,1020],slide:slider_onSlide,change:slider_onChange}),$("#filters :input").change(function(){$(this).attr("placeholder")||s()}),this})}),function(n){n.extend({tablesorter:new function(){function i(n,t){u(n+","+((new Date).getTime()-t.getTime())+"ms")}function u(n){typeof console!="undefined"&&typeof console.debug!="undefined"?console.log(n):alert(n)}function h(t,i){var o,e,r,f;if(t.config.debug&&(o=""),t.tBodies.length!=0){if(e=t.tBodies[0].rows,e[0]){var s=[],h=e[0].cells,l=h.length;for(r=0;r<l;r++)f=!1,n.metadata&&n(i[r]).metadata()&&n(i[r]).metadata().sorter?f=c(n(i[r]).metadata().sorter):t.config.headers[r]&&t.config.headers[r].sorter&&(f=c(t.config.headers[r].sorter)),f||(f=w(t,e,-1,r)),t.config.debug&&(o+="column:"+r+" parser:"+f.id+"\n"),s.push(f)}return t.config.debug&&u(o),s}}function w(n,i,r,f){for(var c=t.length,o=!1,s=!1,h=!0,e;s==""&&h;)r++,i[r]?(o=b(i,r,f),s=k(n.config,o),n.config.debug&&u("Checking if value was empty on row:"+r)):h=!1;for(e=1;e<c;e++)if(t[e].is(s,n,o))return t[e];return t[0]}function b(n,t,i){return n[t].cells[i]}function k(t,i){return n.trim(e(t,i))}function c(n){for(var r=t.length,i=0;i<r;i++)if(t[i].id.toLowerCase()==n.toLowerCase())return t[i];return!1}function l(t){var h,s,u,o,f;t.config.debug&&(h=new Date);var c=t.tBodies[0]&&t.tBodies[0].rows.length||0,l=t.tBodies[0].rows[0]&&t.tBodies[0].rows[0].cells.length||0,a=t.config.parsers,r={row:[],normalized:[]};for(s=0;s<c;++s){if(u=n(t.tBodies[0].rows[s]),o=[],u.hasClass(t.config.cssChildRow)){r.row[r.row.length-1]=r.row[r.row.length-1].add(u);continue}for(r.row.push(u),f=0;f<l;++f)o.push(a[f].format(e(t.config,u[0].cells[f]),t,u[0].cells[f]));o.push(r.normalized.length);r.normalized.push(o);o=null}return t.config.debug&&i("Building cache for "+c+" rows:",h),r}function e(t,i){return i?(t.supportsTextContent||(t.supportsTextContent=i.textContent||!1),t.textExtraction=="simple"?t.supportsTextContent?i.textContent:i.childNodes[0]&&i.childNodes[0].hasChildNodes()?i.childNodes[0].innerHTML:i.innerHTML:typeof t.textExtraction=="function"?t.textExtraction(i):n(i).text()):""}function o(t,r){var l,u,f,v,e;t.config.debug&&(l=new Date);var a=r,o=a.row,h=a.normalized,y=h.length,p=h[0].length-1,w=n(t.tBodies[0]),c=[];for(u=0;u<y;u++)if(f=h[u][p],c.push(o[f]),!t.config.appender)for(v=o[f].length,e=0;e<v;e++)w[0].appendChild(o[f][e]);t.config.appender&&t.config.appender(t,c);c=null;t.config.debug&&i("Rebuilt table:",l);s(t);setTimeout(function(){n(t).trigger("sortEnd")},0)}function d(t){var r,e,f;return t.config.debug&&(r=new Date),e=n.metadata?!0:!1,f=g(t),$tableHeaders=n(t.config.selectorHeaders,t).each(function(i){if(this.column=f[this.parentNode.rowIndex+"-"+this.cellIndex],this.order=rt(t.config.sortInitialOrder),this.count=this.order,(tt(this)||it(t,i))&&(this.sortDisabled=!0),a(t,i)&&(this.order=this.lockedOrder=a(t,i)),!this.sortDisabled){var r=n(this).addClass(t.config.cssHeader);t.config.onRenderHeader&&t.config.onRenderHeader.apply(r)}t.config.headerList[i]=this}),t.config.debug&&(i("Built headers:",r),u($tableHeaders)),$tableHeaders}function g(n){for(var h,u,t,a,o,i=[],c={},v=n.getElementsByTagName("THEAD")[0],l=v.getElementsByTagName("TR"),s=0;s<l.length;s++)for(h=l[s].cells,u=0;u<h.length;u++){var f=h[u],r=f.parentNode.rowIndex,y=r+"-"+f.cellIndex,p=f.rowSpan||1,w=f.colSpan||1,e;for(typeof i[r]=="undefined"&&(i[r]=[]),t=0;t<i[r].length+1;t++)if(typeof i[r][t]=="undefined"){e=t;break}for(c[y]=e,t=r;t<r+p;t++)for(typeof i[t]=="undefined"&&(i[t]=[]),a=i[t],o=e;o<e+w;o++)a[o]="x"}return c}function tt(t){return n.metadata&&n(t).metadata().sorter===!1?!0:!1}function it(n,t){return n.config.headers[t]&&n.config.headers[t].sorter===!1?!0:!1}function a(n,t){return n.config.headers[t]&&n.config.headers[t].lockedOrder?n.config.headers[t].lockedOrder:!1}function s(n){for(var i=n.config.widgets,r=i.length,t=0;t<r;t++)v(i[t]).format(n)}function v(n){for(var i=r.length,t=0;t<i;t++)if(r[t].id.toLowerCase()==n.toLowerCase())return r[t]}function rt(n){return typeof n!="Number"?n.toLowerCase()=="desc"?1:0:n==1?1:0}function ut(n,t){for(var r=t.length,i=0;i<r;i++)if(t[i][0]==n)return!0;return!1}function y(t,i,r,u){var e,o,f;for(i.removeClass(u[0]).removeClass(u[1]),e=[],i.each(function(){this.sortDisabled||(e[this.column]=n(this))}),o=r.length,f=0;f<o;f++)e[r[f][0]].addClass(u[r[f][1]])}function ft(t){var r=t.config,i;r.widthFixed&&(i=n("<colgroup>"),n("tr:first td",t.tBodies[0]).each(function(){i.append(n("<col>").css("width",n(this).width()))}),n(t).prepend(i))}function et(n,t){for(var r,u,f=n.config,e=t.length,i=0;i<e;i++)r=t[i],u=f.headerList[r[0]],u.count=r[1],u.count++}function p(table,sortList,cache){var sortTime,dynamicExp,l,orgOrderCol,i;for(table.config.debug&&(sortTime=new Date),dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length,i=0;i<l;i++){var c=sortList[i][0],order=sortList[i][1],s=table.config.parsers[c].type=="text"?order==0?f("text","asc",c):f("text","desc",c):order==0?f("numeric","asc",c):f("numeric","desc",c),e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { "}for(orgOrderCol=cache.normalized[0].length-1,dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];",i=0;i<l;i++)dynamicExp+="}; ";return dynamicExp+="return 0; ",dynamicExp+="}; ",table.config.debug&&i("Evaling expression:"+dynamicExp,new Date),eval(dynamicExp),cache.normalized.sort(sortWrapper),table.config.debug&&i("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime),cache}function f(n,t,i){var r="a["+i+"]",u="b["+i+"]";return n=="text"&&t=="asc"?"("+r+" == "+u+" ? 0 : ("+r+" === null ? Number.POSITIVE_INFINITY : ("+u+" === null ? Number.NEGATIVE_INFINITY : ("+r+" < "+u+") ? -1 : 1 )));":n=="text"&&t=="desc"?"("+r+" == "+u+" ? 0 : ("+r+" === null ? Number.POSITIVE_INFINITY : ("+u+" === null ? Number.NEGATIVE_INFINITY : ("+u+" < "+r+") ? -1 : 1 )));":n=="numeric"&&t=="asc"?"("+r+" === null && "+u+" === null) ? 0 :("+r+" === null ? Number.POSITIVE_INFINITY : ("+u+" === null ? Number.NEGATIVE_INFINITY : "+r+" - "+u+"));":n=="numeric"&&t=="desc"?"("+r+" === null && "+u+" === null) ? 0 :("+r+" === null ? Number.POSITIVE_INFINITY : ("+u+" === null ? Number.NEGATIVE_INFINITY : "+u+" - "+r+"));":void 0}var t=[],r=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:!0,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:!1,cancelSelection:!0,sortList:[],headerList:[],dateFormat:"us",decimal:"/.|,/g",onRenderHeader:null,selectorHeaders:"thead th",debug:!1};this.benchmark=i;this.construct=function(t){return this.each(function(){var r,u,f,i,a,c;this.tHead&&this.tBodies&&(a=0,this.config={},i=n.extend(this.config,n.tablesorter.defaults,t),r=n(this),n.data(this,"tablesorter",i),u=d(this),this.config.parsers=h(this,u),f=l(this),c=[i.cssDesc,i.cssAsc],ft(this),u.click(function(t){var v=r[0].tBodies[0]&&r[0].tBodies[0].rows.length||0,w,s,l,e,h,a;if(!this.sortDisabled&&v>0){if(r.trigger("sortStart"),w=n(this),s=this.column,this.order=this.count++%2,this.lockedOrder&&(this.order=this.lockedOrder),t[i.sortMultiSortKey])if(ut(s,i.sortList))for(e=0;e<i.sortList.length;e++)h=i.sortList[e],a=i.headerList[h[0]],h[0]==s&&(a.count=h[1],a.count++,h[1]=a.count%2);else i.sortList.push([s,this.order]);else{if(i.sortList=[],i.sortForce!=null)for(l=i.sortForce,e=0;e<l.length;e++)l[e][0]!=s&&i.sortList.push(l[e]);i.sortList.push([s,this.order])}return setTimeout(function(){y(r[0],u,i.sortList,c);o(r[0],p(r[0],i.sortList,f))},1),!1}}).mousedown(function(){if(i.cancelSelection)return this.onselectstart=function(){return!1},!1}),r.bind("update",function(){var n=this;setTimeout(function(){n.config.parsers=h(n,u);f=l(n)},1)}).bind("updateCell",function(n,t){var r=this.config,i=[t.parentNode.rowIndex-1,t.cellIndex];f.normalized[i[0]][i[1]]=r.parsers[i[1]].format(e(r,t),t)}).bind("sorton",function(t,r){n(this).trigger("sortStart");i.sortList=r;var e=i.sortList;et(this,e);y(this,u,e,c);o(this,p(this,e,f))}).bind("appendCache",function(){o(this,f)}).bind("applyWidgetId",function(n,t){v(t).format(this)}).bind("applyWidgets",function(){s(this)}),n.metadata&&n(this).metadata()&&n(this).metadata().sortlist&&(i.sortList=n(this).metadata().sortlist),i.sortList.length>0&&r.trigger("sorton",[i.sortList]),s(this))})};this.addParser=function(n){for(var u=t.length,r=!0,i=0;i<u;i++)t[i].id.toLowerCase()==n.id.toLowerCase()&&(r=!1);r&&t.push(n)};this.addWidget=function(n){r.push(n)};this.formatFloat=function(n){var t=parseFloat(n);return isNaN(t)?0:t};this.formatInt=function(n){var t=parseInt(n);return isNaN(t)?0:t};this.isDigit=function(t){return/^[-+]?\d*$/.test(n.trim(t.replace(/[,.']/g,"")))};this.clearTableBody=function(t){if(n.browser.msie){function i(){while(this.firstChild)this.removeChild(this.firstChild)}i.apply(t.tBodies[0])}else t.tBodies[0].innerHTML=""}}});n.fn.extend({tablesorter:n.tablesorter.construct});var t=n.tablesorter;t.addParser({id:"text",is:function(){return!0},format:function(n){return n},type:"text"});t.addParser({id:"digit",is:function(t,i){var r=i.config;return n.tablesorter.isDigit(t,r)},format:function(t){return n.tablesorter.formatFloat(t)},type:"numeric"});t.addParser({id:"currency",is:function(n){return/^[£$€?.]/.test(n)},format:function(t){return n.tablesorter.formatFloat(t.replace(new RegExp(/[£$€]/g),""))},type:"numeric"});t.addParser({id:"ipAddress",is:function(n){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(n)},format:function(t){for(var i,u=t.split("."),f="",e=u.length,r=0;r<e;r++)i=u[r],f+=i.length==2?"0"+i:i;return n.tablesorter.formatFloat(f)},type:"numeric"});t.addParser({id:"url",is:function(n){return/^(https?|ftp|file):\/\/$/.test(n)},format:function(n){return jQuery.trim(n.replace(new RegExp(/(https?|ftp|file):\/\//),""))},type:"text"});t.addParser({id:"isoDate",is:function(n){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(n)},format:function(t){return n.tablesorter.formatFloat(t!=""?new Date(t.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"});t.addParser({id:"percent",is:function(t){return/\%$/.test(n.trim(t))},format:function(t){return n.tablesorter.formatFloat(t.replace(new RegExp(/%/g),""))},type:"numeric"});t.addParser({id:"usLongDate",is:function(n){return n.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(t){return n.tablesorter.formatFloat(new Date(t).getTime())},type:"numeric"});t.addParser({id:"shortDate",is:function(n){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(n)},format:function(t,i){var r=i.config;return t=t.replace(/\-/g,"/"),r.dateFormat=="us"?t=t.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2"):r.dateFormat=="uk"?t=t.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1"):(r.dateFormat=="dd/mm/yy"||r.dateFormat=="dd-mm-yy")&&(t=t.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3")),n.tablesorter.formatFloat(new Date(t).getTime())},type:"numeric"});t.addParser({id:"time",is:function(n){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(n)},format:function(t){return n.tablesorter.formatFloat(new Date("2000/01/01 "+t).getTime())},type:"numeric"});t.addParser({id:"metadata",is:function(){return!1},format:function(t,i,r){var u=i.config,f=u.parserMetadataName?u.parserMetadataName:"sortValue";return n(r).metadata()[f]},type:"numeric"});t.addWidget({id:"zebra",format:function(t){var f,i,r,u;t.config.debug&&(f=new Date);r=-1;n("tr:visible",t.tBodies[0]).each(function(){i=n(this);i.hasClass(t.config.cssChildRow)||r++;u=r%2==0;i.removeClass(t.config.widgetZebra.css[u?0:1]).addClass(t.config.widgetZebra.css[u?1:0])});t.config.debug&&n.tablesorter.benchmark("Applying Zebra widget",f)}})}(jQuery);tableSorterInitialized=!1;$(document).ready(function(){function n(n){var i,t,r;$("#topLink").length>0&&$(document).scroll(function(){if($("#map-table-pill").hasClass("active"))if($(document).scrollTop()>250){var n=$(window).innerHeight()-160,t=Math.max(0,130+($(document).scrollTop()+$(window).innerHeight())-$(document).innerHeight());n-=t;$("#topLink").removeClass("hidden");$("#topLink").css({top:n+"px"})}else $("#topLink").addClass("hidden")});i="";n.filteredGeoJson.length>0&&$(n.filteredGeoJson).each(function(n,t){var r="/details/"+t.properties.friendlyName;i+=CreateRow(r,t)});$("#map-table").config!=null&&(t=$("#map-table")[0].config.sortList);$("#map-table tbody").html(i);tableSorterInitialized||($("table.tablesorter").each(function(){var n={};$(this).find("th.nosort").each(function(){n[$(this).index()]={sorter:!1}});$(this).tablesorter({headers:n})}),tableSorterInitialized=!0);$("#map-table").trigger("updateTable");$("#map-table").trigger("update");t==null&&(r=$('th:contains("Name")').index(),t=[[r,0]]);t.length>0&&setTimeout(function(){$("#map-table").trigger("sorton",[t]);$("#map-table").trigger("update",!1)},100);$(".tablesorter input[type='checkbox']").change(function(){checkIfGoShouldBeEnabled()})}$("#map").on("onInitialized",function(t,i){n(i)});$("#map").on("onFilterChange",function(t,i){n(i);var r=$("#map-table")[0].config.sortList,u=$("#map-table tbody tr").length;r.length>0&&u>0;$("#map-table").trigger("updateTable")})});$(document).ready(function(){function n(n){var t="",r="<div class='col-sm-6 col-md-4 legend-item' title='{0}' data-value='{0}'><span class='legend-item-color' style='background-color:{1};'>&nbsp;<\/span>{0}<\/div>",i;n.filteredGeoJson.length>0&&n.filteredGeoJson.length>0&&(i=Enumerable.From(n.filteredGeoJson).OrderBy("$.properties.sector").Distinct("$.properties.sector").Select(function(n){return{name:n.properties.sector,color:n.properties.color}}).ToArray(),t+="<div class='row'><div class='col-xs-12'><div class='row'>",$(i).each(function(n,i){t+=r.format(i.name,i.color)}),t+="<\/div><\/div><\/div>");$("#map-legend").html(t)}$("#map").on("onInitialized",function(t,i){n(i)});$("#map").on("onFilterChange",function(t,i){n(i)})});$(document).ready(function(){function t(t){var i=Enumerable.From(t.filteredGeoJson).OrderBy("$.properties.name").Select("{id:$.properties.friendlyName, name:$.properties.name, isMSI: $.properties.isMsi, assetUrl: $.properties.imageFilename}").ToArray();n=$($("#project-name").magicSuggest({data:i,allowFreeEntries:!1,hideTrigger:!0,maxSelection:1,noSuggestionText:"",placeholder:"Search Projects by Name"})).on("selectionchange",function(n,t,i){i.length!=0&&(window.showExtraColumns?location.href="/details/"+selected.id:window.open("/details/"+selected.id,"_blank"),this.clear())})}function i(n){var t=Enumerable.From(n.filteredGeoJson).OrderBy("$.properties.name").Select("{id:$.properties.friendlyName, name:$.properties.name}").ToArray();$("#project-name").magicSuggest().setData(t)}var n;$("#map").on("onInitializeProjectSearch",function(n,i){t(i)});$("#map").on("onUpdateProjectSearch",function(n,t){i(t)})});$(document).ready(function(){function u(n){var a=$.appSettings.ImagePath,e="",c,l,i,t,o,r,u,f,s,h;if(n.properties.imageFilename!=null&&n.properties.imageFilename.length>0&&(c=n.properties.imageFilename.split(";"),l="",e="<img class='responsive popup-image' src='"+n.properties.imageFilename+"'>"),i="",n.properties.municipalities!=null)for(t=0,o=n.properties.municipalities.length;t<o;t++)t===0?i=n.properties.municipalities[t]:i+=", "+n.properties.municipalities[t];return r="",n.properties.type!=null&&(r=n.properties.type),u="/details/"+n.properties.friendlyName,f="target='_blank'",window.showExtraColumns&&(f=""),s=formatBudgetDisplay(n.properties.cost),h="<a href='"+u+"' "+f+"><h1>"+n.properties.name+"<\/h1>"+e+"<\/a><table class='table table-condensed table-striped table-hover'><tbody><tr><td class='map-popup-label'>MUNICIPALITY:<\/td><td>"+i+"<\/td><\/tr><tr><td class='map-popup-label'>SECTOR:<\/td><td>"+n.properties.sector+"<\/td><\/tr>"+(r.length>0?"<tr><td class='map-popup-label'>TYPE:<\/td><td>"+n.properties.type+"<\/td><\/tr>":"")+"<tr><td class='map-popup-label'>ESTIMATED COST:<\/td><td>"+s+"<\/td><\/tr><tr><td class='map-popup-label'>SCHEDULE:<\/td><td>"+n.properties.schedule+"<\/td><\/tr><\/tbody><\/table><p><a class='btn' href='"+u+"' target='_blank'>More Details<\/a><\/p>",h}function f(n,t){if(n.properties)var i=u(n);t.bindPopup(i)}function e(n,t){var r="m",i=n.properties.cost,u;return i!=null&&(r=i<10?"s":i>=10&&i<=100?"m":"l"),u=L.MakiMarkers.icon({icon:null,color:n.properties.color,size:r}),L.marker(t,{icon:u})}function o(n){if(window.showExtraColumns){var t=Enumerable.From(n).Select("$=>$.properties").Where('$=>$.status=="Rejected"').ToArray();t.length>0&&$("#rejectedList").toggle(!0)}}var t="pk.eyJ1IjoiZWFld2VidGVhbSIsImEiOiJDRDZCM0dNIn0.F_vK4KbOx7aTmFtaHaGgwQ",i="eaewebteam.kp9gk5oi",r="eaewebteam.kpa5epio",n;$("body").addClass("loading");$("html").is("lt-ie9")||$.getScript("//platform.twitter.com/widgets.js");$("html").hasClass("lt-ie9")&&$("#twitter-timeline-div").html('<a href="https://twitter.com/abmajorprojects"><img src="/Content/img/twitter_majorprojects.png" alt="Follow @abmajorprojects"><\/a>');setTimeout(function(){$("#twitter-timeline-div iframe").width($("#project-map-twitter").width())},1e3);$.ajax({url:apiLocation,type:"GET",dataType:"json",success:function(u){var s,h;n=new GeoJsonStreetsAndSatelliteMap("map",u,{mapboxAccessToken:t,streetsTileLayerId:i,satelliteTileLayerId:r,onEachFeature:f,pointToLayer:e});$("body").removeClass("loading");s=Enumerable.From(u).Sum("parseFloat($.properties.cost)");$("#project-total-value").text(formatBudgetDisplay(s));n.Initialize().RenderMap().ResetMapView();h=Enumerable.From(u).OrderBy("$.properties.name").Select("{id:$.properties.friendlyName, name:$.properties.name}").ToArray();$($("#project-name").magicSuggest({data:h,allowFreeEntries:!1,hideTrigger:!0,maxSelection:1,noSuggestionText:"",placeholder:"Search Projects by Name"})).on("selectionchange",function(){var n=this.getValue();n&&n!=""&&(this.clear(),window.open("/details/"+n,"_blank"))});o(u);Modernizr.geolocation?($("#zoomToCurrentLocationLink").show(),$(".leaflet-control-fullscreen.leaflet-bar.leaflet-control").after("<div class='leaflet-control-location leaflet-bar leaflet-control'><a id='zoomToCurrentLocationLinkMapButton' class='fa fa-location-arrow' title='Use my current location' href='#'><\/a><\/div>"),$("#zoomToCurrentLocationLink,#zoomToCurrentLocationLinkMapButton").click(function(t){t.preventDefault();navigator.geolocation.getCurrentPosition(function(t){n.USE_MY_LOCATION=!0;n.zoom(t.coords.latitude,t.coords.longitude)})})):$("#zoomToCurrentLocationLink").hide()},error:function(){window.location="/error"}}).done(function(){function u(t){$("#project-map-section").removeClass("offscreen");$("#map-table-section").addClass("offscreen");$("#map-table-area").hide();n.ResetMapView();$("#map-table-pill").removeClass("active");$("#map-pill").addClass("active");t||(store(r,s),GenerateHash())}function c(n){$("#map-table-section").removeClass("offscreen");$("#project-map-section").addClass("offscreen");$("#map-table-area").show();$("#map-pill").removeClass("active");$("#map-table-pill").addClass("active");n||(store(r,h),GenerateHash())}function l(n){var t;if(n!=null){t=n.split("<\/a>")[0]+"<\/a>";t=t.split("<\/h1>")[0].replace("<h1>","");var i=n.split("<\/a>")[1],r=t.split("'")[1];$("#modal-title").html(t);$("#modal-body").html(i);$("#modal-footer").html("<button type='button' class='btn btn-default' data-dismiss='modal'>Close<\/button>")}else $("#modal-title").html("Not Available"),$("#modal-body").html("The details for this project are not available at this time.");$("#modal-project-details").modal("show")}var t=$("#map-table"),e={textExtraction:function(n){var i=$(n).text(),t=$(n).data("value");return t!=undefined?t:i}},a=t.find("tbody tr").length,i,o,f;$(window).resize(function(){setTimeout(function(){n.ResetMapView();$("#twitter-timeline-div iframe").width($("#project-map-twitter").width())},500)});i=$("#project-budget-slider-control").slider("values",0);o=$("#project-budget-slider-control").slider("values",1);$("#project-budget-slider").val(formatBudgetDisplay(i)+" - "+formatBudgetDisplay(o)+"+");$("#project-budget-min").val(i);$("#project-budget-max").val(999999);t.tablesorter(e).bind("sortStart",function(){var n=$("#map-table tbody tr").length});t.tablesorter(e).bind("sortEnd",function(){});var r="activeMapListTab",s="map",h="list";typeof ApplyRouting=="function"&&ApplyRouting(n.magicSuggestControls,n);f=store(r);f===h?c():f===s?u():u(!0);GenerateHash();$("#map-button,#map-pill").click(function(){u()});$("#map-table-button,#map-view-list,#map-table-pill").click(function(){c()});n.map.on("popupopen",function(n){$(window).width()<=1024&&(n.popup._close(),l(n.popup._content));var t=this.project(n.popup._latlng);t.y-=n.popup._container.clientHeight/2;this.panTo(this.unproject(t),{animate:!0})});$("#map").trigger("onInitializeProjectSearch",n);typeof bindListViewProjects=="function"&&bindListViewProjects()});$(document).delegate('*[data-toggle="lightbox"]',"click",function(n){n.preventDefault();$(this).ekkoLightbox()})}),function(){"use strict";var n,t;n=jQuery;t=function(t,i){var e,u,f,r=this;return this.options=n.extend({title:null,footer:null,remote:null},n.fn.ekkoLightbox.defaults,i||{}),this.$element=n(t),e="",this.modal_id=this.options.modal_id?this.options.modal_id:"ekkoLightbox-"+Math.floor(Math.random()*1e3+1),f='<div class="modal-header"'+(this.options.title||this.options.always_show_close?"":' style="display:none"')+'><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;<\/button><h4 class="modal-title">'+(this.options.title||"&nbsp;")+"<\/h4><\/div>",u='<div class="modal-footer"'+(this.options.footer?"":' style="display:none"')+">"+this.options.footer+"<\/div>",n(document.body).append('<div id="'+this.modal_id+'" class="ekko-lightbox modal fade" tabindex="-1"><div class="modal-dialog"><div class="modal-content">'+f+'<div class="modal-body"><div class="ekko-lightbox-container"><div><\/div><\/div><\/div>'+u+"<\/div><\/div><\/div>"),this.modal=n("#"+this.modal_id),this.modal_dialog=this.modal.find(".modal-dialog").first(),this.modal_content=this.modal.find(".modal-content").first(),this.modal_body=this.modal.find(".modal-body").first(),this.lightbox_container=this.modal_body.find(".ekko-lightbox-container").first(),this.lightbox_body=this.lightbox_container.find("> div:first-child").first(),this.showLoading(),this.modal_arrows=null,this.border={top:parseFloat(this.modal_dialog.css("border-top-width"))+parseFloat(this.modal_content.css("border-top-width"))+parseFloat(this.modal_body.css("border-top-width")),right:parseFloat(this.modal_dialog.css("border-right-width"))+parseFloat(this.modal_content.css("border-right-width"))+parseFloat(this.modal_body.css("border-right-width")),bottom:parseFloat(this.modal_dialog.css("border-bottom-width"))+parseFloat(this.modal_content.css("border-bottom-width"))+parseFloat(this.modal_body.css("border-bottom-width")),left:parseFloat(this.modal_dialog.css("border-left-width"))+parseFloat(this.modal_content.css("border-left-width"))+parseFloat(this.modal_body.css("border-left-width"))},this.padding={top:parseFloat(this.modal_dialog.css("padding-top"))+parseFloat(this.modal_content.css("padding-top"))+parseFloat(this.modal_body.css("padding-top")),right:parseFloat(this.modal_dialog.css("padding-right"))+parseFloat(this.modal_content.css("padding-right"))+parseFloat(this.modal_body.css("padding-right")),bottom:parseFloat(this.modal_dialog.css("padding-bottom"))+parseFloat(this.modal_content.css("padding-bottom"))+parseFloat(this.modal_body.css("padding-bottom")),left:parseFloat(this.modal_dialog.css("padding-left"))+parseFloat(this.modal_content.css("padding-left"))+parseFloat(this.modal_body.css("padding-left"))},this.modal.on("show.bs.modal",this.options.onShow.bind(this)).on("shown.bs.modal",function(){return r.modal_shown(),r.options.onShown.call(r)}).on("hide.bs.modal",this.options.onHide.bind(this)).on("hidden.bs.modal",function(){return r.gallery&&n(document).off("keydown.ekkoLightbox"),r.modal.remove(),r.options.onHidden.call(r)}).modal("show",i),this.modal};t.prototype={modal_shown:function(){var t,i=this;if(this.options.remote){if(this.gallery=this.$element.data("gallery"),this.gallery){this.gallery_items=this.options.gallery_parent_selector==="document.body"||this.options.gallery_parent_selector===""?n(document.body).find('*[data-toggle="lightbox"][data-gallery="'+this.gallery+'"]'):this.$element.parents(this.options.gallery_parent_selector).first().find('*[data-toggle="lightbox"][data-gallery="'+this.gallery+'"]');this.gallery_index=this.gallery_items.index(this.$element);n(document).on("keydown.ekkoLightbox",this.navigate.bind(this));if(this.options.directional_arrows&&this.gallery_items.length>1){this.lightbox_container.append('<div class="ekko-lightbox-nav-overlay"><a href="#" class="'+this.strip_stops(this.options.left_arrow_class)+'"><\/a><a href="#" class="'+this.strip_stops(this.options.right_arrow_class)+'"><\/a><\/div>');this.modal_arrows=this.lightbox_container.find("div.ekko-lightbox-nav-overlay").first();this.lightbox_container.find("a"+this.strip_spaces(this.options.left_arrow_class)).on("click",function(n){return n.preventDefault(),i.navigate_left()});this.lightbox_container.find("a"+this.strip_spaces(this.options.right_arrow_class)).on("click",function(n){return n.preventDefault(),i.navigate_right()})}}return this.options.type?this.options.type==="image"?this.preloadImage(this.options.remote,!0):this.options.type==="youtube"&&(t=this.getYoutubeId(this.options.remote))?this.showYoutubeVideo(t):this.options.type==="vimeo"?this.showVimeoVideo(this.options.remote):this.options.type==="instagram"?this.showInstagramVideo(this.options.remote):this.options.type==="url"?this.loadRemoteContent(this.options.remote):this.options.type==="video"?this.showVideoIframe(this.options.remote):this.error('Could not detect remote target type. Force the type using data-type="image|youtube|vimeo|instagram|url|video"'):this.detectRemoteType(this.options.remote)}return this.error("No remote target given")},strip_stops:function(n){return n.replace(/\./g,"")},strip_spaces:function(n){return n.replace(/\s/g,"")},isImage:function(n){return n.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSwf:function(n){return n.match(/\.(swf)((\?|#).*)?$/i)},getYoutubeId:function(n){var t;return t=n.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/),t&&t[2].length===11?t[2]:!1},getVimeoId:function(n){return n.indexOf("vimeo")>0?n:!1},getInstagramId:function(n){return n.indexOf("instagram")>0?n:!1},navigate:function(n){if(n=n||window.event,n.keyCode===39||n.keyCode===37){if(n.keyCode===39)return this.navigate_right();if(n.keyCode===37)return this.navigate_left()}},navigateTo:function(t){var r,i;return t<0||t>this.gallery_items.length-1?this:(this.showLoading(),this.gallery_index=t,this.$element=n(this.gallery_items.get(this.gallery_index)),this.updateTitleAndFooter(),i=this.$element.attr("data-remote")||this.$element.attr("href"),this.detectRemoteType(i,this.$element.attr("data-type")||!1),this.gallery_index+1<this.gallery_items.length&&(r=n(this.gallery_items.get(this.gallery_index+1),!1),i=r.attr("data-remote")||r.attr("href"),r.attr("data-type")==="image"||this.isImage(i))?this.preloadImage(i,!1):void 0)},navigate_left:function(){if(this.gallery_items.length!==1)return this.gallery_index===0?this.gallery_index=this.gallery_items.length-1:this.gallery_index--,this.options.onNavigate.call(this,"left",this.gallery_index),this.navigateTo(this.gallery_index)},navigate_right:function(){if(this.gallery_items.length!==1)return this.gallery_index===this.gallery_items.length-1?this.gallery_index=0:this.gallery_index++,this.options.onNavigate.call(this,"right",this.gallery_index),this.navigateTo(this.gallery_index)},detectRemoteType:function(n,t){var i;return t=t||!1,t==="image"||this.isImage(n)?(this.options.type="image",this.preloadImage(n,!0)):t==="youtube"||(i=this.getYoutubeId(n))?(this.options.type="youtube",this.showYoutubeVideo(i)):t==="vimeo"||(i=this.getVimeoId(n))?(this.options.type="vimeo",this.showVimeoVideo(i)):t==="instagram"||(i=this.getInstagramId(n))?(this.options.type="instagram",this.showInstagramVideo(i)):t==="video"?(this.options.type="video",this.showVideoIframe(i)):(this.options.type="url",this.loadRemoteContent(n))},updateTitleAndFooter:function(){var n,t,i,r;return i=this.modal_content.find(".modal-header"),t=this.modal_content.find(".modal-footer"),r=this.$element.data("title")||"",n=this.$element.data("footer")||"",r||this.options.always_show_close?i.css("display","").find(".modal-title").html(r||"&nbsp;"):i.css("display","none"),n?t.css("display","").html(n):t.css("display","none"),this},showLoading:function(){return this.lightbox_body.html('<div class="modal-loading">'+this.options.loadingMessage+"<\/div>"),this},showYoutubeVideo:function(n){var i,t;return t=this.checkDimensions(this.$element.data("width")||560),i=t/(560/315),this.showVideoIframe("//www.youtube.com/embed/"+n+"?badge=0&autoplay=1&html5=1",t,i)},showVimeoVideo:function(n){var i,t;return t=this.checkDimensions(this.$element.data("width")||560),i=t/(500/281),this.showVideoIframe(n+"?autoplay=1",t,i)},showInstagramVideo:function(n){var i,t;return t=this.checkDimensions(this.$element.data("width")||612),this.resize(t),i=t+80,this.lightbox_body.html('<iframe width="'+t+'" height="'+i+'" src="'+this.addTrailingSlash(n)+'embed/" frameborder="0" allowfullscreen><\/iframe>'),this.options.onContentLoaded.call(this),this.modal_arrows?this.modal_arrows.css("display","none"):void 0},showVideoIframe:function(n,t,i){return i=i||t,this.resize(t),this.lightbox_body.html('<div class="embed-responsive embed-responsive-16by9"><iframe width="'+t+'" height="'+i+'" src="'+n+'" frameborder="0" allowfullscreenclass="embed-responsive-item"><\/iframe><\/div>'),this.options.onContentLoaded.call(this),this.modal_arrows&&this.modal_arrows.css("display","none"),this},loadRemoteContent:function(t){var r,i,u=this;return i=this.$element.data("width")||560,this.resize(i),r=this.$element.data("disableExternalCheck")||!1,r||this.isExternal(t)?(this.lightbox_body.html('<iframe width="'+i+'" height="'+i+'" src="'+t+'" frameborder="0" allowfullscreen><\/iframe>'),this.options.onContentLoaded.call(this)):this.lightbox_body.load(t,n.proxy(function(){return u.$element.trigger("loaded.bs.modal")})),this.modal_arrows&&this.modal_arrows.css("display","none"),this},isExternal:function(n){var t;return(t=n.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/),typeof t[1]=="string"&&t[1].length>0&&t[1].toLowerCase()!==location.protocol)?!0:typeof t[2]=="string"&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host?!0:!1},error:function(n){return this.lightbox_body.html(n),this},preloadImage:function(t,i){var r,u=this;return r=new Image,(i==null||i===!0)&&(r.onload=function(){var t;return t=n("<img />"),t.attr("src",r.src),t.addClass("img-responsive"),u.lightbox_body.html(t),u.modal_arrows&&u.modal_arrows.css("display","block"),u.resize(r.width),u.options.onContentLoaded.call(u)},r.onerror=function(){return u.error("Failed to load image: "+t)}),r.src=t,r},resize:function(t){var i;return i=t+this.border.left+this.padding.left+this.padding.right+this.border.right,this.modal_dialog.css("width","auto").css("max-width",i),this.lightbox_container.find("a").css("line-height",function(){return n(this).parent().height()+"px"}),this},checkDimensions:function(n){var t,i;return i=n+this.border.left+this.padding.left+this.padding.right+this.border.right,t=document.body.clientWidth,i>t&&(n=this.modal_body.width()),n},close:function(){return this.modal.modal("hide")},addTrailingSlash:function(n){return n.substr(-1)!=="/"&&(n+="/"),n}};n.fn.ekkoLightbox=function(i){return this.each(function(){var r;return r=n(this),i=n.extend({remote:r.attr("data-remote")||r.attr("href"),gallery_parent_selector:r.attr("data-parent"),type:r.attr("data-type")},i,r.data()),new t(this,i),this})};n.fn.ekkoLightbox.defaults={gallery_parent_selector:"document.body",left_arrow_class:".glyphicon .glyphicon-chevron-left",right_arrow_class:".glyphicon .glyphicon-chevron-right",directional_arrows:!0,type:null,always_show_close:!0,loadingMessage:"Loading...",onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNavigate:function(){},onContentLoaded:function(){}}}.call(this)