function reloadCharts(){return-1===navigator.userAgent.toLowerCase().indexOf("firefox")?!1:($('.ui-widget-content [aria-expanded="false"]').find("iframe").each(function(){var t=$(this).attr("src");-1!==t.indexOf("charts")&&($(this).hide(),$(this).attr("src",t),$(this).show())}),void 0)}function openDialogCenter(t){t.dialog("open");var e=getDimensions(t.parent());t.dialog({position:[e[0],e[1]]})}function getDimensions(t){var e=new Array(2);return e[0]=$(window).width()/2-t.width()/2,e[1]=$(window).height()/2-t.height()/2,e}function updateChart(t,e,n,r,a,i){var n=n,r=r,o=$("#iframe"+t).attr("default_src");o||(o=$("#iframe"+t).attr("src")),src=o.split("?")[0],("bar"===$("#type_"+t).val()||"column"===$("#type_"+t).val())&&0==$("#timescale_"+t).val().length&&0==$("#average_"+t).val().length&&0==$("#median_"+t).val().length&&0==$("#sum_"+t).val().length&&$("#timescale_"+t).val(30);var s=[];$(".chart_options"+t).each(function(){var t=$(this).val(),e=$(this).attr("id"),n=e.split("_")[0];t.length>0&&s.push([n,t])});for(var l="";s.length>0;){var u=s.pop();"width"==u[0]&&(n=parseInt(u[1])),"height"==u[0]&&(r=parseInt(u[1])),("type"!=u[0]||"line"!=u[1])&&(l+="&"+u[0]+"="+encodeURIComponent(u[1]))}l.length>0&&(src+="?"+l.substring(1)),e&&t>0&&i?$.update("/channels/"+a+"/charts/"+t,{newOptions:{options:l}}):e&&t>0&&$.update("/channels/"+a+"/charts/"+t,{options:l}),$("#embed"+t).val(''),$("#iframe"+t).attr("src",src),$("#iframe"+t).attr("width",n),$("#iframe"+t).attr("height",r)}function updateSelectValues(){selectedValue=$(this).val(),$(".mutuallyexclusive"+index).each(function(){$(this).val("")}),$(this).val(selectedValue)}function setupChartForm(t){return function(e,n){n.length>0&&$("#"+n.split("=")[0]+"_"+t).val(decodeURIComponent(n.split("=")[1]))}}function setupColumns(t,e){$(sortColumnSetup(t,e)),$(".column").disableSelection()}function createWindowsWithData(t,e,n,r){for(var a in t){var i=t[a].window,o=i.window_type;colId=i.col,title=i.title;var s=i.html;"chart"===i.window_type&&$("body").append("
'+i+"
"),$("#portlet_"+n).length>1)throw"Portlet count doesn't match what's expected";return $("#portlet_"+n)}function sortColumnSetup(t,e){$(".column").sortable({opacity:.6,helper:function(){return $("")},connectWith:".column",update:updatePortletPositions(t,e)})}function getPortletArray(t){var e=new Array,n=t.split("&");for(i in n)val=n[i].split("=")[1],e.push(val);return e}function uiToggleClick(){$(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"),$(this).parents(".portlet:first").find(".portlet-content").toggle()}!function(t,e){t.rails!==e&&t.error("jquery-ujs has already been loaded!");var n,r=t(document);t.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(e){var n=t('meta[name="csrf-token"]').attr("content");n&&e.setRequestHeader("X-CSRF-Token",n)},fire:function(e,n,r){var a=t.Event(n);return e.trigger(a,r),a.result!==!1},confirm:function(t){return confirm(t)},ajax:function(e){return t.ajax(e)},href:function(t){return t.attr("href")},handleRemote:function(r){var a,i,o,s,l,u,c,d;if(n.fire(r,"ajax:before")){if(s=r.data("cross-domain"),l=s===e?null:s,u=r.data("with-credentials")||null,c=r.data("type")||t.ajaxSettings&&t.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);d={type:a||"GET",data:o,dataType:c,beforeSend:function(t,a){return a.dataType===e&&t.setRequestHeader("accept","*/*;q=0.5, "+a.accepts.script),n.fire(r,"ajax:beforeSend",[t,a])},success:function(t,e,n){r.trigger("ajax:success",[t,e,n])},complete:function(t,e){r.trigger("ajax:complete",[t,e])},error:function(t,e,n){r.trigger("ajax:error",[t,e,n])},crossDomain:l},u&&(d.xhrFields={withCredentials:u}),i&&(d.url=i);var f=n.ajax(d);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=t("meta[name=csrf-token]").attr("content"),l=t("meta[name=csrf-param]").attr("content"),u=t('
'),c='
';l!==e&&s!==e&&(c+='
'),o&&u.attr("target",o),u.hide().append(c).appendTo("body"),u.submit()},disableFormElements:function(e){e.find(n.disableSelector).each(function(){var e=t(this),n=e.is("button")?"html":"val";e.data("ujs:enable-with",e[n]()),e[n](e.data("disable-with")),e.prop("disabled",!0)})},enableFormElements:function(e){e.find(n.enableSelector).each(function(){var e=t(this),n=e.is("button")?"html":"val";e.data("ujs:enable-with")&&e[n](e.data("ujs:enable-with")),e.prop("disabled",!1)})},allowAction:function(t){var e,r=t.data("confirm"),a=!1;return r?(n.fire(t,"confirm")&&(a=n.confirm(r),e=n.fire(t,"confirm:complete",[a])),a&&e):!0},blankInputs:function(e,n,r){var a,i,o=t(),s=n||"input,textarea",l=e.find(s);return l.each(function(){if(a=t(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(t,e){return n.blankInputs(t,e,!0)},stopEverything:function(e){return t(e.target).trigger("ujs:everythingStopped"),e.stopImmediatePropagation(),!1},disableElement:function(t){t.data("ujs:enable-with",t.html()),t.html(t.data("disable-with")),t.bind("click.railsDisable",function(t){return n.stopEverything(t)})},enableElement:function(t){t.data("ujs:enable-with")!==e&&(t.html(t.data("ujs:enable-with")),t.removeData("ujs:enable-with")),t.unbind("click.railsDisable")}},n.fire(r,"rails:attachBindings")&&(t.ajaxPrefilter(function(t,e,r){t.crossDomain||n.CSRFProtection(r)}),r.delegate(n.linkDisableSelector,"ajax:complete",function(){n.enableElement(t(this))}),r.delegate(n.linkClickSelector,"click.rails",function(r){var a=t(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")!==e){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(e){var r=t(this);return n.allowAction(r)?(n.handleRemote(r),!1):n.stopEverything(e)}),r.delegate(n.inputChangeSelector,"change.rails",function(e){var r=t(this);return n.allowAction(r)?(n.handleRemote(r),!1):n.stopEverything(e)}),r.delegate(n.formSubmitSelector,"submit.rails",function(r){var a=t(this),i=a.data("remote")!==e,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")==e&&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(e){var r=t(this);if(!n.allowAction(r))return n.stopEverything(e);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(e){this==e.target&&n.disableFormElements(t(this))}),r.delegate(n.formSubmitSelector,"ajax:complete.rails",function(e){this==e.target&&n.enableFormElements(t(this))}),t(function(){var e=t("meta[name=csrf-token]").attr("content"),n=t("meta[name=csrf-param]").attr("content");t('form input[name="'+n+'"]').val(e)}))}(jQuery),function(){var t,e,n,r,a,i,o,s,l,u,c,d,h,f,p,m,g,v,b,y,w,x,S,$,k,C,T,E,_,N,I,L,F,A,P,R,j,O,D,H,q,M,B,z,V,W,U,G,Q,X=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},Y={}.hasOwnProperty,K=function(t,e){function n(){this.constructor=t}for(var r in e)Y.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},Z=[].slice;_={},d=10,z=!1,m=null,E=null,P=null,p=null,G=null,y=function(t){var e;return t=new n(t),H(),c(),R(t),z&&(e=V(t.absolute))?(w(e),x(t)):x(t,B)},V=function(t){var e;return e=_[t],e&&!e.transitionCacheDisabled?e:void 0},g=function(t){return null==t&&(t=!0),z=t},x=function(t,e){return null==e&&(e=function(){}),W("page:fetch",{url:t.absolute}),null!=G&&G.abort(),G=new XMLHttpRequest,G.open("GET",t.withoutHashForIE10compatibility(),!0),G.setRequestHeader("Accept","text/html, application/xhtml+xml, application/xml"),G.setRequestHeader("X-XHR-Referer",P),G.onload=function(){var n;return W("page:receive"),(n=F())?(h.apply(null,b(n)),j(),e(),W("page:load")):document.location.href=t.absolute},G.onloadend=function(){return G=null},G.onerror=function(){return document.location.href=t.absolute},G.send()},w=function(t){return null!=G&&G.abort(),h(t.title,t.body),A(t),W("page:restore")},c=function(){var t;return t=new n(m.url),_[t.absolute]={url:t.relative,body:document.body,title:document.title,positionY:window.pageYOffset,positionX:window.pageXOffset,cachedAt:(new Date).getTime(),transitionCacheDisabled:null!=document.querySelector("[data-no-transition-cache]")},f(d)},I=function(t){return null==t&&(t=d),/^[\d]+$/.test(t)?d=parseInt(t):void 0},f=function(t){var e,n,r,a,i,o;for(r=Object.keys(_),e=r.map(function(t){return _[t].cachedAt}).sort(function(t,e){return e-t}),o=[],a=0,i=r.length;i>a;a++)n=r[a],_[n].cachedAt<=e[t]&&(W("page:expire",_[n]),o.push(delete _[n]));return o},h=function(e,n,r,a){return document.title=e,document.documentElement.replaceChild(n,document.body),null!=r&&t.update(r),a&&v(),m=window.history.state,W("page:change"),W("page:update")},v=function(){var t,e,n,r,a,i,o,s,l,u,c,d;for(i=Array.prototype.slice.call(document.body.querySelectorAll('script:not([data-turbolinks-eval="false"])')),o=0,l=i.length;l>o;o++)if(a=i[o],""===(c=a.type)||"text/javascript"===c){for(e=document.createElement("script"),d=a.attributes,s=0,u=d.length;u>s;s++)t=d[s],e.setAttribute(t.name,t.value);e.appendChild(document.createTextNode(a.innerHTML)),r=a.parentNode,n=a.nextSibling,r.removeChild(a),r.insertBefore(e,n)}},q=function(t){return t.innerHTML=t.innerHTML.replace(/