function reloadCharts(){return-1===navigator.userAgent.toLowerCase().indexOf("firefox")?!1:void $('.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())})}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,i,a){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 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)),t&&e>0&&a?$.update("/channels/"+i+"/charts/"+e,{newOptions:{options:l}}):t&&e>0&&$.update("/channels/"+i+"/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 i in e){var a=e[i].window,o=a.window_type;colId=a.col,title=a.title;var s=a.html;"chart"===a.window_type&&$("body").append("
'+a+"
"),$("#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 $("")},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 i=e.Event(n);return t.trigger(i,r),i.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 i,a,o,s,l,u,c,d;if(n.fire(r,"ajax:before")){if(s=r.data("cross-domain"),l=s===t?null:s,u=r.data("with-credentials")||null,c=r.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType,r.is("form")){i=r.attr("method"),a=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)?(i=r.data("method"),a=r.data("url"),o=r.serialize(),r.data("params")&&(o=o+"&"+r.data("params"))):r.is(n.buttonClickSelector)?(i=r.data("method")||"get",a=r.data("url"),o=r.serialize(),r.data("params")&&(o=o+"&"+r.data("params"))):(i=r.data("method"),a=n.href(r),o=r.data("params")||null);d={type:i||"GET",data:o,dataType:c,beforeSend:function(e,i){return i.dataType===t&&e.setRequestHeader("accept","*/*;q=0.5, "+i.accepts.script),n.fire(r,"ajax:beforeSend",[e,i])},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},u&&(d.xhrFields={withCredentials:u}),a&&(d.url=a);var f=n.ajax(d);return r.trigger("ajax:send",f),f}return!1},handleMethod:function(r){var i=n.href(r),a=r.data("method"),o=r.attr("target"),s=e("meta[name=csrf-token]").attr("content"),l=e("meta[name=csrf-param]").attr("content"),u=e('
'),c='
';l!==t&&s!==t&&(c+='
'),o&&u.attr("target",o),u.hide().append(c).appendTo("body"),u.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"),i=!1;return r?(n.fire(e,"confirm")&&(i=n.confirm(r),t=n.fire(e,"confirm:complete",[i])),i&&t):!0},blankInputs:function(t,n,r){var i,a,o=e(),s=n||"input,textarea",l=t.find(s);return l.each(function(){if(i=e(this),a=i.is("input[type=checkbox],input[type=radio]")?i.is(":checked"):i.val(),!a==!r){if(i.is("input[type=radio]")&&l.filter('input[type=radio]:checked[name="'+i.attr("name")+'"]').length)return!0;o=o.add(i)}}),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 i=e(this),a=i.data("method"),o=i.data("params");if(!n.allowAction(i))return n.stopEverything(r);if(i.is(n.linkDisableSelector)&&n.disableElement(i),i.data("remote")!==t){if(!(!r.metaKey&&!r.ctrlKey||a&&"GET"!==a||o))return!0;var s=n.handleRemote(i);return s===!1?n.enableElement(i):s.error(function(){n.enableElement(i)}),!1}return i.data("method")?(n.handleMethod(i),!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 i=e(this),a=i.data("remote")!==t,o=n.blankInputs(i,n.requiredInputSelector),s=n.nonBlankInputs(i,n.fileInputSelector);if(!n.allowAction(i))return n.stopEverything(r);if(o&&i.attr("novalidate")==t&&n.fire(i,"ajax:aborted:required",[o]))return n.stopEverything(r);if(a){if(s){setTimeout(function(){n.disableFormElements(i)},13);var l=n.fire(i,"ajax:aborted:file",[s]);return l||setTimeout(function(){n.enableFormElements(i)},13),l}return n.handleRemote(i),!1}setTimeout(function(){n.disableFormElements(i)},13)}),r.delegate(n.formInputClickSelector,"click.rails",function(t){var r=e(this);if(!n.allowAction(r))return n.stopEverything(t);var i=r.attr("name"),a=i?{name:i,value:r.val()}:null;r.closest("form").data("ujs:submit-button",a)}),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(){var e,t,n,r,i,a,o,s,l,u,c,d,h,f,p,m,g,v,b,y,w,x,$,S,C,k,E,T,_,N,I,A,L,F,O,P,R,D,j,H,q,M,B,z,U,V,W,G,Q,X,Y,K,Z,J=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1},et={}.hasOwnProperty,tt=function(e,t){function n(){this.constructor=e}for(var r in t)et.call(t,r)&&(e[r]=t[r]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},nt=[].slice;A={},h=10,G=!1,v=null,N=null,D=null,g=null,K=null,r={BEFORE_CHANGE:"page:before-change",FETCH:"page:fetch",RECEIVE:"page:receive",CHANGE:"page:change",UPDATE:"page:update",LOAD:"page:load",RESTORE:"page:restore",BEFORE_UNLOAD:"page:before-unload",EXPIRE:"page:expire"},x=function(e){var t;return e=new n(e),B(),d(),G&&(t=Q(e.absolute))?($(t),S(e)):S(e,V)},Q=function(e){var t;return t=A[e],t&&!t.transitionCacheDisabled?t:void 0},b=function(e){return null==e&&(e=!0),G=e},S=function(e,t){return null==t&&(t=function(){return function(){}}(this)),X(r.FETCH,{url:e.absolute}),null!=K&&K.abort(),K=new XMLHttpRequest,K.open("GET",e.withoutHashForIE10compatibility(),!0),K.setRequestHeader("Accept","text/html, application/xhtml+xml, application/xml"),K.setRequestHeader("X-XHR-Referer",D),K.onload=function(){var n;return X(r.RECEIVE,{url:e.absolute}),(n=P())?(j(e),f.apply(null,w(n)),I(),H(),t(),X(r.LOAD)):document.location.href=e.absolute},K.onloadend=function(){return K=null},K.onerror=function(){return document.location.href=e.absolute},K.send()},$=function(e){return null!=K&&K.abort(),f(e.title,e.body),R(e),X(r.RESTORE)},d=function(){var e;return e=new n(v.url),A[e.absolute]={url:e.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]")},m(h)},F=function(e){return null==e&&(e=h),/^[\d]+$/.test(e)?h=parseInt(e):void 0},m=function(e){var t,n,i,a,o,s;for(i=Object.keys(A),t=i.map(function(e){return A[e].cachedAt}).sort(function(e,t){return t-e}),s=[],a=0,o=i.length;o>a;a++)n=i[a],A[n].cachedAt<=t[e]&&(X(r.EXPIRE,A[n]),s.push(delete A[n]));return s},f=function(t,n,i,a){return X(r.BEFORE_UNLOAD),document.title=t,document.documentElement.replaceChild(n,document.body),null!=i&&e.update(i),W(),a&&y(),v=window.history.state,X(r.CHANGE),X(r.UPDATE)},y=function(){var e,t,n,r,i,a,o,s,l,u,c,d;for(a=Array.prototype.slice.call(document.body.querySelectorAll('script:not([data-turbolinks-eval="false"])')),o=0,l=a.length;l>o;o++)if(i=a[o],""===(c=i.type)||"text/javascript"===c){for(t=document.createElement("script"),d=i.attributes,s=0,u=d.length;u>s;s++)e=d[s],t.setAttribute(e.name,e.value);i.hasAttribute("async")||(t.async=!1),t.appendChild(document.createTextNode(i.innerHTML)),r=i.parentNode,n=i.nextSibling,r.removeChild(i),r.insertBefore(t,n)}},z=function(e){return e.innerHTML=e.innerHTML.replace(/