function reloadCharts(){return-1===navigator.userAgent.toLowerCase().indexOf("firefox")?!1:($('.ui-widget-content [aria-expanded="false"]').find("iframe").each(function(){var e=$(this).attr("src");-1!==e.indexOf("charts")&&($(this).hide(),$(this).attr("src",e),$(this).show())}),void 0)}function openDialogCenter(e){e.dialog("open");var t=getDimensions(e.parent());e.dialog({position:[t[0],t[1]]})}function getDimensions(e){var t=new Array(2);return t[0]=$(window).width()/2-e.width()/2,t[1]=$(window).height()/2-e.height()/2,t}function updateChart(e,t,n,r,a,i){var n=n,r=r,o=$("#iframe"+e).attr("default_src");o||(o=$("#iframe"+e).attr("src")),src=o.split("?")[0],("bar"===$("#type_"+e).val()||"column"===$("#type_"+e).val())&&0==$("#timescale_"+e).val().length&&0==$("#average_"+e).val().length&&0==$("#median_"+e).val().length&&0==$("#sum_"+e).val().length&&$("#timescale_"+e).val(30);var s=[];$(".chart_options"+e).each(function(){var e=$(this).val(),t=$(this).attr("id"),n=t.split("_")[0];e.length>0&&s.push([n,e])});for(var l="";s.length>0;){var c=s.pop();"width"==c[0]&&(n=parseInt(c[1])),"height"==c[0]&&(r=parseInt(c[1])),("type"!=c[0]||"line"!=c[1])&&(l+="&"+c[0]+"="+encodeURIComponent(c[1]))}l.length>0&&(src+="?"+l.substring(1)),t&&e>0&&i?$.update("/channels/"+a+"/charts/"+e,{newOptions:{options:l}}):t&&e>0&&$.update("/channels/"+a+"/charts/"+e,{options:l}),$("#embed"+e).val(''),$("#iframe"+e).attr("src",src),$("#iframe"+e).attr("width",n),$("#iframe"+e).attr("height",r)}function updateSelectValues(){selectedValue=$(this).val(),$(".mutuallyexclusive"+index).each(function(){$(this).val("")}),$(this).val(selectedValue)}function setupChartForm(e){return function(t,n){n.length>0&&$("#"+n.split("=")[0]+"_"+e).val(decodeURIComponent(n.split("=")[1]))}}function setupColumns(e,t){$(sortColumnSetup(e,t)),$(".column").disableSelection()}function createWindowsWithData(e,t,n,r){for(var a in e){for(var i in e[a])var o=i;if(e[a].chart_window&&(s=e[a].chart_window),e[a].plugin_window&&(s=e[a].plugin_window),e[a].portlet_window&&(s=e[a].portlet_window),"undefined"==s)var s=e[a].portlet_window?e[a].portlet_window:e[a].chart_window;colId=s.col,title=s.title;var l=s.html;if(e[a].chart_window){var c=s.id;$("body").append("
")}var d=addWindow(r,colId,s.id,o,title,l);d.each(decoratePortlet(t)),d.find(".ui-toggle").click(uiToggleClick),d.find(".ui-view").click(uiViewClick(n)),d.find(".ui-edit").click(uiEditClick(n)),d.find(".ui-close").click(uiCloseClick(n))}}function addWindow(e,t,n,r,a,i){if($("#"+e+"_dialog"+t).append('
'+a+'
'+i+"
"),$("#portlet_"+n).length>1)throw"Portlet count doesn't match what's expected";return $("#portlet_"+n)}function sortColumnSetup(e,t){$(".column").sortable({opacity:.6,helper:function(){return $("
Drop to re-position
")},connectWith:".column",update:updatePortletPositions(e,t)})}function getPortletArray(e){var t=new Array,n=e.split("&");for(i in n)val=n[i].split("=")[1],t.push(val);return t}function uiToggleClick(){$(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"),$(this).parents(".portlet:first").find(".portlet-content").toggle()}!function(e,t){e.rails!==t&&e.error("jquery-ujs has already been loaded!");var n,r=e(document);e.rails=n={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",buttonClickSelector:"button[data-remote]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input[type=file]",linkDisableSelector:"a[data-disable-with]",CSRFProtection:function(t){var n=e('meta[name="csrf-token"]').attr("content");n&&t.setRequestHeader("X-CSRF-Token",n)},fire:function(t,n,r){var a=e.Event(n);return t.trigger(a,r),a.result!==!1},confirm:function(e){return confirm(e)},ajax:function(t){return e.ajax(t)},href:function(e){return e.attr("href")},handleRemote:function(r){var a,i,o,s,l,c,d,u;if(n.fire(r,"ajax:before")){if(s=r.data("cross-domain"),l=s===t?null:s,c=r.data("with-credentials")||null,d=r.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType,r.is("form")){a=r.attr("method"),i=r.attr("action"),o=r.serializeArray();var h=r.data("ujs:submit-button");h&&(o.push(h),r.data("ujs:submit-button",null))}else r.is(n.inputChangeSelector)?(a=r.data("method"),i=r.data("url"),o=r.serialize(),r.data("params")&&(o=o+"&"+r.data("params"))):r.is(n.buttonClickSelector)?(a=r.data("method")||"get",i=r.data("url"),o=r.serialize(),r.data("params")&&(o=o+"&"+r.data("params"))):(a=r.data("method"),i=n.href(r),o=r.data("params")||null);u={type:a||"GET",data:o,dataType:d,beforeSend:function(e,a){return a.dataType===t&&e.setRequestHeader("accept","*/*;q=0.5, "+a.accepts.script),n.fire(r,"ajax:beforeSend",[e,a])},success:function(e,t,n){r.trigger("ajax:success",[e,t,n])},complete:function(e,t){r.trigger("ajax:complete",[e,t])},error:function(e,t,n){r.trigger("ajax:error",[e,t,n])},crossDomain:l},c&&(u.xhrFields={withCredentials:c}),i&&(u.url=i);var f=n.ajax(u);return r.trigger("ajax:send",f),f}return!1},handleMethod:function(r){var a=n.href(r),i=r.data("method"),o=r.attr("target"),s=e("meta[name=csrf-token]").attr("content"),l=e("meta[name=csrf-param]").attr("content"),c=e('
'),d='';l!==t&&s!==t&&(d+=''),o&&c.attr("target",o),c.hide().append(d).appendTo("body"),c.submit()},disableFormElements:function(t){t.find(n.disableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with",t[n]()),t[n](t.data("disable-with")),t.prop("disabled",!0)})},enableFormElements:function(t){t.find(n.enableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with")&&t[n](t.data("ujs:enable-with")),t.prop("disabled",!1)})},allowAction:function(e){var t,r=e.data("confirm"),a=!1;return r?(n.fire(e,"confirm")&&(a=n.confirm(r),t=n.fire(e,"confirm:complete",[a])),a&&t):!0},blankInputs:function(t,n,r){var a,i,o=e(),s=n||"input,textarea",l=t.find(s);return l.each(function(){if(a=e(this),i=a.is("input[type=checkbox],input[type=radio]")?a.is(":checked"):a.val(),!i==!r){if(a.is("input[type=radio]")&&l.filter('input[type=radio]:checked[name="'+a.attr("name")+'"]').length)return!0;o=o.add(a)}}),o.length?o:!1},nonBlankInputs:function(e,t){return n.blankInputs(e,t,!0)},stopEverything:function(t){return e(t.target).trigger("ujs:everythingStopped"),t.stopImmediatePropagation(),!1},disableElement:function(e){e.data("ujs:enable-with",e.html()),e.html(e.data("disable-with")),e.bind("click.railsDisable",function(e){return n.stopEverything(e)})},enableElement:function(e){e.data("ujs:enable-with")!==t&&(e.html(e.data("ujs:enable-with")),e.removeData("ujs:enable-with")),e.unbind("click.railsDisable")}},n.fire(r,"rails:attachBindings")&&(e.ajaxPrefilter(function(e,t,r){e.crossDomain||n.CSRFProtection(r)}),r.delegate(n.linkDisableSelector,"ajax:complete",function(){n.enableElement(e(this))}),r.delegate(n.linkClickSelector,"click.rails",function(r){var a=e(this),i=a.data("method"),o=a.data("params");if(!n.allowAction(a))return n.stopEverything(r);if(a.is(n.linkDisableSelector)&&n.disableElement(a),a.data("remote")!==t){if(!(!r.metaKey&&!r.ctrlKey||i&&"GET"!==i||o))return!0;var s=n.handleRemote(a);return s===!1?n.enableElement(a):s.error(function(){n.enableElement(a)}),!1}return a.data("method")?(n.handleMethod(a),!1):void 0}),r.delegate(n.buttonClickSelector,"click.rails",function(t){var r=e(this);return n.allowAction(r)?(n.handleRemote(r),!1):n.stopEverything(t)}),r.delegate(n.inputChangeSelector,"change.rails",function(t){var r=e(this);return n.allowAction(r)?(n.handleRemote(r),!1):n.stopEverything(t)}),r.delegate(n.formSubmitSelector,"submit.rails",function(r){var a=e(this),i=a.data("remote")!==t,o=n.blankInputs(a,n.requiredInputSelector),s=n.nonBlankInputs(a,n.fileInputSelector);if(!n.allowAction(a))return n.stopEverything(r);if(o&&a.attr("novalidate")==t&&n.fire(a,"ajax:aborted:required",[o]))return n.stopEverything(r);if(i){if(s){setTimeout(function(){n.disableFormElements(a)},13);var l=n.fire(a,"ajax:aborted:file",[s]);return l||setTimeout(function(){n.enableFormElements(a)},13),l}return n.handleRemote(a),!1}setTimeout(function(){n.disableFormElements(a)},13)}),r.delegate(n.formInputClickSelector,"click.rails",function(t){var r=e(this);if(!n.allowAction(r))return n.stopEverything(t);var a=r.attr("name"),i=a?{name:a,value:r.val()}:null;r.closest("form").data("ujs:submit-button",i)}),r.delegate(n.formSubmitSelector,"ajax:beforeSend.rails",function(t){this==t.target&&n.disableFormElements(e(this))}),r.delegate(n.formSubmitSelector,"ajax:complete.rails",function(t){this==t.target&&n.enableFormElements(e(this))}),e(function(){var t=e("meta[name=csrf-token]").attr("content"),n=e("meta[name=csrf-param]").attr("content");e('form input[name="'+n+'"]').val(t)}))}(jQuery),function(e){e.cookie=function(t,n,r){if(arguments.length>1&&(!/Object/.test(Object.prototype.toString.call(n))||null===n||void 0===n)){if(r=e.extend({},r),(null===n||void 0===n)&&(r.expires=-1),"number"==typeof r.expires){var a=r.expires,i=r.expires=new Date;i.setDate(i.getDate()+a)}return n=String(n),document.cookie=[encodeURIComponent(t),"=",r.raw?n:encodeURIComponent(n),r.expires?"; expires="+r.expires.toUTCString():"",r.path?"; path="+r.path:"",r.domain?"; domain="+r.domain:"",r.secure?"; secure":""].join("")}r=n||{};for(var o,s=r.raw?function(e){return e}:decodeURIComponent,l=document.cookie.split("; "),c=0;o=l[c]&&l[c].split("=");c++)if(s(o[0])===t)return s(o[1]||"");return null}}(jQuery),function(){var e=Highcharts,t=e.Chart,n=e.addEvent,r=e.createElement,a=e.discardElement,i=e.css,o=e.merge,s=e.each,l=e.extend,c=Math.max,d=document,u=window,h="ontouchstart"in d.documentElement,f=e.setOptions({lang:{downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",exportButtonTitle:"Export to raster or vector image",printButtonTitle:"Print the chart"}});f.navigation={menuStyle:{border:"1px solid #A0A0A0",background:"#FFFFFF"},menuItemStyle:{padding:"0 5px",background:"none",color:"#303030",fontSize:h?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{align:"right",backgroundColor:{linearGradient:[0,0,0,20],stops:[[.4,"#F7F7F7"],[.6,"#E3E3E3"]]},borderColor:"#B0B0B0",borderRadius:3,borderWidth:1,height:20,hoverBorderColor:"#909090",hoverSymbolFill:"#81A7CF",hoverSymbolStroke:"#4572A5",symbolFill:"#E0E0E0",symbolStroke:"#A0A0A0",symbolX:11.5,symbolY:10.5,verticalAlign:"top",width:24,y:10}},f.exporting={type:"image/png",url:"http://export.highcharts.com/",width:800,buttons:{exportButton:{symbol:"exportIcon",x:-10,symbolFill:"#A8BF77",hoverSymbolFill:"#768F3E",_titleKey:"exportButtonTitle",menuItems:[{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}]},printButton:{symbol:"printIcon",x:-36,symbolFill:"#B5C9DF",hoverSymbolFill:"#779ABF",_titleKey:"printButtonTitle",onclick:function(){this.print()}}}},l(t.prototype,{getSVG:function(e){var t,n,i,c,u,h,f=this,p=o(f.options,e);return d.createElementNS||(d.createElementNS=function(e,t){var n=d.createElement(t);return n.getBBox=function(){return f.renderer.Element.prototype.getBBox.apply({element:n})},n}),t=r("div",null,{position:"absolute",top:"-9999em",width:f.chartWidth+"px",height:f.chartHeight+"px"},d.body),l(p.chart,{renderTo:t,forExport:!0}),p.exporting.enabled=!1,p.chart.plotBackgroundImage=null,p.series=[],s(f.series,function(e){i=e.options,i.animation=!1,i.showCheckbox=!1,i&&i.marker&&/^url\(/.test(i.marker.symbol)&&(i.marker.symbol="circle"),i.data=[],s(e.data,function(e){c=e.config,u={x:e.x,y:e.y,name:e.name},"object"==typeof c&&e.config&&c.constructor!=Array&&l(u,c),i.data.push(u),(h=e.config&&e.config.marker)&&/^url\(/.test(h.symbol)&&delete h.symbol}),p.series.push(i)}),e=new Highcharts.Chart(p),n=e.container.innerHTML,p=null,e.destroy(),a(t),n=n.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/isTracker="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/id=([^" >]+)/g,'id="$1"').replace(/class=([^" ]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,"$1").replace(/style="([^"]+)"/g,function(e){return e.toLowerCase()}),n=n.replace(/(url\(#highcharts-[0-9]+)"/g,"$1").replace(/"/g,"'"),2==n.match(/ xmlns="/g).length&&(n=n.replace(/xmlns="[^"]+"/,"")),n},exportChart:function(e,t){var n,i=this.getSVG(t);e=o(this.options.exporting,e),n=r("form",{method:"post",action:e.url},{display:"none"},d.body),s(["filename","type","width","svg"],function(t){r("input",{type:"hidden",name:t,value:{filename:e.filename||"chart",type:e.type,width:e.width,svg:i}[t]},null,n)}),n.submit(),a(n)},print:function(){var e=this,t=e.container,n=[],r=t.parentNode,a=d.body,i=a.childNodes;e.isPrinting||(e.isPrinting=!0,s(i,function(e,t){1==e.nodeType&&(n[t]=e.style.display,e.style.display="none")}),a.appendChild(t),u.print(),setTimeout(function(){r.appendChild(t),s(i,function(e,t){1==e.nodeType&&(e.style.display=n[t])}),e.isPrinting=!1},1e3))},contextMenu:function(t,a,o,d,u,f){var p,m,g=this,b=g.options.navigation,v=b.menuItemStyle,y=g.chartWidth,w=g.chartHeight,x="cache-"+t,S=g[x],$=c(u,f);S||(g[x]=S=r("div",{className:"highcharts-"+t},{position:"absolute",zIndex:1e3,padding:$+"px"},g.container),p=r("div",null,l({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},b.menuStyle),S),m=function(){i(S,{display:"none"})},n(S,"mouseleave",m),s(a,function(t){t&&(r("div",{onmouseover:function(){i(this,b.menuItemHoverStyle)},onmouseout:function(){i(this,v)},innerHTML:t.text||e.getOptions().lang[t.textKey]},l({cursor:"pointer"},v),p)[h?"ontouchstart":"onclick"]=function(){m(),t.onclick.apply(g,arguments)})}),g.exportMenuWidth=S.offsetWidth,g.exportMenuHeight=S.offsetHeight),t={display:"block"},o+g.exportMenuWidth>y?t.right=y-o-u-$+"px":t.left=o-$+"px",d+f+g.exportMenuHeight>w?t.bottom=w-d-$+"px":t.top=d+f-$+"px",i(S,t)},addButton:function(t){function n(){a.attr(g),r.attr(m)}var r,a,i,s=this,c=s.renderer,d=o(s.options.navigation.buttonOptions,t),u=d.onclick,h=d.menuItems,f=d.width,p=d.height;t=d.borderWidth;var m={stroke:d.borderColor},g={stroke:d.symbolStroke,fill:d.symbolFill};d.enabled!==!1&&(r=c.rect(0,0,f,p,d.borderRadius,t).align(d,!0).attr(l({fill:d.backgroundColor,"stroke-width":t,zIndex:19},m)).add(),i=c.rect(0,0,f,p,0).align(d).attr({fill:"rgba(255, 255, 255, 0.001)",title:e.getOptions().lang[d._titleKey],zIndex:21}).css({cursor:"pointer"}).on("mouseover",function(){a.attr({stroke:d.hoverSymbolStroke,fill:d.hoverSymbolFill}),r.attr({stroke:d.hoverBorderColor})}).on("mouseout",n).on("click",n).add(),h&&(u=function(){n();var e=i.getBBox();s.contextMenu("export-menu",h,e.x,e.y,f,p)}),i.on("click",function(){u.apply(s,arguments)}),a=c.symbol(d.symbol,d.symbolX,d.symbolY,(d.symbolSize||12)/2).align(d,!0).attr(l(g,{"stroke-width":d.symbolStrokeWidth||1,zIndex:20})).add())}}),e.Renderer.prototype.symbols.exportIcon=function(e,t,n){return["M",e-n,t+n,"L",e+n,t+n,e+n,t+.5*n,e-n,t+.5*n,"Z","M",e,t+.5*n,"L",e-.5*n,t-n/3,e-n/6,t-n/3,e-n/6,t-n,e+n/6,t-n,e+n/6,t-n/3,e+.5*n,t-n/3,"Z"]},e.Renderer.prototype.symbols.printIcon=function(e,t,n){return["M",e-n,t+.5*n,"L",e+n,t+.5*n,e+n,t-n/3,e-n,t-n/3,"Z","M",e-.5*n,t-n/3,"L",e-.5*n,t-n,e+.5*n,t-n,e+.5*n,t-n/3,"Z","M",e-.5*n,t+.5*n,"L",e-.75*n,t+n,e+.75*n,t+n,e+.5*n,t+.5*n,"Z"]},t.prototype.callbacks.push(function(e){var t,n=e.options.exporting,r=n.buttons;if(n.enabled!==!1)for(t in r)e.addButton(r[t])})}();var createWindows=function(e,t,n){return function(r){createWindowsWithData(r,e,t,n)}},updatePortletPositions=function(e,t){return function(){if(e){var n=$(this).sortable("serialize");colId=$(this).attr("id").charAt($(this).attr("id").length-1),portletArray=getPortletArray(n),jsonResult={col:colId,positions:portletArray},portletArray.length>0&&$.ajax({type:"PUT",url:"../channels/"+t+"/windows",data:{_method:"PUT",page:JSON.stringify(jsonResult)},dataType:"json"})}}},decoratePortlet=function(e){return function(){var t=$(this).find(".portlet-header");return t.append(""),thisObject=$(this),"true"==e?(thisObject.find(".wtype").prepend(""),thisObject.find(".wtype-chart_window").append(""),thisObject.find(".wtype").append(""),thisObject.find(".portlet-header").css("cursor","move")):$(".column").sortable({disabled:!0}),$(this).attr("id")}},uiEditClick=function(e){return function(){var t=$(this).parents(".portlet:first").attr("id").substring(8),n="";$("#chartConfig"+t).load("/channels/"+e+"/charts/"+t+"/edit",function(){n=$("#chartOptions"+t).html(),"undefined"!=n&&n.length>2&&$.each(n.split("&"),setupChartForm(t)),$("#button"+t).click(function(){updateChart(t,!0,450,250,e,!0),$("#chartConfig"+t).dialog("close")})}).dialog({title:"Chart Options",modal:!0,resizable:!1,width:500,dialogClass:"dev-info-dialog"})}},uiViewClick=function(e){return function(){var t=$(this).parents(".portlet:first").find(".portlet-content").offset().left,n=$(this).parents(".portlet:first").find(".portlet-content").offset().top,r=$(this).parents(".portlet:first").attr("id").substring(8);$("body").append(''),$.get("/channels/"+e+"/windows/"+r+"/iframe",function(e){var t=e.replace(/id=\"iframe[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?\"/,"");$("#iframeinner"+r).text(t)}),$("#iframepopup"+r).dialog({resizable:!1,width:"300px",position:[t+200,n-200],title:"Chart Iframe",dialogClass:"dev-info-dialog"})}},uiCloseClick=function(e){return function(){var t=$(this).parents(".portlet:first").attr("id").substring(8),n=$(this).parents(".portlet:first");$.update("/channels/"+e+"/windows/"+t+"/hide",function(){n.hide("drop",function(){n.remove()})})}};!function(e){function t(){var t=n(this);return isNaN(t.datetime)||e(this).text(r(t.datetime)),this}function n(t){if(t=e(t),!t.data("timeago")){t.data("timeago",{datetime:i.datetime(t)});var n=e.trim(t.text());n.length>0&&t.attr("title",n)}return t.data("timeago")}function r(e){return i.inWords(a(e))}function a(e){return(new Date).getTime()-e.getTime()}e.timeago=function(t){return t instanceof Date?r(t):"string"==typeof t?r(e.timeago.parse(t)):r(e.timeago.datetime(t))};var i=e.timeago;e.extend(e.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",numbers:[]}},inWords:function(t){function n(n,a){var i=e.isFunction(n)?n(a,t):n,o=r.numbers&&r.numbers[a]||a;return i.replace(/%d/i,o)}var r=this.settings.strings,a=r.prefixAgo,i=r.suffixAgo;this.settings.allowFuture&&(0>t&&(a=r.prefixFromNow,i=r.suffixFromNow),t=Math.abs(t));var o=t/1e3,s=o/60,l=s/60,c=l/24,d=c/365,u=45>o&&n(r.seconds,Math.round(o))||90>o&&n(r.minute,1)||45>s&&n(r.minutes,Math.round(s))||90>s&&n(r.hour,1)||24>l&&n(r.hours,Math.round(l))||48>l&&n(r.day,1)||30>c&&n(r.days,Math.floor(c))||60>c&&n(r.month,1)||365>c&&n(r.months,Math.floor(c/30))||2>d&&n(r.year,1)||n(r.years,Math.floor(d));return e.trim([a,u,i].join(" "))},parse:function(t){var n=e.trim(t);return n=n.replace(/\.\d\d\d+/,""),n=n.replace(/-/,"/").replace(/-/,"/"),n=n.replace(/T/," ").replace(/Z/," UTC"),n=n.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(n)},datetime:function(t){var n="time"===e(t).get(0).tagName.toLowerCase(),r=n?e(t).attr("datetime"):e(t).attr("title");return i.parse(r)}}),e.fn.timeago=function(){var e=this;e.each(t);var n=i.settings;return n.refreshMillis>0&&setInterval(function(){e.each(t)},n.refreshMillis),e},document.createElement("abbr"),document.createElement("time")}(jQuery),function($){$.extend({tablesorter:new function(){function benchmark(e,t){log(e+","+((new Date).getTime()-t.getTime())+"ms")}function log(e){"undefined"!=typeof console&&"undefined"!=typeof console.debug?console.log(e):alert(e)}function buildParserCache(e,t){if(e.config.debug)var n="";if(0!=e.tBodies.length){var r=e.tBodies[0].rows;if(r[0])for(var a=[],i=r[0].cells,o=i.length,s=0;o>s;s++){var l=!1;$.metadata&&$(t[s]).metadata()&&$(t[s]).metadata().sorter?l=getParserById($(t[s]).metadata().sorter):e.config.headers[s]&&e.config.headers[s].sorter&&(l=getParserById(e.config.headers[s].sorter)),l||(l=detectParserForColumn(e,r,-1,s)),e.config.debug&&(n+="column:"+s+" parser:"+l.id+"\n"),a.push(l)}return e.config.debug&&log(n),a}}function detectParserForColumn(e,t,n,r){for(var a=parsers.length,i=!1,o=!1,s=!0;""==o&&s;)n++,t[n]?(i=getNodeFromRowAndCellIndex(t,n,r),o=trimAndGetNodeText(e.config,i),e.config.debug&&log("Checking if value was empty on row:"+n)):s=!1;for(var l=1;a>l;l++)if(parsers[l].is(o,e,i))return parsers[l];return parsers[0]}function getNodeFromRowAndCellIndex(e,t,n){return e[t].cells[n]}function trimAndGetNodeText(e,t){return $.trim(getElementText(e,t))}function getParserById(e){for(var t=parsers.length,n=0;t>n;n++)if(parsers[n].id.toLowerCase()==e.toLowerCase())return parsers[n];return!1}function buildCache(e){if(e.config.debug)var t=new Date;for(var n=e.tBodies[0]&&e.tBodies[0].rows.length||0,r=e.tBodies[0].rows[0]&&e.tBodies[0].rows[0].cells.length||0,a=e.config.parsers,i={row:[],normalized:[]},o=0;n>o;++o){var s=$(e.tBodies[0].rows[o]),l=[];if(s.hasClass(e.config.cssChildRow))i.row[i.row.length-1]=i.row[i.row.length-1].add(s);else{i.row.push(s);for(var c=0;r>c;++c)l.push(a[c].format(getElementText(e.config,s[0].cells[c]),e,s[0].cells[c]));l.push(i.normalized.length),i.normalized.push(l),l=null}}return e.config.debug&&benchmark("Building cache for "+n+" rows:",t),i}function getElementText(e,t){var n="";return t?(e.supportsTextContent||(e.supportsTextContent=t.textContent||!1),n="simple"==e.textExtraction?e.supportsTextContent?t.textContent:t.childNodes[0]&&t.childNodes[0].hasChildNodes()?t.childNodes[0].innerHTML:t.innerHTML:"function"==typeof e.textExtraction?e.textExtraction(t):$(t).text()):""}function appendToTable(e,t){if(e.config.debug)var n=new Date;for(var r=t,a=r.row,i=r.normalized,o=i.length,s=i[0].length-1,l=$(e.tBodies[0]),c=[],d=0;o>d;d++){var u=i[d][s];if(c.push(a[u]),!e.config.appender)for(var h=a[u].length,f=0;h>f;f++)l[0].appendChild(a[u][f])}e.config.appender&&e.config.appender(e,c),c=null,e.config.debug&&benchmark("Rebuilt table:",n),applyWidget(e),setTimeout(function(){$(e).trigger("sortEnd")},0)}function buildHeaders(e){if(e.config.debug)var t=new Date;var n=($.metadata?!0:!1,computeTableHeaderCellIndexes(e));return $tableHeaders=$(e.config.selectorHeaders,e).each(function(t){if(this.column=n[this.parentNode.rowIndex+"-"+this.cellIndex],this.order=formatSortingOrder(e.config.sortInitialOrder),this.count=this.order,(checkHeaderMetadata(this)||checkHeaderOptions(e,t))&&(this.sortDisabled=!0),checkHeaderOptionsSortingLocked(e,t)&&(this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(e,t)),!this.sortDisabled){var r=$(this).addClass(e.config.cssHeader);e.config.onRenderHeader&&e.config.onRenderHeader.apply(r)}e.config.headerList[t]=this}),e.config.debug&&(benchmark("Built headers:",t),log($tableHeaders)),$tableHeaders}function computeTableHeaderCellIndexes(e){for(var t=[],n={},r=e.getElementsByTagName("THEAD")[0],a=r.getElementsByTagName("TR"),i=0;ip;p++){"undefined"==typeof t[p]&&(t[p]=[]);for(var m=t[p],g=l;l+f>g;g++)m[g]="x"}}return n}function checkCellColSpan(e,t,n){for(var r=[],a=e.tHead.rows,i=a[n].cells,o=0;o1?r=r.concat(checkCellColSpan(e,headerArr,n++)):(1==e.tHead.length||s.rowSpan>1||!a[n+1])&&r.push(s)}return r}function checkHeaderMetadata(e){return $.metadata&&$(e).metadata().sorter===!1?!0:!1}function checkHeaderOptions(e,t){return e.config.headers[t]&&e.config.headers[t].sorter===!1?!0:!1}function checkHeaderOptionsSortingLocked(e,t){return e.config.headers[t]&&e.config.headers[t].lockedOrder?e.config.headers[t].lockedOrder:!1}function applyWidget(e){for(var t=e.config.widgets,n=t.length,r=0;n>r;r++)getWidgetById(t[r]).format(e)}function getWidgetById(e){for(var t=widgets.length,n=0;t>n;n++)if(widgets[n].id.toLowerCase()==e.toLowerCase())return widgets[n]}function formatSortingOrder(e){return"Number"!=typeof e?"desc"==e.toLowerCase()?1:0:1==e?1:0}function isValueInArray(e,t){for(var n=t.length,r=0;n>r;r++)if(t[r][0]==e)return!0;return!1}function setHeadersCss(e,t,n,r){t.removeClass(r[0]).removeClass(r[1]);var a=[];t.each(function(){this.sortDisabled||(a[this.column]=$(this))});for(var i=n.length,o=0;i>o;o++)a[n[o][0]].addClass(r[n[o][1]])}function fixColumnWidth(e){var t=e.config;if(t.widthFixed){var n=$("");$("tr:first td",e.tBodies[0]).each(function(){n.append($("").css("width",$(this).width()))}),$(e).prepend(n)}}function updateHeaderSortCount(e,t){for(var n=e.config,r=t.length,a=0;r>a;a++){var i=t[a],o=n.headerList[i[0]];o.count=i[1],o.count++}}function multisort(table,sortList,cache){if(table.config.debug)var sortTime=new Date;for(var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length,i=0;l>i;i++){var c=sortList[i][0],order=sortList[i][1],s="text"==table.config.parsers[c].type?0==order?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c):0==order?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c),e="e"+i;dynamicExp+="var "+e+" = "+s,dynamicExp+="if("+e+") { return "+e+"; } ",dynamicExp+="else { "}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;l>i;i++)dynamicExp+="}; ";return dynamicExp+="return 0; ",dynamicExp+="}; ",table.config.debug&&benchmark("Evaling expression:"+dynamicExp,new Date),eval(dynamicExp),cache.normalized.sort(sortWrapper),table.config.debug&&benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime),cache}function makeSortFunction(e,t,n){var r="a["+n+"]",a="b["+n+"]";return"text"==e&&"asc"==t?"("+r+" == "+a+" ? 0 : ("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : ("+r+" < "+a+") ? -1 : 1 )));":"text"==e&&"desc"==t?"("+r+" == "+a+" ? 0 : ("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+r+") ? -1 : 1 )));":"numeric"==e&&"asc"==t?"("+r+" === null && "+a+" === null) ? 0 :("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : "+r+" - "+a+"));":"numeric"==e&&"desc"==t?"("+r+" === null && "+a+" === null) ? 0 :("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+r+"));":void 0}function makeSortText(e){return"((a["+e+"] < b["+e+"]) ? -1 : ((a["+e+"] > b["+e+"]) ? 1 : 0));"}function makeSortTextDesc(e){return"((b["+e+"] < a["+e+"]) ? -1 : ((b["+e+"] > a["+e+"]) ? 1 : 0));"}function makeSortNumeric(e){return"a["+e+"]-b["+e+"];"}function makeSortNumericDesc(e){return"b["+e+"]-a["+e+"];"}function sortText(e,t){return table.config.sortLocaleCompare?e.localeCompare(t):t>e?-1:e>t?1:0}function sortTextDesc(e,t){return table.config.sortLocaleCompare?t.localeCompare(e):e>t?-1:t>e?1:0}function sortNumeric(e,t){return e-t}function sortNumericDesc(e,t){return t-e}function getCachedSortType(e,t){return e[t].type}var parsers=[],widgets=[];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=benchmark,this.construct=function(e){return this.each(function(){if(this.tHead&&this.tBodies){var t,n,r,a;this.config={},a=$.extend(this.config,$.tablesorter.defaults,e),t=$(this),$.data(this,"tablesorter",a),n=buildHeaders(this),this.config.parsers=buildParserCache(this,n),r=buildCache(this);var i=[a.cssDesc,a.cssAsc];fixColumnWidth(this),n.click(function(e){var o=t[0].tBodies[0]&&t[0].tBodies[0].rows.length||0;if(!this.sortDisabled&&o>0){t.trigger("sortStart");var s=($(this),this.column);if(this.order=this.count++%2,this.lockedOrder&&(this.order=this.lockedOrder),e[a.sortMultiSortKey])if(isValueInArray(s,a.sortList))for(var l=0;l0&&t.trigger("sorton",[a.sortList]),applyWidget(this)}})},this.addParser=function(e){for(var t=parsers.length,n=!0,r=0;t>r;r++)parsers[r].id.toLowerCase()==e.id.toLowerCase()&&(n=!1);n&&parsers.push(e)},this.addWidget=function(e){widgets.push(e)},this.formatFloat=function(e){var t=parseFloat(e);return isNaN(t)?0:t},this.formatInt=function(e){var t=parseInt(e);return isNaN(t)?0:t},this.isDigit=function(e){return/^[-+]?\d*$/.test($.trim(e.replace(/[,.']/g,"")))},this.clearTableBody=function(e){function t(){for(;this.firstChild;)this.removeChild(this.firstChild)}$.browser.msie?t.apply(e.tBodies[0]):e.tBodies[0].innerHTML=""}}}),$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(){return!0},format:function(e){return $.trim(e.toLocaleLowerCase())},type:"text"}),ts.addParser({id:"digit",is:function(e,t){var n=t.config;return $.tablesorter.isDigit(e,n)},format:function(e){return $.tablesorter.formatFloat(e)},type:"numeric"}),ts.addParser({id:"currency",is:function(e){return/^[£$€?.]/.test(e)},format:function(e){return $.tablesorter.formatFloat(e.replace(new RegExp(/[£$€]/g),""))},type:"numeric"}),ts.addParser({id:"ipAddress",is:function(e){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(e) },format:function(e){for(var t=e.split("."),n="",r=t.length,a=0;r>a;a++){var i=t[a];n+=2==i.length?"0"+i:i}return $.tablesorter.formatFloat(n)},type:"numeric"}),ts.addParser({id:"url",is:function(e){return/^(https?|ftp|file):\/\/$/.test(e)},format:function(e){return jQuery.trim(e.replace(new RegExp(/(https?|ftp|file):\/\//),""))},type:"text"}),ts.addParser({id:"isoDate",is:function(e){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(e)},format:function(e){return $.tablesorter.formatFloat(""!=e?new Date(e.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"}),ts.addParser({id:"percent",is:function(e){return/\%$/.test($.trim(e))},format:function(e){return $.tablesorter.formatFloat(e.replace(new RegExp(/%/g),""))},type:"numeric"}),ts.addParser({id:"usLongDate",is:function(e){return e.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(e){return $.tablesorter.formatFloat(new Date(e).getTime())},type:"numeric"}),ts.addParser({id:"shortDate",is:function(e){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(e)},format:function(e,t){var n=t.config;return e=e.replace(/\-/g,"/"),"us"==n.dateFormat?e=e.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2"):"uk"==n.dateFormat?e=e.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1"):("dd/mm/yy"==n.dateFormat||"dd-mm-yy"==n.dateFormat)&&(e=e.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3")),$.tablesorter.formatFloat(new Date(e).getTime())},type:"numeric"}),ts.addParser({id:"time",is:function(e){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(e)},format:function(e){return $.tablesorter.formatFloat(new Date("2000/01/01 "+e).getTime())},type:"numeric"}),ts.addParser({id:"metadata",is:function(){return!1},format:function(e,t,n){var r=t.config,a=r.parserMetadataName?r.parserMetadataName:"sortValue";return $(n).metadata()[a]},type:"numeric"}),ts.addWidget({id:"zebra",format:function(e){if(e.config.debug)var t=new Date;var n,r,a=-1;$("tr:visible",e.tBodies[0]).each(function(){n=$(this),n.hasClass(e.config.cssChildRow)||a++,r=a%2==0,n.removeClass(e.config.widgetZebra.css[r?0:1]).addClass(e.config.widgetZebra.css[r?1:0])}),e.config.debug&&$.tablesorter.benchmark("Applying Zebra widget",t)}})}(jQuery),function(e){window.NestedFormEvents=function(){this.addFields=e.proxy(this.addFields,this),this.removeFields=e.proxy(this.removeFields,this)},NestedFormEvents.prototype={addFields:function(t){var n=t.currentTarget,r=e(n).data("association"),a=e("#"+e(n).data("blueprint-id")),i=a.data("blueprint"),o=(e(n).closest(".fields").closestChild("input, textarea, select").eq(0).attr("name")||"").replace(new RegExp("[[a-z_]+]$"),"");if(o)for(var s=o.match(/[a-z_]+_attributes(?=\]\[(new_)?\d+\])/g)||[],l=o.match(/[0-9]+/g)||[],c=0;c0;)for(var r=n.shift(),a=r.children(),i=0;i=s&&l>r||l>=a&&a>s||s>r&&a>l}),s=l+1;var d=0;for(var c in o)if(o[c].selected){var u=o[c].start+d;t&&n.tabString==e.value.substring(u,u+n.tabString.length)?(e.value=e.value.substring(0,u)+e.value.substring(u+n.tabString.length),d-=n.tabString.length):t||(e.value=e.value.substring(0,u)+n.tabString+e.value.substring(u),d+=n.tabString.length)}e.focus();var h=r+(d>0?n.tabString.length:0>d?-n.tabString.length:0),f=a+d;e.setSelectionRange(h,f)}}function r(t,n,r){var a=document.selection.createRange();if(t==a.parentElement())if(""==a.text)if(n){var i=a.getBookmark();a.moveStart("character",-r.tabString.length),r.tabString==a.text?a.text="":(a.moveToBookmark(i),a.moveEnd("character",r.tabString.length),r.tabString==a.text&&(a.text="")),a.collapse(!0),a.select()}else a.text=r.tabString,a.collapse(!1),a.select();else{var o=a.text,s=o.length,l=o.split("\r\n"),c=document.body.createTextRange();c.moveToElementText(t),c.setEndPoint("EndToStart",a);var d=c.text,u=d.split("\r\n"),h=d.length,f=document.body.createTextRange();f.moveToElementText(t),f.setEndPoint("StartToEnd",a);var p=f.text,m=document.body.createTextRange();m.moveToElementText(t),m.setEndPoint("StartToEnd",c);var g=m.text,b=e(t).html();e("#r3").text(h+" + "+s+" + "+p.length+" = "+b.length),h+g.length0?y.setEndPoint("StartToEnd",c):y.setEndPoint("StartToStart",c),y.setEndPoint("EndToEnd",a),y.select()}}e.fn.tabby=function(n){var r=e.extend({},e.fn.tabby.defaults,n),a=e.fn.tabby.pressed;return this.each(function(){$this=e(this);var n=e.meta?e.extend({},r,$this.data()):r;$this.bind("keydown",function(r){var i=e.fn.tabby.catch_kc(r);return 16==i&&(a.shft=!0),17==i&&(a.ctrl=!0,setTimeout("$.fn.tabby.pressed.ctrl = false;",1e3)),18==i&&(a.alt=!0,setTimeout("$.fn.tabby.pressed.alt = false;",1e3)),9!=i||a.ctrl||a.alt?void 0:(r.preventDefault,a.last=i,setTimeout("$.fn.tabby.pressed.last = null;",0),t(e(r.target).get(0),a.shft,n),!1)}).bind("keyup",function(t){16==e.fn.tabby.catch_kc(t)&&(a.shft=!1)}).bind("blur",function(t){9==a.last&&e(t.target).one("focus",function(){a.last=null}).get(0).focus()})})},e.fn.tabby.catch_kc=function(e){return e.keyCode?e.keyCode:e.charCode?e.charCode:e.which},e.fn.tabby.pressed={shft:!1,ctrl:!1,alt:!1,last:null},e.fn.tabby.defaults={tabString:String.fromCharCode(9)}}(jQuery),function(e,t,n){var r={required:"The %s field is required.",matches:"The %s field does not match the %s field.",valid_email:"The %s field must contain a valid email address.",min_length:"The %s field must be at least %s characters in length.",max_length:"The %s field must not exceed %s characters in length.",exact_length:"The %s field must be exactly %s characters in length.",greater_than:"The %s field must contain a number greater than %s.",less_than:"The %s field must contain a number less than %s.",alpha:"The %s field must only contain alphabetical characters.",alpha_numeric:"The %s field must only contain alpha-numeric characters.",alpha_dash:"The %s field must only contain alpha-numeric characters, underscores, and dashes.",numeric:"The %s field must contain only numbers.",integer:"The %s field must contain an integer."},a=function(){},i=/^(.+)\[(.+)\]$/,o=/^[0-9]+$/,s=/^\-?[0-9]+$/,l=/^\-?[0-9]*\.?[0-9]+$/,c=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6}$/i,d=/^[a-z]+$/i,u=/^[a-z0-9]+$/i,h=/^[a-z0-9_-]+$/i,f=function(e,n,r){for(this.callback=r||a,this.errors=[],this.fields={},this.form=t.forms[e]||{},this.messages={},this.handlers={},e=0,r=n.length;r>e;e++){var i=n[e];i.name&&i.rules&&(this.fields[i.name]={name:i.name,display:i.display||i.name,rules:i.rules,type:null,value:null,checked:null})}this.form.onsubmit=function(e){return function(t){try{return e._validateForm(t)}catch(n){}}}(this)};f.prototype.setMessage=function(e,t){return this.messages[e]=t,this},f.prototype.registerCallback=function(e,t){return e&&"string"==typeof e&&t&&"function"==typeof t&&(this.handlers[e]=t),this},f.prototype._validateForm=function(e){this.errors=[];for(var t in this.fields)if(this.fields.hasOwnProperty(t)){var r=this.fields[t]||{},a=this.form[r.name];a&&a!==n&&(r.type=a.type,r.value=a.value,r.checked=a.checked),this._validateField(r)}if("function"==typeof this.callback&&this.callback(this.errors,e),this.errors.length>0){if(!e||!e.preventDefault)return!1;e.preventDefault()}return!0},f.prototype._validateField=function(e){var t=e.rules.split("|");if(-1!==e.rules.indexOf("required")||e.value&&""!==e.value&&e.value!==n)for(var a=0,o=t.length;o>a;a++){var s=t[a],l=null,c=!1;if((parts=i.exec(s))&&(s=parts[1],l=parts[2]),"function"==typeof this._hooks[s]?this._hooks[s].apply(this,[e,l])||(c=!0):"callback_"===s.substring(0,9)&&(s=s.substring(9,s.length),"function"==typeof this.handlers[s]&&this.handlers[s].apply(this,[e.value])===!1&&(c=!0)),c){(t=this.messages[s]||r[s])?(e=t.replace("%s",e.display),l&&(e=e.replace("%s",this.fields[l]?this.fields[l].display:l)),this.errors.push(e)):this.errors.push("An error has occurred with the "+e.display+" field.");break}}},f.prototype._hooks={required:function(e){var t=e.value;return"checkbox"===e.type?e.checked===!0:null!==t&&""!==t},matches:function(e,t){return(el=this.form[t])?e.value===el.value:!1},valid_email:function(e){return c.test(e.value)},min_length:function(e,t){return o.test(t)?e.value.length>=t:!1},max_length:function(e,t){return o.test(t)?e.value.length<=t:!1},exact_length:function(e,t){return o.test(t)?e.value.length==t:!1},greater_than:function(e,t){return l.test(e.value)?parseFloat(e.value)>parseFloat(t):!1},less_than:function(e,t){return l.test(e.value)?parseFloat(e.value)="0"&&"7">=n?parseInt(e.substring(1),8):"u"===n||"x"===n?parseInt(e.substring(2),16):e.charCodeAt(1)}function n(e){return 32>e?(16>e?"\\x0":"\\x")+e.toString(16):(e=String.fromCharCode(e),("\\"===e||"-"===e||"["===e||"]"===e)&&(e="\\"+e),e)}function r(e){for(var r=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=[],i="^"===r[0],o=i?1:0,s=r.length;s>o;++o){var l=r[o];if(/\\[bdsw]/i.test(l))e.push(l);else{var c,l=t(l);s>o+2&&"-"===r[o+1]?(c=t(r[o+2]),o+=2):c=l,a.push([l,c]),65>c||l>122||(65>c||l>90||a.push([32|Math.max(65,l),32|Math.min(c,90)]),97>c||l>122||a.push([-33&Math.max(97,l),-33&Math.min(c,122)]))}}for(a.sort(function(e,t){return e[0]-t[0]||t[1]-e[1]}),r=[],l=[0/0,0/0],o=0;os[0]&&(s[1]+1>s[0]&&a.push("-"),a.push(n(s[1])));return a.push("]"),a.join("")}function a(e){for(var t=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),n=t.length,a=[],s=0,l=0;n>s;++s){var c=t[s];"("===c?++l:"\\"===c.charAt(0)&&(c=+c.substring(1))&&l>=c&&(a[c]=-1)}for(s=1;ss;++s)c=t[s],"("===c?(++l,void 0===a[l]&&(t[s]="(?:")):"\\"===c.charAt(0)&&(c=+c.substring(1))&&l>=c&&(t[s]="\\"+a[l]);for(l=s=0;n>s;++s)"^"===t[s]&&"^"!==t[s+1]&&(t[s]="");if(e.ignoreCase&&o)for(s=0;n>s;++s)c=t[s],e=c.charAt(0),c.length>=2&&"["===e?t[s]=r(c):"\\"!==e&&(t[s]=c.replace(/[A-Za-z]/g,function(e){return e=e.charCodeAt(0),"["+String.fromCharCode(-33&e,32|e)+"]"}));return t.join("")}for(var i=0,o=!1,s=!1,l=0,c=e.length;c>l;++l){var d=e[l];if(d.ignoreCase)s=!0;else if(/[a-z]/i.test(d.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){o=!0,s=!1;break}}for(var u={b:8,t:9,n:10,v:11,f:12,r:13},h=[],l=0,c=e.length;c>l;++l){if(d=e[l],d.global||d.multiline)throw Error(""+d);h.push("(?:"+a(d)+")")}return RegExp(h.join("|"),s?"gi":"g")}function t(e){function t(e){switch(e.nodeType){case 1:if(r.test(e.className))break;for(var n=e.firstChild;n;n=n.nextSibling)t(n);n=e.nodeName,("BR"===n||"LI"===n)&&(a[s]="\n",o[s<<1]=i++,o[s++<<1|1]=e);break;case 3:case 4:n=e.nodeValue,n.length&&(n=l?n.replace(/\r\n?/g,"\n"):n.replace(/[\t\n\r ]+/g," "),a[s]=n,o[s<<1]=i,i+=n.length,o[s++<<1|1]=e)}}var n,r=/(?:^|\s)nocode(?:\s|$)/,a=[],i=0,o=[],s=0;e.currentStyle?n=e.currentStyle.whiteSpace:window.getComputedStyle&&(n=document.defaultView.getComputedStyle(e,q).getPropertyValue("white-space"));var l=n&&"pre"===n.substring(0,3);return t(e),{a:a.join("").replace(/\n$/,""),c:o}}function n(e,t,n,r){t&&(e={a:t,d:e},n(e),r.push.apply(r,e.e))}function r(t,r){function a(e){for(var t=e.d,c=[t,"pln"],d=0,u=e.a.match(i)||[],h={},f=0,p=u.length;p>f;++f){var m,g=u[f],b=h[g],v=void 0;if("string"==typeof b)m=!1;else{var y=o[g.charAt(0)];if(y)v=g.match(y[1]),b=y[0];else{for(m=0;l>m;++m)if(y=r[m],v=g.match(y[1])){b=y[0];break}v||(b="pln")}!(m=b.length>=5&&"lang-"===b.substring(0,5))||v&&"string"==typeof v[1]||(m=!1,b="src"),m||(h[g]=b)}if(y=d,d+=g.length,m){m=v[1];var w=g.indexOf(m),x=w+m.length;v[2]&&(x=g.length-v[2].length,w=x-m.length),b=b.substring(5),n(t+y,g.substring(0,w),a,c),n(t+y+w,m,s(b,m),c),n(t+y+x,g.substring(x),a,c)}else c.push(t+y,b)}e.e=c}var i,o={};!function(){for(var n=t.concat(r),a=[],s={},l=0,c=n.length;c>l;++l){var d=n[l],u=d[3];if(u)for(var h=u.length;--h>=0;)o[u.charAt(h)]=d;d=d[1],u=""+d,s.hasOwnProperty(u)||(a.push(d),s[u]=q)}a.push(/[\S\s]/),i=e(a)}();var l=r.length;return a}function a(e){var t=[],n=[];e.tripleQuotedStrings?t.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):e.multiLineStrings?t.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,q,"'\"`"]):t.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]),e.verbatimStrings&&n.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var a=e.hashComments;return a&&(e.cStyleComments?(a>1?t.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):t.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),n.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):t.push(["com",/^#[^\n\r]*/,q,"#"])),e.cStyleComments&&(n.push(["com",/^\/\/[^\n\r]*/,q]),n.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q])),e.regexLiterals&&n.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]),(a=e.types)&&n.push(["typ",a]),e=(""+e.keywords).replace(/^ | $/g,""),e.length&&n.push(["kwd",RegExp("^(?:"+e.replace(/[\s,]+/g,"|")+")\\b"),q]),t.push(["pln",/^\s+/,q," \r\n  "]),n.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]),r(t,n)}function i(e,t){function n(e){switch(e.nodeType){case 1:if(i.test(e.className))break;if("BR"===e.nodeName)r(e),e.parentNode&&e.parentNode.removeChild(e);else for(e=e.firstChild;e;e=e.nextSibling)n(e);break;case 3:case 4:if(l){var t=e.nodeValue,a=t.match(o);if(a){var c=t.substring(0,a.index);e.nodeValue=c,(t=t.substring(a.index+a[0].length))&&e.parentNode.insertBefore(s.createTextNode(t),e.nextSibling),r(e),c||e.parentNode.removeChild(e)}}}}function r(e){function t(e,n){var r=n?e.cloneNode(!1):e,a=e.parentNode;if(a){var a=t(a,1),i=e.nextSibling;a.appendChild(r);for(var o=i;o;o=i)i=o.nextSibling,a.appendChild(o)}return r}for(;!e.nextSibling;)if(e=e.parentNode,!e)return;for(var n,e=t(e.nextSibling,0);(n=e.parentNode)&&1===n.nodeType;)e=n;c.push(e)}var a,i=/(?:^|\s)nocode(?:\s|$)/,o=/\r\n?|\n/,s=e.ownerDocument;e.currentStyle?a=e.currentStyle.whiteSpace:window.getComputedStyle&&(a=s.defaultView.getComputedStyle(e,q).getPropertyValue("white-space"));var l=a&&"pre"===a.substring(0,3);for(a=s.createElement("LI");e.firstChild;)a.appendChild(e.firstChild);for(var c=[a],d=0;dd;++d)a=c[d],a.className="L"+(d+h)%10,a.firstChild||a.appendChild(s.createTextNode(" ")),u.appendChild(a);e.appendChild(u)}function o(e,t){for(var n=t.length;--n>=0;){var r=t[n];y.hasOwnProperty(r)?window.console&&console.warn("cannot override language handler %s",r):y[r]=e}}function s(e,t){return e&&y.hasOwnProperty(e)||(e=/^\s*p;)u[p]!==u[p+2]?(u[f++]=u[p++],u[f++]=u[p++]):p+=2;for(h=f,p=f=0;h>p;){for(var m=u[p],g=u[p+1],b=p+2;h>=b+2&&u[b+1]===g;)b+=2;u[f++]=m,u[f++]=g,p=b}for(u.length=f;d>a;){var v,y=c[a+2]||l,w=u[e+2]||l,b=Math.min(y,w),x=c[a+1];if(1!==x.nodeType&&(v=o.substring(r,b))){i&&(v=v.replace(n,"\r")),x.nodeValue=v;var S=x.ownerDocument,$=S.createElement("SPAN");$.className=u[e+1];var k=x.parentNode;k.replaceChild($,x),$.appendChild(x),y>r&&(c[a+1]=x=S.createTextNode(o.substring(b,y)),k.insertBefore(x,$.nextSibling))}r=b,r>=y&&(a+=2),r>=w&&(e+=2)}}catch(C){"console"in window&&console.log(C&&C.stack?C.stack:C)}}var c=["break,continue,do,else,for,if,return,while"],d=[[c,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],u=[d,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],h=[d,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],f=[h,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],d=[d,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],p=[c,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],m=[c,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],c=[c,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],g=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,b=/\S/,v=a({keywords:[u,f,d,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+p,m,c],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),y={};o(v,["default-code"]),o(r([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),o(r([["pln",/^\s+/,q," \r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]),o(r([],[["atv",/^[\S\s]+/]]),["uq.val"]),o(a({keywords:u,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),o(a({keywords:"null,true,false"}),["json"]),o(a({keywords:f,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),o(a({keywords:h,cStyleComments:!0}),["java"]),o(a({keywords:c,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]),o(a({keywords:p,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]),o(a({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]),o(a({keywords:m,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]),o(a({keywords:d,cStyleComments:!0,regexLiterals:!0}),["js"]),o(a({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),o(r([],[["str",/^[\S\s]+/]]),["regex"]),window.prettyPrintOne=function(e,t,n){var r=document.createElement("PRE");return r.innerHTML=e,n&&i(r,n),l({g:t,i:n,h:r}),r.innerHTML},window.prettyPrint=function(e){function t(){for(var n=window.PR_SHOULD_USE_CONTINUATION?c.now()+250:1/0;u=0){var s,f,o=o.match(h);if(f=!o){f=a;for(var p=void 0,m=f.firstChild;m;m=m.nextSibling)var g=m.nodeType,p=1===g?p?f:m:3===g?b.test(m.nodeValue)?f:p:p;f=(s=p===f?void 0:p)&&"CODE"===s.tagName}for(f&&(o=s.className.match(h)),o&&(o=o[1]),f=!1,p=a.parentNode;p;p=p.parentNode)if(("pre"===p.tagName||"code"===p.tagName||"xmp"===p.tagName)&&p.className&&p.className.indexOf("prettyprint")>=0){f=!0;break}f||((f=(f=a.className.match(/\blinenums\b(?::(\d+))?/))?f[1]&&f[1].length?+f[1]:!0:!1)&&i(a,f),d={g:o,h:a,i:f},l(d))}}uo;++o)r.push(n[a][o]);var n=q,c=Date;c.now||(c={now:function(){return+new Date}});var d,u=0,h=/\blang(?:uage)?-([\w.]+)(?!\S)/;t()},window.PR={createSimpleLexer:r,registerLangHandler:o,sourceDecorator:a,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}}(),!function(e){e(function(){window.prettyPrint&&prettyPrint()})}(window.jQuery),$(document).ready(function(){$(".response").click(function(){var e=$(this).data("response_type");$(".response").removeClass("active"),$(".response-"+e).addClass("active"),$(".format").hide(),$(".format-"+e).show()})}),$(document).ready(function(){$(".flash").length>0&&($(".flash").on("click",function(){$(this).hide("slow")}),setTimeout(function(){$(".flash").length>0&&$(".flash").hide("slow")},15e3)),$("#talkback_command_add").click(function(){$(this).hide(),$("#talkback_command_add_form").removeClass("hide")}),$("#contact_link").click(function(){$("#contact_form").toggle()})});