$(function(){$("#model-aps").data("ap_names",{});$("#model-aps").jtablemodel({url:"/stat/device"});$("#model-stas").data("sta_names",{});$("#model-stas").data("sta_counts",{});$("#model-stas").jtablemodel({url:"/stat/sta"});$("#model-events").jtablemodel({url:"/stat/event"});$("#model-maps").jlistmodel({url:"/list/map",params:{_sort:"order"},objname:"map"});$("#model-usergroups").jtablemodel({url:"/list/usergroup"});$("#model-usergroups").jlistmodel({tableModel:$("#model-usergroups")});$("#model-wlangroups").jtablemodel({url:"/list/wlangroup"});
$("#model-wlangroups").jlistmodel({tableModel:$("#model-wlangroups")});$("#model-sites").jtablemodel({url:"/cmd/sitemgr",params:{cmd:"get-sites"}});$("#model-sites").jlistmodel({tableModel:$("#model-sites")});$("#model-wlanconfs").jtablemodel({url:"/list/wlanconf"});$("#model-settings").jtablemodel({url:"/get/setting",mapkey:"key"});$("#model-sysinfo").jsysinfo();$("#model-aps").bind("jtablemodel_refresh-done",function(h,p){var w=$("#model-aps").data("ap_names");$.each(p._rows,function(){var k=$(this);
w[k.attr("mac")]=k.attr("name")||k.attr("mac")})});$("#model-stas").bind("jtablemodel_refresh-done",function(h,p){var w=$("#model-stas").data("sta_names"),k={};k.by_essid={};$.each(p._rows,function(t,F){w[F.mac]=F.name||F.hostname||F.mac;k[F.ap_mac]||(k[F.ap_mac]={});var z=F.is_guest?"guest":"user";$.each([z+"-"+F.radio,F.radio,z,"total"],function(A,u){k[F.ap_mac][u]=(k[F.ap_mac][u]|0)+1});k.by_essid[F.essid]=(k.by_essid[F.essid]|0)+1});$("#model-stas").data("sta_counts",k)});$("#model-wlangroups").bind("jtablemodel_refresh-done",
function(h,p){$.each(p._rows,function(){if(this.attr_hidden_id){$("#model-wlangroups").data("default_id",this._id);return false}return true})});$("#model-sysinfo").bind("jsysinfo_changed",function(){var h=$("#model-sysinfo").jsysinfo("data").cur_ccode,p=$('div.ap-dialog .ap-ng-configs select[name="channel"]'),w=$("select.ap-channel-ng");p.empty().append($('<option value="0">Auto</option>'));w.empty();$.each(h.channels_ng,function(F,z){$('<option value="'+z+'">'+z+"</option>").appendTo(p);$('<option value="'+
z+'">'+z+"</option>").appendTo(w)});var k=$('div.ap-dialog .ap-na-configs select[name="channel"]'),t=$("select.ap-channel-na");k.empty().append($('<option value="0">Auto</option>'));t.empty();$.each(h.channels_na,function(F,z){var A=z<52?1:z<149?2:3,u=$.inArray(z,h.channels_na_dfs)>=0;$('<option value="'+z+'" band="'+A+'">'+z+(u?" (dfs)":"")+"</option>").appendTo(k);$('<option value="'+z+'" band="'+A+'">'+z+(u?" (dfs)":"")+"</option>").appendTo(t)});$(document.body).dialogManager("removeAllItems")});
$("#model-apfilters").jlistmodel({tableModel:$("#model-aps"),tableModelRowConverter:function(h){if(!h.adopted)return null;return h}});$("#model-sysinfo").jsysinfo("refresh");$("#MainPanel").tabs().bind("tabsshow",function(h,p){var w=$("#"+p.panel.id).data("fn_shown");w&&w()}).tabs("select",0);var c=$("#FooterPanel"),e=$("#FooterPanels"),i=$("#FooterToggleButton"),q=function(){e.find("div.panel:visible");if(c.hasClass("closed")){c.removeClass("closed");e.height("auto")}e.animate({bottom:0});i.button("option",
"icons",{primary:"ui-icon-carat-1-s"}).removeClass("ui-state-hover")},m=function(){c.hasClass("closed")||e.animate({height:0},function(){c.addClass("closed")});i.button("option","icons",{primary:"ui-icon-carat-1-n"}).removeClass("ui-state-hover")};$("#FooterPanel").tabs().bind("tabsshow",function(h,p){q();var w=$("#"+p.panel.id).data("fn_shown");w&&w()});i.button({text:false,icons:{primary:"ui-icon-carat-1-n"}}).click(function(){c.hasClass("closed")?q():m()});$("#FooterPanel #FooterNav li, #FooterPanel #FooterNav a").click(q);
$(window).keydown(function(h){h.which==27&&m()});$("#model-maintabpagesizer").jlistmodel({rows:[{_id:10},{_id:15},{_id:20},{_id:30},{_id:40},{_id:60},{_id:100}],selected:$.cookie("maintab.pagesize")||10}).bind("jlistmodel_select-changed",function(){$.cookie("maintab.pagesize",$(this).jlistmodel("selected"),{expires:30})});$("#MainPanel select.table-pagesizer").jselect({model:$("#model-maintabpagesizer"),renderer:function(h,p){return""+p._id},selectionSynchronized:true});$("#model-maintabpagesizer").jlistmodel("refresh");
$("a.ap-link").live("click",function(){var h=$(this).attr("title");$(document.body).dialogManager("addItem",h,"ap")});$("a.sta-link").live("click",function(){$(document.body).dialogManager("addItem",$(this).attr("title"),"sta")});$("span.label").live("click",function(){var h=$(this).prev();if(h.is(".radio-input")||h.is(".check-box-input"))h.click().change()});$("span.localizable").live("dblclick",function(h){if(h.altKey){h=$('<input class="localizing" type="text" name="text" value="'+$(this).html()+
'" key="'+$(this).attr("key")+'" />"');$(this).replaceWith(h);h.focus().select()}});$("input.localizing").live("keydown",function(h){if(h.which==13&&$(this).val()){h=$('<span class="localizable" key="'+$(this).attr("key")+'">'+$(this).val()+"</span>");$(this).replaceWith(h)}});$("table.data-table.rowhoverable tbody tr:shown").live("hover",function(){try{var h=$(this);h.parents("table:nth-child(1)").data("fnrowhover")(h,h.data("o"))}catch(p){}});$("#ui-locate-blinker").jtimer({interval:0.5}).bind("jtimer_due",
function(){$(".locate-button.locating").toggleClass("on")});$("#model-aps").bind("jtablemodel_refresh-done",function(h,p){$("#ui-locate-blinker").jtimer("stop");$.each(p._rows,function(w,k){if(k.locating){$("#ui-locate-blinker").jtimer("start");return false}})});$("#model-maps").jlistmodel("refresh");$("#model-usergroups").jtablemodel("refresh");$("#model-wlangroups").jtablemodel("refresh");$("#model-wlanconfs").jtablemodel("refresh");$("#model-settings").jtablemodel("refresh");$("#model-sites").jtablemodel("refresh");
$(document.body).dialogManager({apTemplate:"div.ap-dialog",staTemplate:"div.sta-dialog"})});
var swfobject=function(){function c(){if(!za){try{var y=R.getElementsByTagName("body")[0].appendChild(R.createElement("span"));y.parentNode.removeChild(y)}catch(G){return}za=true;y=va.length;for(var I=0;I<y;I++)va[I]()}}function e(y){if(za)y();else va[va.length]=y}function i(y){if(typeof ca.addEventListener!=L)ca.addEventListener("load",y,false);else if(typeof R.addEventListener!=L)R.addEventListener("load",y,false);else if(typeof ca.attachEvent!=L)u(ca,"onload",y);else if(typeof ca.onload=="function"){var G=
ca.onload;ca.onload=function(){G();y()}}else ca.onload=y}function q(){var y=R.getElementsByTagName("body")[0],G=R.createElement(M);G.setAttribute("type",S);var I=y.appendChild(G);if(I){var T=0;(function(){if(typeof I.GetVariable!=L){var X=I.GetVariable("$version");if(X){X=X.split(" ")[1].split(",");Y.pv=[parseInt(X[0],10),parseInt(X[1],10),parseInt(X[2],10)]}}else if(T<10){T++;setTimeout(arguments.callee,10);return}y.removeChild(G);I=null;m()})()}else m()}function m(){var y=ua.length;if(y>0)for(var G=
0;G<y;G++){var I=ua[G].id,T=ua[G].callbackFn,X={success:false,id:I};if(Y.pv[0]>0){var ba=A(I);if(ba)if(x(ua[G].swfVersion)&&!(Y.wk&&Y.wk<312)){J(I,true);if(T){X.success=true;X.ref=h(I);T(X)}}else if(ua[G].expressInstall&&p()){X={};X.data=ua[G].expressInstall;X.width=ba.getAttribute("width")||"0";X.height=ba.getAttribute("height")||"0";if(ba.getAttribute("class"))X.styleclass=ba.getAttribute("class");if(ba.getAttribute("align"))X.align=ba.getAttribute("align");var H={};ba=ba.getElementsByTagName("param");
for(var ka=ba.length,Q=0;Q<ka;Q++)if(ba[Q].getAttribute("name").toLowerCase()!="movie")H[ba[Q].getAttribute("name")]=ba[Q].getAttribute("value");w(X,H,I,T)}else{k(ba);T&&T(X)}}else{J(I,true);if(T){if((I=h(I))&&typeof I.SetVariable!=L){X.success=true;X.ref=I}T(X)}}}}function h(y){var G=null;if((y=A(y))&&y.nodeName=="OBJECT")if(typeof y.SetVariable!=L)G=y;else if(y=y.getElementsByTagName(M)[0])G=y;return G}function p(){return!Ka&&x("6.0.65")&&(Y.win||Y.mac)&&!(Y.wk&&Y.wk<312)}function w(y,G,I,T){Ka=
true;ea=T||null;ia={success:false,id:I};var X=A(I);if(X){if(X.nodeName=="OBJECT"){La=t(X);N=null}else{La=X;N=I}y.id=ga;if(typeof y.width==L||!/%$/.test(y.width)&&parseInt(y.width,10)<310)y.width="310";if(typeof y.height==L||!/%$/.test(y.height)&&parseInt(y.height,10)<137)y.height="137";R.title=R.title.slice(0,47)+" - Flash Player Installation";T=Y.ie&&Y.win?"ActiveX":"PlugIn";T="MMredirectURL="+ca.location.toString().replace(/&/g,"%26")+"&MMplayerType="+T+"&MMdoctitle="+R.title;if(typeof G.flashvars!=
L)G.flashvars+="&"+T;else G.flashvars=T;if(Y.ie&&Y.win&&X.readyState!=4){T=R.createElement("div");I+="SWFObjectNew";T.setAttribute("id",I);X.parentNode.insertBefore(T,X);X.style.display="none";(function(){X.readyState==4?X.parentNode.removeChild(X):setTimeout(arguments.callee,10)})()}F(y,G,I)}}function k(y){if(Y.ie&&Y.win&&y.readyState!=4){var G=R.createElement("div");y.parentNode.insertBefore(G,y);G.parentNode.replaceChild(t(y),G);y.style.display="none";(function(){y.readyState==4?y.parentNode.removeChild(y):
setTimeout(arguments.callee,10)})()}else y.parentNode.replaceChild(t(y),y)}function t(y){var G=R.createElement("div");if(Y.win&&Y.ie)G.innerHTML=y.innerHTML;else if(y=y.getElementsByTagName(M)[0])if(y=y.childNodes)for(var I=y.length,T=0;T<I;T++)!(y[T].nodeType==1&&y[T].nodeName=="PARAM")&&y[T].nodeType!=8&&G.appendChild(y[T].cloneNode(true));return G}function F(y,G,I){var T,X=A(I);if(Y.wk&&Y.wk<312)return T;if(X){if(typeof y.id==L)y.id=I;if(Y.ie&&Y.win){var ba="";for(var H in y)if(y[H]!=Object.prototype[H])if(H.toLowerCase()==
"data")G.movie=y[H];else if(H.toLowerCase()=="styleclass")ba+=' class="'+y[H]+'"';else if(H.toLowerCase()!="classid")ba+=" "+H+'="'+y[H]+'"';H="";for(var ka in G)if(G[ka]!=Object.prototype[ka])H+='<param name="'+ka+'" value="'+G[ka]+'" />';X.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ba+">"+H+"</object>";wa[wa.length]=y.id;T=A(y.id)}else{ka=R.createElement(M);ka.setAttribute("type",S);for(var Q in y)if(y[Q]!=Object.prototype[Q])if(Q.toLowerCase()=="styleclass")ka.setAttribute("class",
y[Q]);else Q.toLowerCase()!="classid"&&ka.setAttribute(Q,y[Q]);for(ba in G)if(G[ba]!=Object.prototype[ba]&&ba.toLowerCase()!="movie"){y=ka;H=ba;Q=G[ba];I=R.createElement("param");I.setAttribute("name",H);I.setAttribute("value",Q);y.appendChild(I)}X.parentNode.replaceChild(ka,X);T=ka}}return T}function z(y){var G=A(y);if(G&&G.nodeName=="OBJECT")if(Y.ie&&Y.win){G.style.display="none";(function(){if(G.readyState==4){var I=A(y);if(I){for(var T in I)if(typeof I[T]=="function")I[T]=null;I.parentNode.removeChild(I)}}else setTimeout(arguments.callee,
10)})()}else G.parentNode.removeChild(G)}function A(y){var G=null;try{G=R.getElementById(y)}catch(I){}return G}function u(y,G,I){y.attachEvent(G,I);la[la.length]=[y,G,I]}function x(y){var G=Y.pv;y=y.split(".");y[0]=parseInt(y[0],10);y[1]=parseInt(y[1],10)||0;y[2]=parseInt(y[2],10)||0;return G[0]>y[0]||G[0]==y[0]&&G[1]>y[1]||G[0]==y[0]&&G[1]==y[1]&&G[2]>=y[2]?true:false}function C(y,G,I,T){if(!(Y.ie&&Y.mac)){var X=R.getElementsByTagName("head")[0];if(X){I=I&&typeof I=="string"?I:"screen";if(T)qa=Z=
null;if(!Z||qa!=I){T=R.createElement("style");T.setAttribute("type","text/css");T.setAttribute("media",I);Z=X.appendChild(T);if(Y.ie&&Y.win&&typeof R.styleSheets!=L&&R.styleSheets.length>0)Z=R.styleSheets[R.styleSheets.length-1];qa=I}if(Y.ie&&Y.win)Z&&typeof Z.addRule==M&&Z.addRule(y,G);else Z&&typeof R.createTextNode!=L&&Z.appendChild(R.createTextNode(y+" {"+G+"}"))}}}function J(y,G){if(xa){var I=G?"visible":"hidden";if(za&&A(y))A(y).style.visibility=I;else C("#"+y,"visibility:"+I)}}function B(y){return/[\\\"<>\.;]/.exec(y)!=
null&&typeof encodeURIComponent!=L?encodeURIComponent(y):y}var L="undefined",M="object",S="application/x-shockwave-flash",ga="SWFObjectExprInst",ca=window,R=document,ha=navigator,na=false,va=[function(){na?q():m()}],ua=[],wa=[],la=[],La,N,ea,ia,za=false,Ka=false,Z,qa,xa=true,Y=function(){var y=typeof R.getElementById!=L&&typeof R.getElementsByTagName!=L&&typeof R.createElement!=L,G=ha.userAgent.toLowerCase(),I=ha.platform.toLowerCase(),T=I?/win/.test(I):/win/.test(G);I=I?/mac/.test(I):/mac/.test(G);
G=/webkit/.test(G)?parseFloat(G.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false;var X=!+"\u000b1",ba=[0,0,0],H=null;if(typeof ha.plugins!=L&&typeof ha.plugins["Shockwave Flash"]==M){if((H=ha.plugins["Shockwave Flash"].description)&&!(typeof ha.mimeTypes!=L&&ha.mimeTypes[S]&&!ha.mimeTypes[S].enabledPlugin)){na=true;X=false;H=H.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ba[0]=parseInt(H.replace(/^(.*)\..*$/,"$1"),10);ba[1]=parseInt(H.replace(/^.*\.(.*)\s.*$/,"$1"),10);ba[2]=/[a-zA-Z]/.test(H)?parseInt(H.replace(/^.*[a-zA-Z]+(.*)$/,
"$1"),10):0}}else if(typeof ca.ActiveXObject!=L)try{var ka=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(ka)if(H=ka.GetVariable("$version")){X=true;H=H.split(" ")[1].split(",");ba=[parseInt(H[0],10),parseInt(H[1],10),parseInt(H[2],10)]}}catch(Q){}return{w3:y,pv:ba,wk:G,ie:X,win:T,mac:I}}();(function(){if(Y.w3){if(typeof R.readyState!=L&&R.readyState=="complete"||typeof R.readyState==L&&(R.getElementsByTagName("body")[0]||R.body))c();if(!za){typeof R.addEventListener!=L&&R.addEventListener("DOMContentLoaded",
c,false);if(Y.ie&&Y.win){R.attachEvent("onreadystatechange",function(){if(R.readyState=="complete"){R.detachEvent("onreadystatechange",arguments.callee);c()}});ca==top&&function(){if(!za){try{R.documentElement.doScroll("left")}catch(y){setTimeout(arguments.callee,0);return}c()}}()}Y.wk&&function(){za||(/loaded|complete/.test(R.readyState)?c():setTimeout(arguments.callee,0))}();i(c)}}})();(function(){Y.ie&&Y.win&&window.attachEvent("onunload",function(){for(var y=la.length,G=0;G<y;G++)la[G][0].detachEvent(la[G][1],
la[G][2]);y=wa.length;for(G=0;G<y;G++)z(wa[G]);for(var I in Y)Y[I]=null;Y=null;for(var T in swfobject)swfobject[T]=null;swfobject=null})})();return{registerObject:function(y,G,I,T){if(Y.w3&&y&&G){var X={};X.id=y;X.swfVersion=G;X.expressInstall=I;X.callbackFn=T;ua[ua.length]=X;J(y,false)}else T&&T({success:false,id:y})},getObjectById:function(y){if(Y.w3)return h(y)},embedSWF:function(y,G,I,T,X,ba,H,ka,Q,Ca){var Ga={success:false,id:G};if(Y.w3&&!(Y.wk&&Y.wk<312)&&y&&G&&I&&T&&X){J(G,false);e(function(){I+=
"";T+="";var pa={};if(Q&&typeof Q===M)for(var Da in Q)pa[Da]=Q[Da];pa.data=y;pa.width=I;pa.height=T;Da={};if(ka&&typeof ka===M)for(var Ba in ka)Da[Ba]=ka[Ba];if(H&&typeof H===M)for(var sa in H)if(typeof Da.flashvars!=L)Da.flashvars+="&"+sa+"="+H[sa];else Da.flashvars=sa+"="+H[sa];if(x(X)){Ba=F(pa,Da,G);pa.id==G&&J(G,true);Ga.success=true;Ga.ref=Ba}else if(ba&&p()){pa.data=ba;w(pa,Da,G,Ca);return}else J(G,true);Ca&&Ca(Ga)})}else Ca&&Ca(Ga)},switchOffAutoHideShow:function(){xa=false},ua:Y,getFlashPlayerVersion:function(){return{major:Y.pv[0],
minor:Y.pv[1],release:Y.pv[2]}},hasFlashPlayerVersion:x,createSWF:function(y,G,I){if(Y.w3)return F(y,G,I)},showExpressInstall:function(y,G,I,T){Y.w3&&p()&&w(y,G,I,T)},removeSWF:function(y){Y.w3&&z(y)},createCSS:function(y,G,I,T){Y.w3&&C(y,G,I,T)},addDomLoadEvent:e,addLoadEvent:i,getQueryParamValue:function(y){var G=R.location.search||R.location.hash;if(G){if(/\?/.test(G))G=G.split("?")[1];if(y==null)return B(G);G=G.split("&");for(var I=0;I<G.length;I++)if(G[I].substring(0,G[I].indexOf("="))==y)return B(G[I].substring(G[I].indexOf("=")+
1))}return""},expressInstallCallback:function(){if(Ka){var y=A(ga);if(y&&La){y.parentNode.replaceChild(La,y);if(N){J(N,true);if(Y.ie&&Y.win)La.style.display="block"}ea&&ea(ia)}Ka=false}}}}();
Raphael=function(){function c(){if(c.is(arguments[0],Ba)){for(var a=arguments[0],b=Za[qa](c,a.splice(0,3+c.is(a[0],pa))),f=b.set(),j=0,l=a[H];j<l;j++){var g=a[j]||{};La.test(g.type)&&f[oa](b[g.type]().attr(g))}return f}return Za[qa](c,arguments)}function e(){}function i(a){if(c.vml){var b=/^\s+|\s+$/g;i=h(function(j){var l;j=(j+y)[ta](b,y);try{var g=new za.ActiveXObject("htmlfile");g.write("<body>");g.close();l=g.body}catch(n){l=za.createPopup().document.body}g=l.createTextRange();try{l.style.color=
j;var o=g.queryCommandValue("ForeColor");o=(o&255)<<16|o&65280|(o&16711680)>>>16;return"#"+("000000"+o[sa](16)).slice(-6)}catch(s){return"none"}})}else{var f=ia.createElement("i");f.title="Rapha\u00ebl Colour Picker";f.style.display="none";ia.body[Z](f);i=h(function(j){f.style.color=j;return ia.defaultView.getComputedStyle(f,y).getPropertyValue("color")})}return i(a)}function q(){return"hsb("+[this.h,this.s,this.b]+")"}function m(){return this.hex}function h(a,b,f){function j(){var l=Array[N].slice.call(arguments,
0),g=l[ba]("\u25ba"),n=j.cache=j.cache||{},o=j.count=j.count||[];if(n[ea](g))return f?f(n[g]):n[g];o[H]>=1E3&&delete n[o.shift()];o[oa](g);n[g]=a[qa](b,l);return f?f(n[g]):n[g]}return j}function p(a){var b=[];if(!c.is(a,Ba)||!c.is(a&&a[0],Ba))a=c.parsePathString(a);for(var f=0,j=a[H];f<j;f++){b[f]=[];for(var l=0,g=a[f][H];l<g;l++)b[f][l]=a[f][l]}b[sa]=c._path2string;return b}function w(a,b,f,j,l,g){var n=1/3,o=2/3;return[n*a+o*f,n*b+o*j,n*l+o*f,n*g+o*j,l,g]}function k(a,b,f,j,l,g,n,o,s,v){var E=Q.PI,
K=E*120/180,P=E/180*(+l||0),O=[],D,U=h(function(ya,Ja,Sa){var sb=ya*Q.cos(Sa)-Ja*Q.sin(Sa);ya=ya*Q.sin(Sa)+Ja*Q.cos(Sa);return{x:sb,y:ya}});if(v){da=v[0];D=v[1];g=v[2];ja=v[3]}else{D=U(a,b,-P);a=D.x;b=D.y;D=U(o,s,-P);o=D.x;s=D.y;Q.cos(E/180*l);Q.sin(E/180*l);D=(a-o)/2;da=(b-s)/2;ja=D*D/(f*f)+da*da/(j*j);if(ja>1){ja=Q.sqrt(ja);f=ja*f;j=ja*j}ja=f*f;var Aa=j*j;ja=(g==n?-1:1)*Q.sqrt(Q.abs((ja*Aa-ja*da*da-Aa*D*D)/(ja*da*da+Aa*D*D)));g=ja*f*da/j+(a+o)/2;var ja=ja*-j*D/f+(b+s)/2,da=Q.asin(((b-ja)/j).toFixed(7));
D=Q.asin(((s-ja)/j).toFixed(7));da=a<g?E-da:da;D=o<g?E-D:D;da<0&&(da=E*2+da);D<0&&(D=E*2+D);if(n&&da>D)da-=E*2;if(!n&&D>da)D-=E*2}E=D-da;if(Q.abs(E)>K){O=D;E=o;Aa=s;D=da+K*(n&&D>da?1:-1);o=g+f*Q.cos(D);s=ja+j*Q.sin(D);O=k(o,s,f,j,l,0,n,E,Aa,[D,O,g,ja])}E=D-da;l=Q.cos(da);g=Q.sin(da);n=Q.cos(D);D=Q.sin(D);E=Q.tan(E/4);f=4/3*f*E;E=4/3*j*E;j=[a,b];a=[a+f*g,b-E*l];b=[o+f*D,s-E*n];o=[o,s];a[0]=2*j[0]-a[0];a[1]=2*j[1]-a[1];if(v)return[a,b,o][xa](O);else{O=[a,b,o][xa](O)[ba]()[I](",");v=[];o=0;for(s=O[H];o<
s;o++)v[o]=o%2?U(O[o-1],O[o],P).y:U(O[o],O[o+1],P).x;return v}}function t(a,b,f,j,l,g,n,o,s){var v=1-s;return{x:ma(v,3)*a+ma(v,2)*3*s*f+v*3*s*s*l+ma(s,3)*n,y:ma(v,3)*b+ma(v,2)*3*s*j+v*3*s*s*g+ma(s,3)*o}}function F(a,b,f,j){if(c.is(a,Da)||c.is(a,"object")){a=c.is(a,Da)?ia.getElementById(a):a;if(a.tagName)return b==null?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,width:b,height:f}}else return{container:1,x:a,y:b,width:f,height:j}}function z(a,
b){var f=this;for(var j in b)if(b[ea](j)&&!(j in a))switch(typeof b[j]){case "function":(function(l){a[j]=a===f?l:function(){return l[qa](f,arguments)}})(b[j]);break;case "object":a[j]=a[j]||{};z.call(this,a[j],b[j]);break;default:a[j]=b[j];break}}function A(a,b){a==b.top&&(b.top=a.prev);a==b.bottom&&(b.bottom=a.next);a.next&&(a.next.prev=a.prev);a.prev&&(a.prev.next=a.next)}function u(a,b){if(b.top!==a){A(a,b);a.next=null;a.prev=b.top;b.top.next=a;b.top=a}}function x(a,b){if(b.bottom!==a){A(a,b);
a.next=b.bottom;a.prev=null;b.bottom.prev=a;b.bottom=a}}function C(a,b,f){A(a,f);b==f.top&&(f.top=a);b.next&&(b.next.prev=a);a.next=b.next;a.prev=b;b.next=a}function J(a,b,f){A(a,f);b==f.bottom&&(f.bottom=a);b.prev&&(b.prev.next=a);a.prev=b.prev;b.prev=a;a.next=b}function B(a){return function(){throw Error("Rapha\u00ebl: you are calling to method \u201c"+a+"\u201d of removed object");}}function L(){this.returnValue=false}function M(){return this.originalEvent.preventDefault()}function S(){this.cancelBubble=
true}function ga(){return this.originalEvent.stopPropagation()}function ca(){return this.x+G+this.y}function R(a,b){return function(f,j,l){f=Ta(f);for(var g,n,o,s,v="",E={},K=0,P=0,O=f.length;P<O;P++){o=f[P];if(o[0]=="M"){g=+o[1];n=+o[2]}else{s=tb(g,n,o[1],o[2],o[3],o[4],o[5],o[6]);if(K+s>j){if(b&&!E.start){g=db(g,n,o[1],o[2],o[3],o[4],o[5],o[6],j-K);v+=["C",g.start.x,g.start.y,g.m.x,g.m.y,g.x,g.y];if(l)return v;E.start=v;v=["M",g.x,g.y+"C",g.n.x,g.n.y,g.end.x,g.end.y,o[5],o[6]][ba]();K+=s;g=+o[5];
n=+o[6];continue}if(!a&&!b){g=db(g,n,o[1],o[2],o[3],o[4],o[5],o[6],j-K);return{x:g.x,y:g.y,alpha:g.alpha}}}K+=s;g=+o[5];n=+o[6]}v+=o}E.end=v;g=a?K:b?E:c.findDotsAtSegment(g,n,o[1],o[2],o[3],o[4],o[5],o[6],1);g.alpha&&(g={x:g.x,y:g.y,alpha:g.alpha});return g}}function ha(){var a=+new Date;for(var b in Fa)if(b!="length"&&Fa[ea](b)){var f=Fa[b];if(f.stop||f.el.removed){delete Fa[b];Fa[H]--}else{var j=a-f.start,l=f.ms,g=f.easing,n=f.from,o=f.diff,s=f.to,v=f.t,E=f.prev||0,K=f.el,P=f.callback,O={},D;if(j<
l){P=c.easing_formulas[g]?c.easing_formulas[g](j/l):j/l;for(var U in n)if(n[ea](U)){switch($a[U]){case "along":D=P*l*o[U];s.back&&(D=s.len-D);g=Ua(s[U],D);K.translate(o.sx-o.x||0,o.sy-o.y||0);o.x=g.x;o.y=g.y;K.translate(g.x-o.sx,g.y-o.sy);s.rot&&K.rotate(o.r+g.alpha,g.x,g.y);break;case pa:D=+n[U]+P*l*o[U];break;case "colour":D="rgb("+[na(ra(n[U].r+P*l*o[U].r)),na(ra(n[U].g+P*l*o[U].g)),na(ra(n[U].b+P*l*o[U].b))][ba](",")+")";break;case "path":D=[];g=0;for(var Aa=n[U][H];g<Aa;g++){D[g]=[n[U][g][0]];
for(var ja=1,da=n[U][g][H];ja<da;ja++)D[g][ja]=+n[U][g][ja]+P*l*o[U][g][ja];D[g]=D[g][ba](G)}D=D[ba](G);break;case "csv":switch(U){case "translation":D=o[U][0]*(j-E);g=o[U][1]*(j-E);v.x+=D;v.y+=g;D=D+G+g;break;case "rotation":D=+n[U][0]+P*l*o[U][0];n[U][1]&&(D+=","+n[U][1]+","+n[U][2]);break;case "scale":D=[+n[U][0]+P*l*o[U][0],+n[U][1]+P*l*o[U][1],2 in s[U]?s[U][2]:y,3 in s[U]?s[U][3]:y][ba](G);break;case "clip-rect":D=[];for(g=4;g--;)D[g]=+n[U][g]+P*l*o[U][g];break}break}O[U]=D}K.attr(O);K._run&&
K._run.call(K)}else{if(s.along){g=Ua(s.along,s.len*!s.back);K.translate(o.sx-(o.x||0)+g.x-o.sx,o.sy-(o.y||0)+g.y-o.sy);s.rot&&K.rotate(o.r+g.alpha,g.x,g.y)}(v.x||v.y)&&K.translate(-v.x,-v.y);s.scale&&(s.scale+=y);K.attr(s);delete Fa[b];Fa[H]--;K.in_animation=null;c.is(P,"function")&&P.call(K)}f.prev=j}}c.svg&&K&&K.paper&&K.paper.safari();Fa[H]&&za.setTimeout(ha)}function na(a){return Ca(Ga(a,255),0)}function va(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:ca};this._.tx+=+a;this._.ty+=+b;
switch(this.type){case "circle":case "ellipse":this.attr({cx:+a+this.attrs.cx,cy:+b+this.attrs.cy});break;case "rect":case "image":case "text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case "path":var f=eb(this.attrs.path);f[0][1]+=+a;f[0][2]+=+b;this.attr({path:f});break}return this}function ua(a){return function(b,f,j,l){var g={back:a};c.is(j,"function")?l=j:g.rot=j;b&&b.constructor==W&&(b=b.attrs.path);b&&(g.along=b);return this.animate(g,f,l)}}function wa(a){this.items=[];this[H]=
0;this.type="set";if(a)for(var b=0,f=a[H];b<f;b++)if(a[b]&&(a[b].constructor==W||a[b].constructor==wa)){this[this.items[H]]=this.items[this.items[H]]=a[b];this[H]++}}c.version="1.4.3";var la=/[, ]+/,La=/^(circle|rect|path|ellipse|text|image)$/,N="prototype",ea="hasOwnProperty",ia=document,za=window,Ka={was:Object[N][ea].call(za,"Raphael"),is:za.Raphael},Z="appendChild",qa="apply",xa="concat",Y="createTouch"in ia,y="",G=" ",I="split",T="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[I](G),
X={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},ba="join",H="length",ka=String[N].toLowerCase,Q=Math,Ca=Q.max,Ga=Q.min,pa="number",Da="string",Ba="array",sa="toString",ub=Object[N][sa],ma=Q.pow,oa="push",Ma=/^(?=[\da-f]$)/,fb=/^url\(['"]?([^\)]+?)['"]?\)$/i,vb=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%))\s*\)|hs[bl]\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hs[bl]\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,
ra=Q.round,fa=parseFloat,Ia=parseInt,Va=String[N].toUpperCase,Wa={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,
target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},$a={along:"along",blur:pa,"clip-rect":"csv",cx:pa,cy:pa,fill:"colour","fill-opacity":pa,"font-size":pa,height:pa,opacity:pa,path:"path",r:pa,rotation:"csv",rx:pa,ry:pa,scale:"csv",stroke:"colour","stroke-opacity":pa,"stroke-width":pa,translation:"csv",width:pa,x:pa,y:pa},ta="replace";c.type=za.SVGAngle||ia.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(c.type==
"VML"){var Na=ia.createElement("div");Na.innerHTML="<!--[if vml]><br><br><![endif]--\>";if(Na.childNodes[H]!=2)return c.type=null;Na=null}c.svg=!(c.vml=c.type=="VML");e[N]=c[N];c._id=0;c._oid=0;c.fn={};c.is=function(a,b){b=ka.call(b);return b=="object"&&a===Object(a)||b=="undefined"&&typeof a==b||b=="null"&&a==null||ka.call(ub.call(a).slice(8,-1))==b};c.setWindow=function(a){za=a;ia=za.document};c.hsb2rgb=h(function(a,b,f){if(c.is(a,"object")&&"h"in a&&"s"in a&&"b"in a){f=a.b;b=a.s;a=a.h}var j;if(f==
0)return{r:0,g:0,b:0,hex:"#000"};if(a>1||b>1||f>1){a/=255;b/=255;f/=255}j=~~(a*6);a=a*6-j;var l=f*(1-b),g=f*(1-b*a),n=f*(1-b*(1-a));a=[f,g,l,l,n,f,f][j];b=[n,f,f,g,l,l,n][j];j=[l,l,n,f,f,g,l][j];a*=255;b*=255;j*=255;f={r:a,g:b,b:j,toString:m};a=(~~a)[sa](16);b=(~~b)[sa](16);j=(~~j)[sa](16);a=a[ta](Ma,"0");b=b[ta](Ma,"0");j=j[ta](Ma,"0");f.hex="#"+a+b+j;return f},c);c.rgb2hsb=h(function(a,b,f){if(c.is(a,"object")&&"r"in a&&"g"in a&&"b"in a){f=a.b;b=a.g;a=a.r}if(c.is(a,Da)){var j=c.getRGB(a);a=j.r;
b=j.g;f=j.b}if(a>1||b>1||f>1){a/=255;b/=255;f/=255}var l=Ca(a,b,f),g=Ga(a,b,f);j=l;if(g==l)return{h:0,s:0,b:l};else{var n=l-g;g=n/l;a=a==l?(b-f)/n:b==l?2+(f-a)/n:4+(a-b)/n;a/=6;a<0&&a++;a>1&&a--}return{h:a,s:g,b:j,toString:q}},c);var wb=/,?([achlmqrstvxz]),?/gi,Xa=/\s*,\s*/,xb={hs:1,rg:1};c._path2string=function(){return this.join(",")[ta](wb,"$1")};c.getRGB=h(function(a){if(!a||(a+=y).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1};if(a=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(xb[ea](a.substring(0,
2))||a.charAt()=="#")&&(a=i(a));var b,f,j,l,g;if(a=a.match(vb)){if(a[2]){j=Ia(a[2].substring(5),16);f=Ia(a[2].substring(3,5),16);b=Ia(a[2].substring(1,3),16)}if(a[3]){j=Ia((g=a[3].charAt(3))+g,16);f=Ia((g=a[3].charAt(2))+g,16);b=Ia((g=a[3].charAt(1))+g,16)}if(a[4]){a=a[4][I](Xa);b=fa(a[0]);f=fa(a[1]);j=fa(a[2]);l=fa(a[3])}if(a[5]){a=a[5][I](Xa);b=fa(a[0])*2.55;f=fa(a[1])*2.55;j=fa(a[2])*2.55;l=fa(a[3])}if(a[6]){a=a[6][I](Xa);b=fa(a[0]);f=fa(a[1]);j=fa(a[2]);return c.hsb2rgb(b,f,j)}if(a[7]){a=a[7][I](Xa);
b=fa(a[0])*2.55;f=fa(a[1])*2.55;j=fa(a[2])*2.55;return c.hsb2rgb(b,f,j)}a={r:b,g:f,b:j};b=(~~b)[sa](16);f=(~~f)[sa](16);j=(~~j)[sa](16);b=b[ta](Ma,"0");f=f[ta](Ma,"0");j=j[ta](Ma,"0");a.hex="#"+b+f+j;isFinite(fa(l))&&(a.o=l);return a}return{r:-1,g:-1,b:-1,hex:"none",error:1}},c);c.getColor=function(a){a=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75};var b=this.hsb2rgb(a.h,a.s,a.b);a.h+=0.075;if(a.h>1){a.h=0;a.s-=0.2;a.s<=0&&(this.getColor.start={h:0,s:1,b:a.b})}return b.hex};c.getColor.reset=
function(){delete this.start};var yb=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,zb=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig;c.parsePathString=h(function(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},f=[];if(c.is(a,Ba)&&c.is(a[0],Ba))f=p(a);f[H]||(a+y)[ta](yb,function(j,l,g){var n=[];j=ka.call(l);g[ta](zb,function(o,s){s&&n[oa](+s)});if(j=="m"&&n[H]>2){f[oa]([l][xa](n.splice(0,2)));j="l";l=l=="m"?"l":"L"}for(;n[H]>=b[j];){f[oa]([l][xa](n.splice(0,b[j])));if(!b[j])break}});
f[sa]=c._path2string;return f});c.findDotsAtSegment=function(a,b,f,j,l,g,n,o,s){var v=1-s,E=ma(v,3)*a+ma(v,2)*3*s*f+v*3*s*s*l+ma(s,3)*n;v=ma(v,3)*b+ma(v,2)*3*s*j+v*3*s*s*g+ma(s,3)*o;var K=a+2*s*(f-a)+s*s*(l-2*f+a),P=b+2*s*(j-b)+s*s*(g-2*j+b),O=f+2*s*(l-f)+s*s*(n-2*l+f),D=j+2*s*(g-j)+s*s*(o-2*g+j);a=(1-s)*a+s*f;b=(1-s)*b+s*j;l=(1-s)*l+s*n;g=(1-s)*g+s*o;o=90-Q.atan((K-O)/(P-D))*180/Q.PI;(K>O||P<D)&&(o+=180);return{x:E,y:v,m:{x:K,y:P},n:{x:O,y:D},start:{x:a,y:b},end:{x:l,y:g},alpha:o}};var Ya=h(function(a){if(!a)return{x:0,
y:0,width:0,height:0};a=Ta(a);for(var b=0,f=0,j=[],l=[],g,n=0,o=a[H];n<o;n++){g=a[n];if(g[0]=="M"){b=g[1];f=g[2];j[oa](b);l[oa](f)}else{b=Ab(b,f,g[1],g[2],g[3],g[4],g[5],g[6]);j=j[xa](b.min.x,b.max.x);l=l[xa](b.min.y,b.max.y);b=g[5];f=g[6]}}a=Ga[qa](0,j);g=Ga[qa](0,l);return{x:a,y:g,width:Ca[qa](0,j)-a,height:Ca[qa](0,l)-g}}),eb=h(function(a){if(!c.is(a,Ba)||!c.is(a&&a[0],Ba))a=c.parsePathString(a);var b=[],f=0,j=0,l=0,g=0,n=0;if(a[0][0]=="M"){f=a[0][1];j=a[0][2];l=f;g=j;n++;b[oa](["M",f,j])}for(var o=
a[H];n<o;n++){var s=b[n]=[],v=a[n];if(v[0]!=ka.call(v[0])){s[0]=ka.call(v[0]);switch(s[0]){case "a":s[1]=v[1];s[2]=v[2];s[3]=v[3];s[4]=v[4];s[5]=v[5];s[6]=+(v[6]-f).toFixed(3);s[7]=+(v[7]-j).toFixed(3);break;case "v":s[1]=+(v[1]-j).toFixed(3);break;case "m":l=v[1];g=v[2];default:for(var E=1,K=v[H];E<K;E++)s[E]=+(v[E]-(E%2?f:j)).toFixed(3)}}else{b[n]=[];if(v[0]=="m"){l=v[1]+f;g=v[2]+j}s=0;for(E=v[H];s<E;s++)b[n][s]=v[s]}v=b[n][H];switch(b[n][0]){case "z":f=l;j=g;break;case "h":f+=+b[n][v-1];break;
case "v":j+=+b[n][v-1];break;default:f+=+b[n][v-2];j+=+b[n][v-1]}}b[sa]=c._path2string;return b},0,p),Oa=h(function(a){if(!c.is(a,Ba)||!c.is(a&&a[0],Ba))a=c.parsePathString(a);var b=[],f=0,j=0,l=0,g=0,n=0;if(a[0][0]=="M"){f=+a[0][1];j=+a[0][2];l=f;g=j;n++;b[0]=["M",f,j]}for(var o=a[H];n<o;n++){var s=b[n]=[],v=a[n];if(v[0]!=Va.call(v[0])){s[0]=Va.call(v[0]);switch(s[0]){case "A":s[1]=v[1];s[2]=v[2];s[3]=v[3];s[4]=v[4];s[5]=v[5];s[6]=+(v[6]+f);s[7]=+(v[7]+j);break;case "V":s[1]=+v[1]+j;break;case "H":s[1]=
+v[1]+f;break;case "M":l=+v[1]+f;g=+v[2]+j;default:for(var E=1,K=v[H];E<K;E++)s[E]=+v[E]+(E%2?f:j)}}else{E=0;for(K=v[H];E<K;E++)b[n][E]=v[E]}switch(s[0]){case "Z":f=l;j=g;break;case "H":f=s[1];break;case "V":j=s[1];break;default:f=b[n][b[n][H]-2];j=b[n][b[n][H]-1]}}b[sa]=c._path2string;return b},null,p),Ab=h(function(a,b,f,j,l,g,n,o){var s=l-2*f+a-(n-2*l+f),v=2*(f-a)-2*(l-f),E=a-f,K=(-v+Q.sqrt(v*v-4*s*E))/2/s;s=(-v-Q.sqrt(v*v-4*s*E))/2/s;var P=[b,o],O=[a,n];Q.abs(K)>1E12&&(K=0.5);Q.abs(s)>1E12&&(s=
0.5);if(K>0&&K<1){K=t(a,b,f,j,l,g,n,o,K);O[oa](K.x);P[oa](K.y)}if(s>0&&s<1){K=t(a,b,f,j,l,g,n,o,s);O[oa](K.x);P[oa](K.y)}s=g-2*j+b-(o-2*g+j);v=2*(j-b)-2*(g-j);E=b-j;K=(-v+Q.sqrt(v*v-4*s*E))/2/s;s=(-v-Q.sqrt(v*v-4*s*E))/2/s;Q.abs(K)>1E12&&(K=0.5);Q.abs(s)>1E12&&(s=0.5);if(K>0&&K<1){K=t(a,b,f,j,l,g,n,o,K);O[oa](K.x);P[oa](K.y)}if(s>0&&s<1){K=t(a,b,f,j,l,g,n,o,s);O[oa](K.x);P[oa](K.y)}return{min:{x:Ga[qa](0,O),y:Ga[qa](0,P)},max:{x:Ca[qa](0,O),y:Ca[qa](0,P)}}}),Ta=h(function(a,b){function f(O,D){var U;
if(!O)return["C",D.x,D.y,D.x,D.y,D.x,D.y];!(O[0]in{T:1,Q:1})&&(D.qx=D.qy=null);switch(O[0]){case "M":D.X=O[1];D.Y=O[2];break;case "A":O=["C"][xa](k[qa](0,[D.x,D.y][xa](O.slice(1))));break;case "S":U=D.x+(D.x-(D.bx||D.x));D=D.y+(D.y-(D.by||D.y));O=["C",U,D][xa](O.slice(1));break;case "T":D.qx=D.x+(D.x-(D.qx||D.x));D.qy=D.y+(D.y-(D.qy||D.y));O=["C"][xa](w(D.x,D.y,D.qx,D.qy,O[1],O[2]));break;case "Q":D.qx=O[1];D.qy=O[2];O=["C"][xa](w(D.x,D.y,O[1],O[2],O[3],O[4]));break;case "L":O=["C"][xa]([D.x,D.y,
O[1],O[2],O[1],O[2]]);break;case "H":O=["C"][xa]([D.x,D.y,O[1],D.y,O[1],D.y]);break;case "V":O=["C"][xa]([D.x,D.y,D.x,O[1],D.x,O[1]]);break;case "Z":O=["C"][xa]([D.x,D.y,D.X,D.Y,D.X,D.Y]);break}return O}function j(O,D){if(O[D][H]>7){O[D].shift();for(var U=O[D];U[H];)O.splice(D++,0,["C"][xa](U.splice(0,6)));O.splice(D,1);s=Ca(g[H],n&&n[H]||0)}}function l(O,D,U,Aa,ja){if(O&&D&&O[ja][0]=="M"&&D[ja][0]!="M"){D.splice(ja,0,["M",Aa.x,Aa.y]);U.bx=0;U.by=0;U.x=O[ja][1];U.y=O[ja][2];s=Ca(g[H],n&&n[H]||0)}}
var g=Oa(a),n=b&&Oa(b);a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};b={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};for(var o=0,s=Ca(g[H],n&&n[H]||0);o<s;o++){g[o]=f(g[o],a);j(g,o);n&&(n[o]=f(n[o],b));n&&j(n,o);l(g,n,a,b,o);l(n,g,b,a,o);var v=g[o],E=n&&n[o],K=v[H],P=n&&E[H];a.x=v[K-2];a.y=v[K-1];a.bx=fa(v[K-4])||a.x;a.by=fa(v[K-3])||a.y;b.bx=n&&(fa(E[P-4])||b.x);b.by=n&&(fa(E[P-3])||b.y);b.x=n&&E[P-2];b.y=n&&E[P-1]}return n?[g,n]:g},null,p),gb=h(function(a){for(var b=[],f=0,j=a[H];f<j;f++){var l={},
g=a[f].match(/^([^:]*):?([\d\.]*)/);l.color=c.getRGB(g[1]);if(l.color.error)return null;l.color=l.color.hex;g[2]&&(l.offset=g[2]+"%");b[oa](l)}f=1;for(j=b[H]-1;f<j;f++)if(!b[f].offset){a=fa(b[f-1].offset||0);g=0;for(l=f+1;l<j;l++)if(b[l].offset){g=b[l].offset;break}if(!g){g=100;l=j}g=fa(g);for(g=(g-a)/(l-f+1);f<l;f++){a+=g;b[f].offset=a+"%"}}return b}),hb=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;if(c.svg){e[N].svgns="http://www.w3.org/2000/svg";e[N].xlink="http://www.w3.org/1999/xlink";ra=function(a){return+a+
(~~a===a)*0.5};var aa=function(a,b){if(b)for(var f in b)b[ea](f)&&a.setAttribute(f,b[f]+y);else{a=ia.createElementNS(e[N].svgns,a);a.style.webkitTapHighlightColor="rgba(0,0,0,0)";return a}};c[sa]=function(){return"Your browser supports SVG.\nYou are running Rapha\u00ebl "+this.version};var ib=function(a,b){var f=aa("path");b.canvas&&b.canvas[Z](f);b=new W(f,b);b.type="path";Ha(b,{fill:"none",stroke:"#000",path:a});return b},Pa=function(a,b,f){var j="linear",l=0.5,g=0.5,n=a.style;b=(b+y)[ta](hb,function(E,
K,P){j="radial";if(K&&P){l=fa(K);g=fa(P);E=(g>0.5)*2-1;ma(l-0.5,2)+ma(g-0.5,2)>0.25&&(g=Q.sqrt(0.25-ma(l-0.5,2))*E+0.5)&&g!=0.5&&(g=g.toFixed(5)-1.0E-5*E)}return y});b=b[I](/\s*\-\s*/);if(j=="linear"){var o=b.shift();o=-fa(o);if(isNaN(o))return null;o=[0,0,Q.cos(o*Q.PI/180),Q.sin(o*Q.PI/180)];var s=1/(Ca(Q.abs(o[2]),Q.abs(o[3]))||1);o[2]*=s;o[3]*=s;if(o[2]<0){o[0]=-o[2];o[2]=0}if(o[3]<0){o[1]=-o[3];o[3]=0}}b=gb(b);if(!b)return null;s=a.getAttribute("fill");(s=s.match(/^url\(#(.*)\)$/))&&f.defs.removeChild(ia.getElementById(s[1]));
s=aa(j+"Gradient");s.id="r"+(c._id++)[sa](36);aa(s,j=="radial"?{fx:l,fy:g}:{x1:o[0],y1:o[1],x2:o[2],y2:o[3]});f.defs[Z](s);f=0;for(o=b[H];f<o;f++){var v=aa("stop");aa(v,{offset:b[f].offset?b[f].offset:!f?"0%":"100%","stop-color":b[f].color||"#fff"});s[Z](v)}aa(a,{fill:"url(#"+s.id+")",opacity:1,"fill-opacity":1});n.fill=y;n.opacity=1;return n.fillOpacity=1},ab=function(a){var b=a.getBBox();aa(a.pattern,{patternTransform:c.format("translate({0},{1})",b.x,b.y)})},Ha=function(a,b){function f(D,U){if(U=
j[ka.call(U)]){var Aa=D.attrs["stroke-width"]||"1";D={round:Aa,square:Aa,butt:0}[D.attrs["stroke-linecap"]||b["stroke-linecap"]]||0;for(var ja=[],da=U[H];da--;)ja[da]=U[da]*Aa+(da%2?1:-1)*D;aa(l,{"stroke-dasharray":ja[ba](",")})}}var j={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},l=a.node,g=a.attrs,n=a.rotate();b[ea]("rotation")&&(n=b.rotation);var o=(n+y)[I](la);if(o.length-1){o[1]=+o[1];
o[2]=+o[2]}else o=null;fa(n)&&a.rotate(0,true);for(var s in b)if(b[ea](s))if(Wa[ea](s)){var v=b[s];g[s]=v;switch(s){case "blur":a.blur(v);break;case "rotation":a.rotate(v,true);break;case "href":case "title":case "target":var E=l.parentNode;if(ka.call(E.tagName)!="a"){var K=aa("a");E.insertBefore(K,l);K[Z](l);E=K}E.setAttributeNS(a.paper.xlink,s,v);break;case "cursor":l.style.cursor=v;break;case "clip-rect":E=(v+y)[I](la);if(E[H]==4){a.clip&&a.clip.parentNode.parentNode.removeChild(a.clip.parentNode);
var P=aa("clipPath");K=aa("rect");P.id="r"+(c._id++)[sa](36);aa(K,{x:E[0],y:E[1],width:E[2],height:E[3]});P[Z](K);a.paper.defs[Z](P);aa(l,{"clip-path":"url(#"+P.id+")"});a.clip=K}if(!v){(v=ia.getElementById(l.getAttribute("clip-path")[ta](/(^url\(#|\)$)/g,y)))&&v.parentNode.removeChild(v);aa(l,{"clip-path":y});delete a.clip}break;case "path":if(a.type=="path")aa(l,{d:v?g.path=Oa(v):"M0,0"});break;case "width":l.setAttribute(s,v);if(g.fx){s="x";v=g.x}else break;case "x":if(g.fx)v=-g.x-(g.width||0);
case "rx":if(s=="rx"&&a.type=="rect")break;case "cx":o&&(s=="x"||s=="cx")&&(o[1]+=v-g[s]);l.setAttribute(s,ra(v));a.pattern&&ab(a);break;case "height":l.setAttribute(s,v);if(g.fy){s="y";v=g.y}else break;case "y":if(g.fy)v=-g.y-(g.height||0);case "ry":if(s=="ry"&&a.type=="rect")break;case "cy":o&&(s=="y"||s=="cy")&&(o[2]+=v-g[s]);l.setAttribute(s,ra(v));a.pattern&&ab(a);break;case "r":a.type=="rect"?aa(l,{rx:v,ry:v}):l.setAttribute(s,v);break;case "src":a.type=="image"&&l.setAttributeNS(a.paper.xlink,
"href",v);break;case "stroke-width":l.style.strokeWidth=v;l.setAttribute(s,v);g["stroke-dasharray"]&&f(a,g["stroke-dasharray"]);break;case "stroke-dasharray":f(a,v);break;case "translation":v=(v+y)[I](la);v[0]=+v[0]||0;v[1]=+v[1]||0;if(o){o[1]+=v[0];o[2]+=v[1]}va.call(a,v[0],v[1]);break;case "scale":v=(v+y)[I](la);a.scale(+v[0]||1,+v[1]||+v[0]||1,isNaN(fa(v[2]))?null:+v[2],isNaN(fa(v[3]))?null:+v[3]);break;case "fill":if(E=(v+y).match(fb)){P=aa("pattern");var O=aa("image");P.id="r"+(c._id++)[sa](36);
aa(P,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});aa(O,{x:0,y:0});O.setAttributeNS(a.paper.xlink,"href",E[1]);P[Z](O);v=ia.createElement("img");v.style.cssText="position:absolute;left:-9999em;top-9999em";v.onload=function(){aa(P,{width:this.offsetWidth,height:this.offsetHeight});aa(O,{width:this.offsetWidth,height:this.offsetHeight});ia.body.removeChild(this);a.paper.safari()};ia.body[Z](v);v.src=E[1];a.paper.defs[Z](P);l.style.fill="url(#"+P.id+")";aa(l,{fill:"url(#"+P.id+")"});a.pattern=
P;a.pattern&&ab(a);break}E=c.getRGB(v);if(E.error){if(({circle:1,ellipse:1}[ea](a.type)||(v+y).charAt()!="r")&&Pa(l,v,a.paper)){g.gradient=v;g.fill="none";break}}else{delete b.gradient;delete g.gradient;!c.is(g.opacity,"undefined")&&c.is(b.opacity,"undefined")&&aa(l,{opacity:g.opacity});!c.is(g["fill-opacity"],"undefined")&&c.is(b["fill-opacity"],"undefined")&&aa(l,{"fill-opacity":g["fill-opacity"]})}E[ea]("o")&&aa(l,{"fill-opacity":E.o/100});case "stroke":E=c.getRGB(v);l.setAttribute(s,E.hex);s==
"stroke"&&E[ea]("o")&&aa(l,{"stroke-opacity":E.o/100});break;case "gradient":(({circle:1,ellipse:1})[ea](a.type)||(v+y).charAt()!="r")&&Pa(l,v,a.paper);break;case "opacity":case "fill-opacity":if(g.gradient){if(E=ia.getElementById(l.getAttribute("fill")[ta](/^url\(#|\)$/g,y))){E=E.getElementsByTagName("stop");E[E[H]-1].setAttribute("stop-opacity",v)}break}default:s=="font-size"&&(v=Ia(v,10)+"px");E=s[ta](/(\-.)/g,function(D){return Va.call(D.substring(1))});l.style[E]=v;l.setAttribute(s,v);break}}Bb(a,
b);if(o)a.rotate(o.join(G));else fa(n)&&a.rotate(n,true)},Bb=function(a,b){if(!(a.type!="text"||!(b[ea]("text")||b[ea]("font")||b[ea]("font-size")||b[ea]("x")||b[ea]("y")))){var f=a.attrs,j=a.node,l=j.firstChild?Ia(ia.defaultView.getComputedStyle(j.firstChild,y).getPropertyValue("font-size"),10):10;if(b[ea]("text")){for(f.text=b.text;j.firstChild;)j.removeChild(j.firstChild);b=(b.text+y)[I]("\n");for(var g=0,n=b[H];g<n;g++)if(b[g]){var o=aa("tspan");g&&aa(o,{dy:l*1.2,x:f.x});o[Z](ia.createTextNode(b[g]));
j[Z](o)}}else{b=j.getElementsByTagName("tspan");g=0;for(n=b[H];g<n;g++)g&&aa(b[g],{dy:l*1.2,x:f.x})}aa(j,{y:f.y});a=a.getBBox();(a=f.y-(a.y+a.height/2))&&isFinite(a)&&aa(j,{y:f.y+a})}},W=function(a,b){this[0]=a;this.id=c._oid++;this.node=a;a.raphael=this;this.paper=b;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);(this.prev=b.top)&&(b.top.next=this);b.top=this;this.next=null};W[N].rotate=function(a,b,f){if(this.removed)return this;
if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][ba](G);return this._.rt.deg}var j=this.getBBox();a=(a+y)[I](la);if(a[H]-1){b=fa(a[1]);f=fa(a[2])}a=fa(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;f==null&&(b=null);this._.rt.cx=b;this._.rt.cy=f;b=b==null?j.x+j.width/2:b;f=f==null?j.y+j.height/2:f;if(this._.rt.deg){this.transformations[0]=c.format("rotate({0} {1} {2})",this._.rt.deg,b,f);this.clip&&aa(this.clip,{transform:c.format("rotate({0} {1} {2})",-this._.rt.deg,
b,f)})}else{this.transformations[0]=y;this.clip&&aa(this.clip,{transform:y})}aa(this.node,{transform:this.transformations[ba](G)});return this};W[N].hide=function(){!this.removed&&(this.node.style.display="none");return this};W[N].show=function(){!this.removed&&(this.node.style.display="");return this};W[N].remove=function(){if(!this.removed){A(this,this.paper);this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=true}};W[N].getBBox=function(){if(this.removed)return this;
if(this.type=="path")return Ya(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=true}var b={};try{b=this.node.getBBox()}catch(f){}finally{b=b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var j=0,l=this.node.getNumberOfChars();j<l;j++){var g=this.node.getExtentOfChar(j);g.y<b.y&&(b.y=g.y);g.y+g.height-b.y>b.height&&(b.height=g.y+g.height-b.y);g.x+g.width-b.x>b.width&&(b.width=g.x+g.width-b.x)}}a&&this.hide();return b};W[N].attr=function(a,b){if(this.removed)return this;
if(a==null){a={};for(var f in this.attrs)if(this.attrs[ea](f))a[f]=this.attrs[f];this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&c.is(a,Da)){if(a=="translation")return va.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(b==
null&&c.is(a,Ba)){b={};f=0;for(var j=a.length;f<j;f++)b[a[f]]=this.attr(a[f]);return b}if(b!=null){f={};f[a]=b;Ha(this,f)}else a!=null&&c.is(a,"object")&&Ha(this,a);return this};W[N].toFront=function(){if(this.removed)return this;this.node.parentNode[Z](this.node);var a=this.paper;a.top!=this&&u(this,a);return this};W[N].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);x(this,this.paper)}return this};
W[N].insertAfter=function(a){if(this.removed)return this;var b=a.node;b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode[Z](this.node);C(this,a,this.paper);return this};W[N].insertBefore=function(a){if(this.removed)return this;var b=a.node;b.parentNode.insertBefore(this.node,b);J(this,a,this.paper);return this};W[N].blur=function(a){if(+a!==0){var b=aa("filter"),f=aa("feGaussianBlur");this.attrs.blur=a;b.id="r"+(c._id++)[sa](36);aa(f,{stdDeviation:+a||1.5});b.appendChild(f);
this.paper.defs.appendChild(b);this._blur=b;aa(this.node,{filter:"url(#"+b.id+")"})}else{if(this._blur){this._blur.parentNode.removeChild(this._blur);delete this._blur;delete this.attrs.blur}this.node.removeAttribute("filter")}};var jb=function(a,b,f,j){b=ra(b);f=ra(f);var l=aa("circle");a.canvas&&a.canvas[Z](l);a=new W(l,a);a.attrs={cx:b,cy:f,r:j,fill:"none",stroke:"#000"};a.type="circle";aa(l,a.attrs);return a},kb=function(a,b,f,j,l,g){b=ra(b);f=ra(f);var n=aa("rect");a.canvas&&a.canvas[Z](n);a=
new W(n,a);a.attrs={x:b,y:f,width:j,height:l,r:g||0,rx:g||0,ry:g||0,fill:"none",stroke:"#000"};a.type="rect";aa(n,a.attrs);return a},lb=function(a,b,f,j,l){b=ra(b);f=ra(f);var g=aa("ellipse");a.canvas&&a.canvas[Z](g);a=new W(g,a);a.attrs={cx:b,cy:f,rx:j,ry:l,fill:"none",stroke:"#000"};a.type="ellipse";aa(g,a.attrs);return a},mb=function(a,b,f,j,l,g){var n=aa("image");aa(n,{x:f,y:j,width:l,height:g,preserveAspectRatio:"none"});n.setAttributeNS(a.xlink,"href",b);a.canvas&&a.canvas[Z](n);a=new W(n,a);
a.attrs={x:f,y:j,width:l,height:g,src:b};a.type="image";return a},nb=function(a,b,f,j){var l=aa("text");aa(l,{x:b,y:f,"text-anchor":"middle"});a.canvas&&a.canvas[Z](l);a=new W(l,a);a.attrs={x:b,y:f,"text-anchor":"middle",text:j,font:Wa.font,stroke:"none",fill:"#000"};a.type="text";Ha(a,a.attrs);return a},ob=function(a,b){this.width=a||this.width;this.height=b||this.height;this.canvas.setAttribute("width",this.width);this.canvas.setAttribute("height",this.height);return this},Za=function(){var a=F[qa](0,
arguments),b=a&&a.container,f=a.x,j=a.y,l=a.width;a=a.height;if(!b)throw Error("SVG container not found.");var g=aa("svg");f=f||0;j=j||0;l=l||512;a=a||342;aa(g,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:l,height:a});if(b==1){g.style.cssText="position:absolute;left:"+f+"px;top:"+j+"px";ia.body[Z](g)}else b.firstChild?b.insertBefore(g,b.firstChild):b[Z](g);b=new e;b.width=l;b.height=a;b.canvas=g;z.call(b,b,c.fn);b.clear();return b};e[N].clear=function(){for(var a=this.canvas;a.firstChild;)a.removeChild(a.firstChild);
this.bottom=this.top=null;(this.desc=aa("desc"))[Z](ia.createTextNode("Created with Rapha\u00ebl"));a[Z](this.desc);a[Z](this.defs=aa("defs"))};e[N].remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=B(a)}}if(c.vml){var pb={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},Cb=/([clmz]),?([^clmz]*)/gi,Db=/-?[^,\s-]+/g,Qa=1E3+G+1E3,Ra={path:1,rect:1},Eb=function(a){var b=/[ahqstv]/ig,f=Oa;(a+y).match(b)&&(f=Ta);b=/[clmz]/g;if(f==Oa&&!(a+
y).match(b))return a=(a+y)[ta](Cb,function(s,v,E){var K=[],P=ka.call(v)=="m",O=pb[v];E[ta](Db,function(D){if(P&&K[H]==2){O+=K+pb[v=="m"?"l":"L"];K=[]}K[oa](ra(D*10))});return O+K});b=f(a);var j;a=[];for(var l=0,g=b[H];l<g;l++){f=b[l];j=ka.call(b[l][0]);j=="z"&&(j="x");for(var n=1,o=f[H];n<o;n++)j+=ra(f[n]*10)+(n!=o-1?",":y);a[oa](j)}return a[ba](G)};c[sa]=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+this.version};ib=function(a,b){var f=
Ea("group");f.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";f.coordsize=b.coordsize;f.coordorigin=b.coordorigin;var j=Ea("shape"),l=j.style;l.width=b.width+"px";l.height=b.height+"px";j.coordsize=Qa;j.coordorigin=b.coordorigin;f[Z](j);j=new W(j,f,b);l={fill:"none",stroke:"#000"};a&&(l.path=a);j.isAbsolute=true;j.type="path";j.path=[];j.Path=y;Ha(j,l);b.canvas[Z](f);return j};Ha=function(a,b){a.attrs=a.attrs||{};var f=a.node,j=a.attrs,l=f.style,g;g=(b.x!=
j.x||b.y!=j.y||b.width!=j.width||b.height!=j.height||b.r!=j.r)&&a.type=="rect";var n=a;for(var o in b)if(b[ea](o))j[o]=b[o];if(g){j.path=qb(j.x,j.y,j.width,j.height,j.r);a.X=j.x;a.Y=j.y;a.W=j.width;a.H=j.height}b.href&&(f.href=b.href);b.title&&(f.title=b.title);b.target&&(f.target=b.target);b.cursor&&(l.cursor=b.cursor);"blur"in b&&a.blur(b.blur);if(b.path&&a.type=="path"||g)f.path=Eb(j.path);b.rotation!=null&&a.rotate(b.rotation,true);if(b.translation){g=(b.translation+y)[I](la);va.call(a,g[0],g[1]);
if(a._.rt.cx!=null){a._.rt.cx+=+g[0];a._.rt.cy+=+g[1];a.setBox(a.attrs,g[0],g[1])}}if(b.scale){g=(b.scale+y)[I](la);a.scale(+g[0]||1,+g[1]||+g[0]||1,+g[2]||null,+g[3]||null)}if("clip-rect"in b){g=(b["clip-rect"]+y)[I](la);if(g[H]==4){g[2]=+g[2]+ +g[0];g[3]=+g[3]+ +g[1];o=f.clipRect||ia.createElement("div");var s=o.style,v=f.parentNode;s.clip=c.format("rect({1}px {2}px {3}px {0}px)",g);if(!f.clipRect){s.position="absolute";s.top=0;s.left=0;s.width=a.paper.width+"px";s.height=a.paper.height+"px";v.parentNode.insertBefore(o,
v);o[Z](v);f.clipRect=o}}if(!b["clip-rect"])f.clipRect&&(f.clipRect.style.clip=y)}if(a.type=="image"&&b.src)f.src=b.src;if(a.type=="image"&&b.opacity){f.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+b.opacity*100+")";l.filter=(f.filterMatrix||y)+(f.filterOpacity||y)}b.font&&(l.font=b.font);b["font-family"]&&(l.fontFamily='"'+b["font-family"][I](",")[0][ta](/^['"]+|['"]+$/g,y)+'"');b["font-size"]&&(l.fontSize=b["font-size"]);b["font-weight"]&&(l.fontWeight=b["font-weight"]);b["font-style"]&&
(l.fontStyle=b["font-style"]);if(b.opacity!=null||b["stroke-width"]!=null||b.fill!=null||b.stroke!=null||b["stroke-width"]!=null||b["stroke-opacity"]!=null||b["fill-opacity"]!=null||b["stroke-dasharray"]!=null||b["stroke-miterlimit"]!=null||b["stroke-linejoin"]!=null||b["stroke-linecap"]!=null){f=a.shape||f;l=f.getElementsByTagName("fill")&&f.getElementsByTagName("fill")[0];g=false;!l&&(g=l=Ea("fill"));if("fill-opacity"in b||"opacity"in b){a=((+j["fill-opacity"]+1||2)-1)*((+j.opacity+1||2)-1)*((+c.getRGB(b.fill).o+
1||2)-1);a<0&&(a=0);a>1&&(a=1);l.opacity=a}b.fill&&(l.on=true);if(l.on==null||b.fill=="none")l.on=false;if(l.on&&b.fill)if(a=b.fill.match(fb)){l.src=a[1];l.type="tile"}else{l.color=c.getRGB(b.fill).hex;l.src=y;l.type="solid";if(c.getRGB(b.fill).error&&(n.type in{circle:1,ellipse:1}||(b.fill+y).charAt()!="r")&&Pa(n,b.fill)){j.fill="none";j.gradient=b.fill}}g&&f[Z](l);l=f.getElementsByTagName("stroke")&&f.getElementsByTagName("stroke")[0];g=false;!l&&(g=l=Ea("stroke"));if(b.stroke&&b.stroke!="none"||
b["stroke-width"]||b["stroke-opacity"]!=null||b["stroke-dasharray"]||b["stroke-miterlimit"]||b["stroke-linejoin"]||b["stroke-linecap"])l.on=true;(b.stroke=="none"||l.on==null||b.stroke==0||b["stroke-width"]==0)&&(l.on=false);a=c.getRGB(b.stroke);l.on&&b.stroke&&(l.color=a.hex);a=((+j["stroke-opacity"]+1||2)-1)*((+j.opacity+1||2)-1)*((+a.o+1||2)-1);o=(fa(b["stroke-width"])||1)*0.75;a<0&&(a=0);a>1&&(a=1);b["stroke-width"]==null&&(o=j["stroke-width"]);b["stroke-width"]&&(l.weight=o);o&&o<1&&(a*=o)&&
(l.weight=1);l.opacity=a;b["stroke-linejoin"]&&(l.joinstyle=b["stroke-linejoin"]||"miter");l.miterlimit=b["stroke-miterlimit"]||8;b["stroke-linecap"]&&(l.endcap=b["stroke-linecap"]=="butt"?"flat":b["stroke-linecap"]=="square"?"square":"round");if(b["stroke-dasharray"]){a={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};l.dashstyle=a[ea](b["stroke-dasharray"])?a[b["stroke-dasharray"]]:
y}g&&f[Z](l)}if(n.type=="text"){l=n.paper.span.style;j.font&&(l.font=j.font);j["font-family"]&&(l.fontFamily=j["font-family"]);j["font-size"]&&(l.fontSize=j["font-size"]);j["font-weight"]&&(l.fontWeight=j["font-weight"]);j["font-style"]&&(l.fontStyle=j["font-style"]);n.node.string&&(n.paper.span.innerHTML=(n.node.string+y)[ta](/</g,"&#60;")[ta](/&/g,"&#38;")[ta](/\n/g,"<br>"));n.W=j.w=n.paper.span.offsetWidth;n.H=j.h=n.paper.span.offsetHeight;n.X=j.x;n.Y=j.y+ra(n.H/2);switch(j["text-anchor"]){case "start":n.node.style["v-text-align"]=
"left";n.bbx=ra(n.W/2);break;case "end":n.node.style["v-text-align"]="right";n.bbx=-ra(n.W/2);break;default:n.node.style["v-text-align"]="center";break}}};Pa=function(a,b){a.attrs=a.attrs||{};var f="linear",j=".5 .5";a.attrs.gradient=b;b=(b+y)[ta](hb,function(s,v,E){f="radial";if(v&&E){v=fa(v);E=fa(E);ma(v-0.5,2)+ma(E-0.5,2)>0.25&&(E=Q.sqrt(0.25-ma(v-0.5,2))*((E>0.5)*2-1)+0.5);j=v+G+E}return y});b=b[I](/\s*\-\s*/);if(f=="linear"){var l=b.shift();l=-fa(l);if(isNaN(l))return null}var g=gb(b);if(!g)return null;
a=a.shape||a.node;b=a.getElementsByTagName("fill")[0]||Ea("fill");!b.parentNode&&a.appendChild(b);if(g[H]){b.on=true;b.method="none";b.color=g[0].color;b.color2=g[g[H]-1].color;a=[];for(var n=0,o=g[H];n<o;n++)g[n].offset&&a[oa](g[n].offset+G+g[n].color);b.colors&&(b.colors.value=a[H]?a[ba]():"0% "+b.color);if(f=="radial"){b.type="gradientradial";b.focus="100%";b.focussize=j;b.focusposition=j}else{b.type="gradient";b.angle=(270-l)%360}}return 1};W=function(a,b,f){this[0]=a;this.id=c._oid++;this.node=
a;a.raphael=this;this.Y=this.X=0;this.attrs={};this.Group=b;this.paper=f;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!f.bottom&&(f.bottom=this);(this.prev=f.top)&&(f.top.next=this);f.top=this;this.next=null};W[N].rotate=function(a,b,f){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][ba](G);return this._.rt.deg}a=(a+y)[I](la);if(a[H]-1){b=fa(a[1]);f=fa(a[2])}a=fa(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;f==null&&(b=null);this._.rt.cx=
b;this._.rt.cy=f;this.setBox(this.attrs,b,f);this.Group.style.rotation=this._.rt.deg;return this};W[N].setBox=function(a,b,f){if(this.removed)return this;var j=this.Group.style,l=this.shape&&this.shape.style||this.node.style;a=a||{};for(var g in a)if(a[ea](g))this.attrs[g]=a[g];b=b||this._.rt.cx;f=f||this._.rt.cy;var n=this.attrs,o;switch(this.type){case "circle":a=n.cx-n.r;g=n.cy-n.r;o=n=n.r*2;break;case "ellipse":a=n.cx-n.rx;g=n.cy-n.ry;o=n.rx*2;n=n.ry*2;break;case "image":a=+n.x;g=+n.y;o=n.width||
0;n=n.height||0;break;case "text":this.textpath.v=["m",ra(n.x),", ",ra(n.y-2),"l",ra(n.x)+1,", ",ra(n.y-2)][ba](y);a=n.x-ra(this.W/2);g=n.y-this.H/2;o=this.W;n=this.H;break;case "rect":case "path":if(this.attrs.path){n=Ya(this.attrs.path);a=n.x;g=n.y;o=n.width;n=n.height}else{g=a=0;o=this.paper.width;n=this.paper.height}break;default:g=a=0;o=this.paper.width;n=this.paper.height;break}b=b==null?a+o/2:b;f=f==null?g+n/2:f;b-=this.paper.width/2;f-=this.paper.height/2;var s;j.left!=(s=b+"px")&&(j.left=
s);j.top!=(s=f+"px")&&(j.top=s);this.X=Ra[ea](this.type)?-b:a;this.Y=Ra[ea](this.type)?-f:g;this.W=o;this.H=n;if(Ra[ea](this.type)){l.left!=(s=-b*10+"px")&&(l.left=s);l.top!=(s=-f*10+"px")&&(l.top=s)}else if(this.type=="text"){l.left!=(s=-b+"px")&&(l.left=s);l.top!=(s=-f+"px")&&(l.top=s)}else{j.width!=(s=this.paper.width+"px")&&(j.width=s);j.height!=(s=this.paper.height+"px")&&(j.height=s);l.left!=(s=a-b+"px")&&(l.left=s);l.top!=(s=g-f+"px")&&(l.top=s);l.width!=(s=o+"px")&&(l.width=s);l.height!=(s=
n+"px")&&(l.height=s)}};W[N].hide=function(){!this.removed&&(this.Group.style.display="none");return this};W[N].show=function(){!this.removed&&(this.Group.style.display="block");return this};W[N].getBBox=function(){if(this.removed)return this;if(Ra[ea](this.type))return Ya(this.attrs.path);return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};W[N].remove=function(){if(!this.removed){A(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);
this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=true}};W[N].attr=function(a,b){if(this.removed)return this;if(a==null){a={};for(var f in this.attrs)if(this.attrs[ea](f))a[f]=this.attrs[f];this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&c.is(a,Da)){if(a=="translation")return va.call(this);if(a=="rotation")return this.rotate();
if(a=="scale")return this.scale();if(a=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(this.attrs&&b==null&&c.is(a,Ba)){var j={};f=0;for(b=a[H];f<b;f++)j[a[f]]=this.attr(a[f]);return j}if(b!=null){j={};j[a]=b}b==null&&c.is(a,"object")&&(j=a);if(j){if(j.text&&this.type=="text")this.node.string=j.text;Ha(this,j);if(j.gradient&&({circle:1,ellipse:1}[ea](this.type)||(j.gradient+y).charAt()!="r"))Pa(this,j.gradient);(!Ra[ea](this.type)||this._.rt.deg)&&
this.setBox(this.attrs)}return this};W[N].toFront=function(){!this.removed&&this.Group.parentNode[Z](this.Group);this.paper.top!=this&&u(this,this.paper);return this};W[N].toBack=function(){if(this.removed)return this;if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);x(this,this.paper)}return this};W[N].insertAfter=function(a){if(this.removed)return this;a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):
a.Group.parentNode[Z](this.Group);C(this,a,this.paper);return this};W[N].insertBefore=function(a){if(this.removed)return this;a.Group.parentNode.insertBefore(this.Group,a.Group);J(this,a,this.paper);return this};var Fb=/ progid:\S+Blur\([^\)]+\)/g;W[N].blur=function(a){var b=this.node.style,f=b.filter;f=f.replace(Fb,"");if(+a!==0){this.attrs.blur=a;b.filter=f+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+a||1.5)+")";b.margin=Raphael.format("-{0}px 0 0 -{0}px",Math.round(+a||1.5))}else{b.filter=
f;b.margin=0;delete this.attrs.blur}};jb=function(a,b,f,j){var l=Ea("group"),g=Ea("oval");l.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";l.coordsize=Qa;l.coordorigin=a.coordorigin;l[Z](g);g=new W(g,l,a);g.type="circle";Ha(g,{stroke:"#000",fill:"none"});g.attrs.cx=b;g.attrs.cy=f;g.attrs.r=j;g.setBox({x:b-j,y:f-j,width:j*2,height:j*2});a.canvas[Z](l);return g};var qb=function(a,b,f,j,l){return l?c.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",
a+l,b,f-l*2,l,-l,j-l*2,l*2-f,l*2-j):c.format("M{0},{1}l{2},0,0,{3},{4},0z",a,b,f,j,-f)};kb=function(a,b,f,j,l,g){var n=qb(b,f,j,l,g);a=a.path(n);var o=a.attrs;a.X=o.x=b;a.Y=o.y=f;a.W=o.width=j;a.H=o.height=l;o.r=g;o.path=n;a.type="rect";return a};lb=function(a,b,f,j,l){var g=Ea("group"),n=Ea("oval");g.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";g.coordsize=Qa;g.coordorigin=a.coordorigin;g[Z](n);n=new W(n,g,a);n.type="ellipse";Ha(n,{stroke:"#000"});n.attrs.cx=
b;n.attrs.cy=f;n.attrs.rx=j;n.attrs.ry=l;n.setBox({x:b-j,y:f-l,width:j*2,height:l*2});a.canvas[Z](g);return n};mb=function(a,b,f,j,l,g){var n=Ea("group"),o=Ea("image");n.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";n.coordsize=Qa;n.coordorigin=a.coordorigin;o.src=b;n[Z](o);o=new W(o,n,a);o.type="image";o.attrs.src=b;o.attrs.x=f;o.attrs.y=j;o.attrs.w=l;o.attrs.h=g;o.setBox({x:f,y:j,width:l,height:g});a.canvas[Z](n);return o};nb=function(a,b,f,j){var l=Ea("group"),
g=Ea("shape"),n=g.style,o=Ea("path"),s=Ea("textpath");l.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";l.coordsize=Qa;l.coordorigin=a.coordorigin;o.v=c.format("m{0},{1}l{2},{1}",ra(b*10),ra(f*10),ra(b*10)+1);o.textpathok=true;n.width=a.width;n.height=a.height;s.string=j+y;s.on=true;g[Z](s);g[Z](o);l[Z](g);n=new W(s,l,a);n.shape=g;n.textpath=o;n.type="text";n.attrs.text=j;n.attrs.x=b;n.attrs.y=f;n.attrs.w=1;n.attrs.h=1;Ha(n,{font:Wa.font,stroke:"none",fill:"#000"});
n.setBox();a.canvas[Z](l);return n};ob=function(a,b){var f=this.canvas.style;a==+a&&(a+="px");b==+b&&(b+="px");f.width=a;f.height=b;f.clip="rect(0 "+a+" "+b+" 0)";return this};var Ea;ia.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!ia.namespaces.rvml&&ia.namespaces.add("rvml","urn:schemas-microsoft-com:vml");Ea=function(a){return ia.createElement("<rvml:"+a+' class="rvml">')}}catch(Ib){Ea=function(a){return ia.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}Za=
function(){var a=F[qa](0,arguments),b=a.container,f=a.height,j=a.width,l=a.x;a=a.y;if(!b)throw Error("VML container not found.");var g=new e,n=g.canvas=ia.createElement("div"),o=n.style;l=l||0;a=a||0;j=j||512;f=f||342;j==+j&&(j+="px");f==+f&&(f+="px");g.width=1E3;g.height=1E3;g.coordsize=1E4+G+1E4;g.coordorigin="0 0";g.span=ia.createElement("span");g.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";n[Z](g.span);o.cssText=c.format("width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",
j,f);if(b==1){ia.body[Z](n);o.left=l+"px";o.top=a+"px";o.position="absolute"}else b.firstChild?b.insertBefore(n,b.firstChild):b[Z](n);z.call(g,g,c.fn);return g};e[N].clear=function(){this.canvas.innerHTML=y;this.span=ia.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[Z](this.span);this.bottom=this.top=null};e[N].remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=
B(a);return true}}e[N].safari=/^Apple|^Google/.test(za.navigator.vendor)&&(!(za.navigator.userAgent.indexOf("Version/4.0")+1)||za.navigator.platform.slice(0,2)=="iP")?function(){var a=this.rect(-99,-99,this.width+99,this.height+99);za.setTimeout(function(){a.remove()})}:function(){};var Gb=function(){if(ia.addEventListener)return function(a,b,f,j){function l(n){if(Y&&X[ea](b))for(var o=0,s=n.targetTouches&&n.targetTouches.length;o<s;o++)if(n.targetTouches[o].target==a){s=n;n=n.targetTouches[o];n.originalEvent=
s;n.preventDefault=M;n.stopPropagation=ga;break}return f.call(j,n)}var g=Y&&X[b]?X[b]:b;a.addEventListener(g,l,false);return function(){a.removeEventListener(g,l,false);return true}};else if(ia.attachEvent)return function(a,b,f,j){function l(g){g=g||za.event;g.preventDefault=g.preventDefault||L;g.stopPropagation=g.stopPropagation||S;return f.call(j,g)}a.attachEvent("on"+b,l);return function(){a.detachEvent("on"+b,l);return true}}}();for(Na=T[H];Na--;)(function(a){c[a]=W[N][a]=function(b){if(c.is(b,
"function")){this.events=this.events||[];this.events.push({name:a,f:b,unbind:Gb(this.shape||this.node||ia,a,b,this)})}return this};c["un"+a]=W[N]["un"+a]=function(b){for(var f=this.events,j=f[H];j--;)if(f[j].name==a&&f[j].f==b){f[j].unbind();f.splice(j,1);!f.length&&delete this.events;return this}return this}})(T[Na]);W[N].hover=function(a,b){return this.mouseover(a).mouseout(b)};W[N].unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};W[N].drag=function(a,b,f){function j(n){var o=n.clientX,
s=n.clientY;if(Y)for(var v=n.touches.length,E;v--;){E=n.touches[v];if(E.identifier==g._drag.id){o=E.clientX;s=E.clientY;(n.originalEvent?n.originalEvent:n).preventDefault();break}}else n.preventDefault();a&&a.call(g,o-g._drag.x,s-g._drag.y,o,s)}function l(){g._drag={};Raphael.unmousemove(j).unmouseup(l);f&&f.call(g)}this._drag={};var g=this.mousedown(function(n){(n.originalEvent?n.originalEvent:n).preventDefault();this._drag.x=n.clientX;this._drag.y=n.clientY;this._drag.id=n.identifier;b&&b.call(this,
n.clientX,n.clientY);Raphael.mousemove(j).mouseup(l)});return this};e[N].circle=function(a,b,f){return jb(this,a||0,b||0,f||0)};e[N].rect=function(a,b,f,j,l){return kb(this,a||0,b||0,f||0,j||0,l||0)};e[N].ellipse=function(a,b,f,j){return lb(this,a||0,b||0,f||0,j||0)};e[N].path=function(a){a&&!c.is(a,Da)&&!c.is(a[0],Ba)&&(a+=y);return ib(c.format[qa](c,arguments),this)};e[N].image=function(a,b,f,j,l){return mb(this,a||"about:blank",b||0,f||0,j||0,l||0)};e[N].text=function(a,b,f){return nb(this,a||
0,b||0,f||y)};e[N].set=function(a){arguments[H]>1&&(a=Array[N].splice.call(arguments,0,arguments[H]));return new wa(a)};e[N].setSize=ob;e[N].top=e[N].bottom=null;e[N].raphael=c;W[N].resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};W[N].scale=function(a,b,f,j){if(this.removed)return this;if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:ca};b=b||a;!+b&&(b=a);var l,g,n=this.attrs;if(a!=0){var o=this.getBBox(),s=o.x+o.width/2,v=o.y+o.height/
2;l=a/this._.sx;g=b/this._.sy;f=+f||f==0?f:s;j=+j||j==0?j:v;o=~~(a/Q.abs(a));var E=~~(b/Q.abs(b)),K=this.node.style,P=f+(s-f)*l;v=j+(v-j)*g;switch(this.type){case "rect":case "image":var O=n.width*o*l,D=n.height*E*g;this.attr({height:D,r:n.r*Ga(o*l,E*g),width:O,x:P-O/2,y:v-D/2});break;case "circle":case "ellipse":this.attr({rx:n.rx*o*l,ry:n.ry*E*g,r:n.r*Ga(o*l,E*g),cx:P,cy:v});break;case "text":this.attr({x:P,y:v});break;case "path":s=eb(n.path);for(var U=true,Aa=0,ja=s[H];Aa<ja;Aa++){var da=s[Aa],
ya=Va.call(da[0]);if(!(ya=="M"&&U)){U=false;if(ya=="A"){da[s[Aa][H]-2]*=l;da[s[Aa][H]-1]*=g;da[1]*=o*l;da[2]*=E*g;da[5]=+!(o+E?!+da[5]:+da[5])}else if(ya=="H"){ya=1;for(var Ja=da[H];ya<Ja;ya++)da[ya]*=l}else if(ya=="V"){ya=1;for(Ja=da[H];ya<Ja;ya++)da[ya]*=g}else{ya=1;for(Ja=da[H];ya<Ja;ya++)da[ya]*=ya%2?l:g}}}g=Ya(s);l=P-g.x-g.width/2;g=v-g.y-g.height/2;s[0][1]+=l;s[0][2]+=g;this.attr({path:s});break}if(this.type in{text:1,image:1}&&(o!=1||E!=1))if(this.transformations){this.transformations[2]="scale("[xa](o,
",",E,")");this.node.setAttribute("transform",this.transformations[ba](G));l=o==-1?-n.x-(O||0):n.x;g=E==-1?-n.y-(D||0):n.y;this.attr({x:l,y:g});n.fx=o-1;n.fy=E-1}else{this.node.filterMatrix=" progid:DXImageTransform.Microsoft"+".Matrix(M11="[xa](o,", M12=0, M21=0, M22=",E,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");K.filter=(this.node.filterMatrix||y)+(this.node.filterOpacity||y)}else if(this.transformations){this.transformations[2]=y;this.node.setAttribute("transform",this.transformations[ba](G));
n.fx=0;n.fy=0}else{this.node.filterMatrix=y;K.filter=(this.node.filterMatrix||y)+(this.node.filterOpacity||y)}n.scale=[a,b,f,j][ba](G);this._.sx=a;this._.sy=b}return this};W[N].clone=function(){if(this.removed)return null;var a=this.attr();delete a.scale;delete a.translation;return this.paper[this.type]().attr(a)};var db=h(function(a,b,f,j,l,g,n,o,s){for(var v=0,E,K=0;K<1.001;K+=0.0010){var P=c.findDotsAtSegment(a,b,f,j,l,g,n,o,K);K&&(v+=ma(ma(E.x-P.x,2)+ma(E.y-P.y,2),0.5));if(v>=s)return P;E=P}}),
tb=h(function(a,b,f,j,l,g,n,o){for(var s={x:0,y:0},v=0,E=0;E<1.01;E+=0.01){var K=t(a,b,f,j,l,g,n,o,E);E&&(v+=ma(ma(s.x-K.x,2)+ma(s.y-K.y,2),0.5));s=K}return v}),rb=R(1),Ua=R(),bb=R(0,1);W[N].getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return rb(this.attrs.path)}};W[N].getPointAtLength=function(a){if(this.type=="path")return Ua(this.attrs.path,a)};W[N].getSubpath=function(a,b){if(this.type=="path"){if(Q.abs(this.getTotalLength()-b)<
1.0E-6)return bb(this.attrs.path,a).end;b=bb(this.attrs.path,b,1);return a?bb(b,a).end:b}};c.easing_formulas={linear:function(a){return a},"<":function(a){return ma(a,3)},">":function(a){return ma(a-1,3)+1},"<>":function(a){a*=2;if(a<1)return ma(a,3)/2;a-=2;return(ma(a,3)+2)/2},backIn:function(a){return a*a*(2.70158*a-1.70158)},backOut:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},elastic:function(a){if(a==0||a==1)return a;return ma(2,-10*a)*Q.sin((a-0.075)*2*Q.PI/0.3)+1},bounce:function(a){if(a<
1/2.75)a=7.5625*a*a;else if(a<2/2.75){a-=1.5/2.75;a=7.5625*a*a+0.75}else if(a<2.5/2.75){a-=2.25/2.75;a=7.5625*a*a+0.9375}else{a-=2.625/2.75;a=7.5625*a*a+0.984375}return a}};var Fa={length:0};W[N].animateWith=function(a,b,f,j,l){Fa[a.id]&&(b.start=Fa[a.id].start);return this.animate(b,f,j,l)};W[N].animateAlong=ua();W[N].animateAlongBack=ua(1);W[N].onAnimation=function(a){this._run=a||0;return this};W[N].animate=function(a,b,f,j){if(c.is(f,"function")||!f)j=f||null;var l={},g={},n={};for(var o in a)if(a[ea](o))if($a[ea](o)){l[o]=
this.attr(o);l[o]==null&&(l[o]=Wa[o]);g[o]=a[o];switch($a[o]){case "along":var s=rb(a[o]),v=Ua(a[o],s*!!a.back),E=this.getBBox();n[o]=s/b;n.tx=E.x;n.ty=E.y;n.sx=v.x;n.sy=v.y;g.rot=a.rot;g.back=a.back;g.len=s;a.rot&&(n.r=fa(this.rotate())||0);break;case pa:n[o]=(g[o]-l[o])/b;break;case "colour":l[o]=c.getRGB(l[o]);s=c.getRGB(g[o]);n[o]={r:(s.r-l[o].r)/b,g:(s.g-l[o].g)/b,b:(s.b-l[o].b)/b};break;case "path":s=Ta(l[o],g[o]);l[o]=s[0];v=s[1];n[o]=[];s=0;for(E=l[o][H];s<E;s++){n[o][s]=[0];for(var K=1,P=
l[o][s][H];K<P;K++)n[o][s][K]=(v[s][K]-l[o][s][K])/b}break;case "csv":v=(a[o]+y)[I](la);s=(l[o]+y)[I](la);switch(o){case "translation":l[o]=[0,0];n[o]=[v[0]/b,v[1]/b];break;case "rotation":l[o]=s[1]==v[1]&&s[2]==v[2]?s:[0,v[1],v[2]];n[o]=[(v[0]-l[o][0])/b,0,0];break;case "scale":a[o]=v;l[o]=(l[o]+y)[I](la);n[o]=[(v[0]-l[o][0])/b,(v[1]-l[o][1])/b,0,0];break;case "clip-rect":l[o]=(l[o]+y)[I](la);n[o]=[];for(s=4;s--;)n[o][s]=(v[s]-l[o][s])/b;break}g[o]=v}}this.stop();this.in_animation=1;Fa[this.id]=
{start:a.start||+new Date,ms:b,easing:f,from:l,diff:n,to:g,el:this,callback:j,t:{x:0,y:0}};++Fa[H]==1&&ha();return this};W[N].stop=function(){Fa[this.id]&&Fa[H]--;delete Fa[this.id];return this};W[N].translate=function(a,b){return this.attr({translation:a+" "+b})};W[N][sa]=function(){return"Rapha\u00ebl\u2019s object"};c.ae=Fa;wa[N][oa]=function(){for(var a,b,f=0,j=arguments[H];f<j;f++)if((a=arguments[f])&&(a.constructor==W||a.constructor==wa)){b=this.items[H];this[b]=this.items[b]=a;this[H]++}return this};
wa[N].pop=function(){delete this[this[H]--];return this.items.pop()};for(var cb in W[N])if(W[N][ea](cb))wa[N][cb]=function(a){return function(){for(var b=0,f=this.items[H];b<f;b++)this.items[b][a][qa](this.items[b],arguments);return this}}(cb);wa[N].attr=function(a,b){if(a&&c.is(a,Ba)&&c.is(a[0],"object")){b=0;for(var f=a[H];b<f;b++)this.items[b].attr(a[b])}else{f=0;for(var j=this.items[H];f<j;f++)this.items[f].attr(a,b)}return this};wa[N].animate=function(a,b,f,j){(c.is(f,"function")||!f)&&(j=f||
null);var l=this.items[H],g=l,n,o=this,s;j&&(s=function(){!--l&&j.call(o)});f=c.is(f,Da)?f:s;for(n=this.items[--g].animate(a,b,f,s);g--;)this.items[g].animateWith(n,a,b,f,s);return this};wa[N].insertAfter=function(a){for(var b=this.items[H];b--;)this.items[b].insertAfter(a);return this};wa[N].getBBox=function(){for(var a=[],b=[],f=[],j=[],l=this.items[H];l--;){var g=this.items[l].getBBox();a[oa](g.x);b[oa](g.y);f[oa](g.x+g.width);j[oa](g.y+g.height)}a=Ga[qa](0,a);b=Ga[qa](0,b);return{x:a,y:b,width:Ca[qa](0,
f)-a,height:Ca[qa](0,j)-b}};wa[N].clone=function(a){a=new wa;for(var b=0,f=this.items[H];b<f;b++)a[oa](this.items[b].clone());return a};c.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},f=a.face["font-family"];for(var j in a.face)if(a.face[ea](j))b.face[j]=a.face[j];if(this.fonts[f])this.fonts[f][oa](b);else this.fonts[f]=[b];if(!a.svg){b.face["units-per-em"]=Ia(a.face["units-per-em"],10);for(var l in a.glyphs)if(a.glyphs[ea](l)){f=a.glyphs[l];
b.glyphs[l]={w:f.w,k:{},d:f.d&&"M"+f.d[ta](/[mlcxtrv]/g,function(n){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[n]||"M"})+"z"};if(f.k)for(var g in f.k)if(f[ea](g))b.glyphs[l].k[g]=f.k[g]}}return a};e[N].getFont=function(a,b,f,j){j=j||"normal";f=f||"normal";b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400;if(c.fonts){var l=c.fonts[a];if(!l){a=RegExp("(^|\\s)"+a[ta](/[^\w\d\s+!~.:_-]/g,y)+"(\\s|$)","i");for(var g in c.fonts)if(c.fonts[ea](g))if(a.test(g)){l=c.fonts[g];break}}var n;if(l){g=
0;for(a=l[H];g<a;g++){n=l[g];if(n.face["font-weight"]==b&&(n.face["font-style"]==f||!n.face["font-style"])&&n.face["font-stretch"]==j)break}}return n}};e[N].print=function(a,b,f,j,l,g){g=g||"middle";var n=this.set(),o=(f+y)[I](y),s=0;c.is(j,f)&&(j=this.getFont(j));if(j){f=(l||16)/j.face["units-per-em"];var v=j.face.bbox.split(la);l=+v[0];g=+v[1]+(g=="baseline"?v[3]-v[1]+ +j.face.descent:(v[3]-v[1])/2);v=0;for(var E=o[H];v<E;v++){var K=v&&j.glyphs[o[v-1]]||{},P=j.glyphs[o[v]];s+=v?(K.w||j.w)+(K.k&&
K.k[o[v]]||0):0;P&&P.d&&n[oa](this.path(P.d).attr({fill:"#000",stroke:"none",translation:[s,0]}))}n.scale(f,f,l,g).translate(a-l,b-g)}return n};var Hb=/\{(\d+)\}/g;c.format=function(a,b){var f=c.is(b,Ba)?[0][xa](b):arguments;a&&c.is(a,Da)&&f[H]-1&&(a=a[ta](Hb,function(j,l){return f[++l]==null?y:f[l]}));return a||y};c.ninja=function(){Ka.was?Raphael=Ka.is:delete Raphael;return c};c.el=W[N];return c}();
(function(){var c=Math.max,e=Math.min;Raphael.fn.g=Raphael.fn.g||{};Raphael.fn.g.markers={disc:"disc",o:"disc",flower:"flower",f:"flower",diamond:"diamond",d:"diamond",square:"square",s:"square",triangle:"triangle",t:"triangle",star:"star","*":"star",cross:"cross",x:"cross",plus:"plus","+":"plus",arrow:"arrow","->":"arrow"};Raphael.fn.g.shim={stroke:"none",fill:"#000","fill-opacity":0};Raphael.fn.g.txtattr={font:"12px Arial, sans-serif"};Raphael.fn.g.colors=[];for(var i=[0.6,0.2,0.05,0.1333,0.75,
0],q=0;q<10;q++)q<i.length?Raphael.fn.g.colors.push("hsb("+i[q]+", .75, .75)"):Raphael.fn.g.colors.push("hsb("+i[q-i.length]+", 1, .5)");Raphael.fn.g.text=function(m,h,p){return this.text(m,h,p).attr(this.g.txtattr)};Raphael.fn.g.labelise=function(m,h,p){return m?(m+"").replace(/(##+(?:\.#+)?)|(%%+(?:\.%+)?)/g,function(w,k,t){if(k)return(+h).toFixed(k.replace(/^#+\.?/g,"").length);if(t)return(h*100/p).toFixed(t.replace(/^%+\.?/g,"").length)+"%"}):(+h).toFixed(0)};Raphael.fn.g.finger=function(m,h,
p,w,k,t,F){if(k&&!w||!k&&!p)return F?"":this.path();t={square:"square",sharp:"sharp",soft:"soft"}[t]||"round";var z;w=Math.round(w);p=Math.round(p);m=Math.round(m);h=Math.round(h);switch(t){case "round":if(k){k=~~(p/2);if(w<k){k=w;z=["M",m-~~(p/2),h,"l",0,0,"a",~~(p/2),k,0,0,1,p,0,"l",0,0,"z"]}else z=["M",m-k,h,"l",0,k-w,"a",k,k,0,1,1,p,0,"l",0,w-k,"z"]}else{k=~~(w/2);if(p<k){k=p;z=["M",m+0.5,h+0.5-~~(w/2),"l",0,0,"a",k,~~(w/2),0,0,1,0,w,"l",0,0,"z"]}else z=["M",m+0.5,h+0.5-k,"l",p-k,0,"a",k,k,0,
1,1,0,w,"l",k-p,0,"z"]}break;case "sharp":if(k){k=~~(p/2);z=["M",m+k,h,"l",-p,0,0,-c(w-k,0),k,-e(k,w),k,e(k,w),k,"z"]}else{k=~~(w/2);z=["M",m,h+k,"l",0,-w,c(p-k,0),0,e(k,p),k,-e(k,p),k+(k*2<w),"z"]}break;case "square":z=k?["M",m+~~(p/2),h,"l",1-p,0,0,-w,p-1,0,"z"]:["M",m,h+~~(w/2),"l",0,-w,p,0,0,w,"z"];break;case "soft":if(k){k=e(Math.round(p/5),w);z=["M",m-~~(p/2),h,"l",0,k-w,"a",k,k,0,0,1,k,-k,"l",p-2*k,0,"a",k,k,0,0,1,k,k,"l",0,w-k,"z"]}else{k=e(p,Math.round(w/5));z=["M",m+0.5,h+0.5-~~(w/2),"l",
p-k,0,"a",k,k,0,0,1,k,k,"l",0,w-k*2,"a",k,k,0,0,1,-k,k,"l",k-p,0,"z"]}}return F?z.join(","):this.path(z)};Raphael.fn.g.disc=function(m,h,p){return this.circle(m,h,p)};Raphael.fn.g.line=function(m,h,p){return this.rect(m-p,h-p/5,2*p,2*p/5)};Raphael.fn.g.square=function(m,h,p){p*=0.7;return this.rect(m-p,h-p,2*p,2*p)};Raphael.fn.g.triangle=function(m,h,p){p*=1.75;return this.path("M".concat(m,",",h,"m0-",p*0.58,"l",p*0.5,",",p*0.87,"-",p,",0z"))};Raphael.fn.g.diamond=function(m,h,p){return this.path(["M",
m,h-p,"l",p,p,-p,p,-p,-p,p,-p,"z"])};Raphael.fn.g.flower=function(m,h,p,w){p*=1.25;p=p;var k=p*0.5;w=+w<3||!w?5:w;for(var t=["M",m,h+k,"Q"],F,z=1;z<w*2+1;z++){F=z%2?p:k;t=t.concat([+(m+F*Math.sin(z*Math.PI/w)).toFixed(3),+(h+F*Math.cos(z*Math.PI/w)).toFixed(3)])}t.push("z");return this.path(t.join(","))};Raphael.fn.g.star=function(m,h,p,w,k){w=w||p*0.382;k=k||5;for(var t=["M",m,h+w,"L"],F,z=1;z<k*2;z++){F=z%2?p:w;t=t.concat([m+F*Math.sin(z*Math.PI/k),h+F*Math.cos(z*Math.PI/k)])}t.push("z");return this.path(t.join(","))};
Raphael.fn.g.cross=function(m,h,p){p/=2.5;return this.path("M".concat(m-p,",",h,"l",[-p,-p,p,-p,p,p,p,-p,p,p,-p,p,p,p,-p,p,-p,-p,-p,p,-p,-p,"z"]))};Raphael.fn.g.plus=function(m,h,p){p/=2;return this.path("M".concat(m-p/2,",",h-p/2,"l",[0,-p,p,0,0,p,p,0,0,p,-p,0,0,p,-p,0,0,-p,-p,0,0,-p,"z"]))};Raphael.fn.g.arrow=function(m,h,p){return this.path("M".concat(m-p*0.7,",",h-p*0.4,"l",[p*0.6,0,0,-p*0.4,p,p*0.8,-p,p*0.8,0,-p*0.4,-p*0.6,0],"z"))};Raphael.fn.g.tag=function(m,h,p,w,k){w=w||0;k=k==null?5:k;p=
p==null?"$9.99":p;var t=0.5522*k,F=this.set();F.push(this.path().attr({fill:"#000",stroke:"#000"}));F.push(this.text(m,h,p).attr(this.g.txtattr).attr({fill:"#fff","font-family":"Helvetica, Arial"}));F.update=function(){this.rotate(0,m,h);var z=this[1].getBBox();if(z.height>=k*2)this[0].attr({path:["M",m,h+k,"a",k,k,0,1,1,0,-k*2,k,k,0,1,1,0,k*2,"m",0,-k*2-3,"a",k+3,k+3,0,1,0,0,(k+3)*2,"L",m+k+3,h+z.height/2+3,"l",z.width+6,0,0,-z.height-6,-z.width-6,0,"L",m,h-k-3].join(",")});else{var A=Math.sqrt(Math.pow(k+
3,2)-Math.pow(z.height/2+3,2));this[0].attr({path:["M",m,h+k,"c",-t,0,-k,t-k,-k,-k,0,-t,k-t,-k,k,-k,t,0,k,k-t,k,k,0,t,t-k,k,-k,k,"M",m+A,h-z.height/2-3,"a",k+3,k+3,0,1,0,0,z.height+6,"l",k+3-A+z.width+6,0,0,-z.height-6,"L",m+A,h-z.height/2-3].join(",")})}this[1].attr({x:m+k+3+z.width/2,y:h});w=(360-w)%360;this.rotate(w,m,h);w>90&&w<270&&this[1].attr({x:m-k-3-z.width/2,y:h,rotation:[180+w,m,h]});return this};F.update();return F};Raphael.fn.g.popupit=function(m,h,p,w,k){w=w==null?2:w;k=k||5;m=Math.round(m);
h=Math.round(h);var t=p.getBBox(),F=Math.round(t.width/2),z=Math.round(t.height/2),A=["M",m-[0,F+k*2,0,-F-k*2][w],h-[-z*2-k*3,-z-k,0,-z-k][w],"l",-k,(w==2)*-k,-c(F-k,0),0,"a",k,k,0,0,1,-k,-k,"l",0,-c(z-k,0),(w==3)*-k,-k,(w==3)*k,-k,0,-c(z-k,0),"a",k,k,0,0,1,k,-k,"l",c(F-k,0),0,k,!w*-k,k,!w*k,c(F-k,0),0,"a",k,k,0,0,1,k,k,"l",0,c(z-k,0),(w==1)*k,k,(w==1)*-k,k,0,c(z-k,0),"a",k,k,0,0,1,-k,k,"l",-c(F-k,0),0,"z"].join(",");m=[{x:m,y:h+k*2+z},{x:m-k*2-F,y:h},{x:m,y:h-k*2-z},{x:m+k*2+F,y:h}][w];p.translate(m.x-
F-t.x,m.y-z-t.y);return this.path(A).attr({fill:"#000",stroke:"none"}).insertBefore(p.node?p:p[0])};Raphael.fn.g.popup=function(m,h,p,w,k){w=w==null?2:w>3?3:w;k=k||5;p=p||"$9.99";var t=this.set();t.push(this.path().attr({fill:"#000",stroke:"#000"}));t.push(this.text(m,h,p).attr(this.g.txtattr).attr({fill:"#fff","font-family":"Helvetica, Arial"}));t.update=function(F,z,A){F=F||m;z=z||h;var u=this[1].getBBox(),x=u.width/2,C=u.height/2;u=["M",F-[0,x+k*2,0,-x-k*2][w],z-[-C*2-k*3,-C-k,0,-C-k][w],"l",-k,
(w==2)*-k,-c(x-k,0),0,"a",k,k,0,0,1,-k,-k,"l",0,-c(C-k,0),(w==3)*-k,-k,(w==3)*k,-k,0,-c(C-k,0),"a",k,k,0,0,1,k,-k,"l",c(x-k,0),0,k,!w*-k,k,!w*k,c(x-k,0),0,"a",k,k,0,0,1,k,k,"l",0,c(C-k,0),(w==1)*k,k,(w==1)*-k,k,0,c(C-k,0),"a",k,k,0,0,1,-k,k,"l",-c(x-k,0),0,"z"].join(",");F=[{x:F,y:z+k*2+C},{x:F-k*2-x,y:z},{x:F,y:z-k*2-C},{x:F+k*2+x,y:z}][w];F.path=u;A?this.animate(F,500,">"):this.attr(F);return this};return t.update(m,h)};Raphael.fn.g.flag=function(m,h,p,w){w=w||0;p=p||"$9.99";var k=this.set();k.push(this.path().attr({fill:"#000",
stroke:"#000"}));k.push(this.text(m,h,p).attr(this.g.txtattr).attr({fill:"#fff","font-family":"Helvetica, Arial"}));k.update=function(t,F){this.rotate(0,t,F);var z=this[1].getBBox(),A=z.height/2;this[0].attr({path:["M",t,F,"l",A+3,-A-3,z.width+6,0,0,z.height+6,-z.width-6,0,"z"].join(",")});this[1].attr({x:t+A+3+z.width/2,y:F});w=360-w;this.rotate(w,t,F);w>90&&w<270&&this[1].attr({x:t-r-3-z.width/2,y:F,rotation:[180+w,t,F]});return this};return k.update(m,h)};Raphael.fn.g.label=function(m,h,p){var w=
this.set();w.push(this.rect(m,h,10,10).attr({stroke:"none",fill:"#000"}));w.push(this.text(m,h,p).attr(this.g.txtattr).attr({fill:"#fff"}));w.update=function(){var k=this[1].getBBox(),t=e(k.width+10,k.height+10)/2;this[0].attr({x:k.x-t/2,y:k.y-t/2,width:k.width+t,height:k.height+t,r:t})};w.update();return w};Raphael.fn.g.labelit=function(m){var h=m.getBBox(),p=e(20,h.width+10,h.height+10)/2;return this.rect(h.x-p/2,h.y-p/2,h.width+p,h.height+p,p).attr({stroke:"none",fill:"#000"}).insertBefore(m.node?
m:m[0])};Raphael.fn.g.drop=function(m,h,p,w,k){w=w||30;k=k||0;var t=this.set();t.push(this.path(["M",m,h,"l",w,0,"A",w*0.4,w*0.4,0,1,0,m+w*0.7,h-w*0.7,"z"]).attr({fill:"#000",stroke:"none",rotation:[22.5-k,m,h]}));k=(k+90)*Math.PI/180;t.push(this.text(m+w*Math.sin(k),h+w*Math.cos(k),p).attr(this.g.txtattr).attr({"font-size":w*12/30,fill:"#fff"}));t.drop=t[0];t.text=t[1];return t};Raphael.fn.g.blob=function(m,h,p,w,k){w=(+w+1?w:45)+90;k=k||12;var t=Math.PI/180,F=k*12/12,z=this.set();z.push(this.path().attr({fill:"#000",
stroke:"none"}));z.push(this.text(m+k*Math.sin(w*t),h+k*Math.cos(w*t)-F/2,p).attr(this.g.txtattr).attr({"font-size":F,fill:"#fff"}));z.update=function(A,u,x){A=A||m;u=u||h;var C=this[1].getBBox(),J=c(C.width+F,k*25/12),B=c(C.height+F,k*25/12);C=A+k*Math.sin((w-22.5)*t);var L=u+k*Math.cos((w-22.5)*t);A=A+k*Math.sin((w+22.5)*t);u=u+k*Math.cos((w+22.5)*t);var M=(A-C)/2,S=(u-L)/2;J=J/2;B=B/2;var ga=-Math.sqrt(Math.abs(J*J*B*B-J*J*S*S-B*B*M*M)/(J*J*S*S+B*B*M*M));S=ga*J*S/B+(A+C)/2;M=ga*-B*M/J+(u+L)/2;
x?this.animate({x:S,y:M,path:["M",m,h,"L",A,u,"A",J,B,0,1,1,C,L,"z"].join(",")},500,">"):this.attr({x:S,y:M,path:["M",m,h,"L",A,u,"A",J,B,0,1,1,C,L,"z"].join(",")});return this};z.update(m,h);return z};Raphael.fn.g.colorValue=function(m,h,p,w){return"hsb("+[e((1-m/h)*0.4,1),p||0.75,w||0.75]+")"};Raphael.fn.g.snapEnds=function(m,h,p){function w(z){return Math.abs(z-0.5)<0.25?~~z+0.5:Math.round(z)}var k=m,t=h;if(k==t)return{from:k,to:t,power:0};k=(t-k)/p;var F=t=~~k;p=0;if(t){for(;F;){p--;F=~~(k*Math.pow(10,
p))/Math.pow(10,p)}p++}else{for(;!t;){p=p||1;t=~~(k*Math.pow(10,p))/Math.pow(10,p);p++}p&&p--}t=w(h*Math.pow(10,p))/Math.pow(10,p);if(t<h)t=w((h+0.5)*Math.pow(10,p))/Math.pow(10,p);k=w((m-(p>0?0:0.5))*Math.pow(10,p))/Math.pow(10,p);return{from:k,to:t,power:p}};Raphael.fn.g.axis=function(m,h,p,w,k,t,F,z,A,u){u=u==null?2:u;A=A||"t";t=t||10;var x=A=="|"||A==" "?["M",m+0.5,h,"l",0,0.0010]:F==1||F==3?["M",m+0.5,h,"l",0,-p]:["M",m,h+0.5,"l",p,0];w=this.g.snapEnds(w,k,t);var C=w.from,J=w.to,B=w.power;k=
0;w=this.set();d=(J-C)/t;J=C;var L=B>0?B:0;M=p/t;if(+F==1||+F==3){t=h;for(C=(F-1?1:-1)*(u+3+!!(F-1));t>=h-p;){A!="-"&&A!=" "&&(x=x.concat(["M",m-(A=="+"||A=="|"?u:!(F-1)*u*2),t+0.5,"l",u*2+1,0]));w.push(this.text(m+C,t,z&&z[k++]||(Math.round(J)==J?J:+J.toFixed(L))).attr(this.g.txtattr).attr({"text-anchor":F-1?"start":"end"}));J+=d;t-=M}if(Math.round(t+M-(h-p))){A!="-"&&A!=" "&&(x=x.concat(["M",m-(A=="+"||A=="|"?u:!(F-1)*u*2),h-p+0.5,"l",u*2+1,0]));w.push(this.text(m+C,h-p,z&&z[k]||(Math.round(J)==
J?J:+J.toFixed(L))).attr(this.g.txtattr).attr({"text-anchor":F-1?"start":"end"}))}}else{J=C;L=(B>0)*B;C=(F?-1:1)*(u+9+!F);B=m;var M=p/t,S=0;for(t=0;B<=m+p;){A!="-"&&A!=" "&&(x=x.concat(["M",B+0.5,h-(A=="+"?u:!!F*u*2),"l",0,u*2+1]));w.push(S=this.text(B,h+C,z&&z[k++]||(Math.round(J)==J?J:+J.toFixed(L))).attr(this.g.txtattr));S=S.getBBox();if(t>=S.x-5)w.pop(w.length-1).remove();else t=S.x+S.width;J+=d;B+=M}if(Math.round(B-M-m-p)){A!="-"&&A!=" "&&(x=x.concat(["M",m+p+0.5,h-(A=="+"?u:!!F*u*2),"l",0,u*
2+1]));w.push(this.text(m+p,h+C,z&&z[k]||(Math.round(J)==J?J:+J.toFixed(L))).attr(this.g.txtattr))}}m=this.path(x);m.text=w;m.all=this.set([m,w]);m.remove=function(){this.text.remove();this.constructor.prototype.remove.call(this)};return m};Raphael.el.lighter=function(m){m=m||2;var h=[this.attrs.fill,this.attrs.stroke];this.fs=this.fs||[h[0],h[1]];h[0]=Raphael.rgb2hsb(Raphael.getRGB(h[0]).hex);h[1]=Raphael.rgb2hsb(Raphael.getRGB(h[1]).hex);h[0].b=e(h[0].b*m,1);h[0].s/=m;h[1].b=e(h[1].b*m,1);h[1].s/=
m;this.attr({fill:"hsb("+[h[0].h,h[0].s,h[0].b]+")",stroke:"hsb("+[h[1].h,h[1].s,h[1].b]+")"})};Raphael.el.darker=function(m){m=m||2;var h=[this.attrs.fill,this.attrs.stroke];this.fs=this.fs||[h[0],h[1]];h[0]=Raphael.rgb2hsb(Raphael.getRGB(h[0]).hex);h[1]=Raphael.rgb2hsb(Raphael.getRGB(h[1]).hex);h[0].s=e(h[0].s*m,1);h[0].b/=m;h[1].s=e(h[1].s*m,1);h[1].b/=m;this.attr({fill:"hsb("+[h[0].h,h[0].s,h[0].b]+")",stroke:"hsb("+[h[1].h,h[1].s,h[1].b]+")"})};Raphael.el.original=function(){if(this.fs){this.attr({fill:this.fs[0],
stroke:this.fs[1]});delete this.fs}}})();
Raphael.fn.g.piechart=function(c,e,i,q,m){m=m||{};var h=this,p=[],w=this.set(),k=this.set(),t=this.set(),F=q.length,z=0,A=0,u=0,x=9,C=true;k.covers=w;if(F==1){t.push(this.circle(c,e,i).attr({fill:this.g.colors[0],stroke:m.stroke||"#fff","stroke-width":m.strokewidth==null?1:m.strokewidth}));w.push(this.circle(c,e,i).attr(this.g.shim));A=q[0];q[0]={value:q[0],order:0,valueOf:function(){return this.value}};t[0].middle={x:c,y:e};t[0].mangle=180}else{for(var J=function(M,S,ga,ca,R){var ha=Math.PI/180,
na=M+ga*Math.cos(-ca*ha),va=M+ga*Math.cos(-R*ha),ua=M+ga/2*Math.cos(-(ca+(R-ca)/2)*ha),wa=S+ga*Math.sin(-ca*ha),la=S+ga*Math.sin(-R*ha);ha=S+ga/2*Math.sin(-(ca+(R-ca)/2)*ha);M=["M",M,S,"L",na,wa,"A",ga,ga,0,+(Math.abs(R-ca)>180),1,va,la,"z"];M.middle={x:ua,y:ha};return M},B=0;B<F;B++){A+=q[B];q[B]={value:q[B],order:B,valueOf:function(){return this.value}}}m.sort&&q.sort(function(M,S){return S.value-M.value});for(B=0;B<F;B++){if(C&&q[B]*360/A<=1.5){x=B;C=false}if(B>x){C=false;q[x].value+=q[B];q[x].others=
true;u=q[x].value}}F=Math.min(x+1,q.length);u&&q.splice(F)&&(q[x].others=true);for(B=0;B<F;B++){u=z-360*q[B]/A/2;if(!B){z=90-u;u=z-360*q[B]/A/2}if(m.init)var L=J(c,e,1,z,z-360*q[B]/A).join(",");x=J(c,e,i,z,z-=360*q[B]/A);C=this.path(m.init?L:x).attr({fill:m.colors&&m.colors[B]||this.g.colors[B]||"#666",stroke:m.stroke||"#fff","stroke-width":m.strokewidth==null?1:m.strokewidth,"stroke-linejoin":"round"});C.value=q[B];C.middle=x.middle;C.mangle=u;p.push(C);t.push(C);m.init&&C.animate({path:x.join(",")},
+m.init-1||1E3,">")}for(B=0;B<F;B++){C=h.path(p[B].attr("path")).attr(this.g.shim);m.href&&m.href[B]&&C.attr({href:m.href[B]});C.attr=function(){};w.push(C);t.push(C)}}k.hover=function(M,S){S=S||function(){};for(var ga=this,ca=0;ca<F;ca++)(function(R,ha,na){var va={sector:R,cover:ha,cx:c,cy:e,mx:R.middle.x,my:R.middle.y,mangle:R.mangle,r:i,value:q[na],total:A,label:ga.labels&&ga.labels[na]};ha.mouseover(function(){M.call(va)}).mouseout(function(){S.call(va)})})(t[ca],w[ca],ca);return this};k.each=
function(M){for(var S=this,ga=0;ga<F;ga++)(function(ca,R,ha){M.call({sector:ca,cover:R,cx:c,cy:e,x:ca.middle.x,y:ca.middle.y,mangle:ca.mangle,r:i,value:q[ha],total:A,label:S.labels&&S.labels[ha]})})(t[ga],w[ga],ga);return this};k.click=function(M){for(var S=this,ga=0;ga<F;ga++)(function(ca,R,ha){var na={sector:ca,cover:R,cx:c,cy:e,mx:ca.middle.x,my:ca.middle.y,mangle:ca.mangle,r:i,value:q[ha],total:A,label:S.labels&&S.labels[ha]};R.click(function(){M.call(na)})})(t[ga],w[ga],ga);return this};k.inject=
function(M){M.insertBefore(w[0])};p=function(M,S,ga,ca){var R=c+i+i/5,ha=e+10;M=M||[];ca=ca&&ca.toLowerCase&&ca.toLowerCase()||"east";ga=h.g.markers[ga&&ga.toLowerCase()]||"disc";k.labels=h.set();for(var na=0;na<F;na++){var va=t[na].attr("fill"),ua=q[na].order;q[na].others&&(M[ua]=S||"Others");M[ua]=h.g.labelise(M[ua],q[na],A);k.labels.push(h.set());k.labels[na].push(h.g[ga](R+5,ha,5).attr({fill:va,stroke:"none"}));k.labels[na].push(va=h.text(R+20,ha,M[ua]||q[ua]).attr(h.g.txtattr).attr({fill:m.legendcolor||
"#000","text-anchor":"start"}));w[na].label=k.labels[na];ha+=va.getBBox().height*1.2}M=k.labels.getBBox();k.labels.translate.apply(k.labels,{east:[0,-M.height/2],west:[-M.width-2*i-20,-M.height/2],north:[-i-M.width/2,-i-M.height-10],south:[-i-M.width/2,i+10]}[ca]);k.push(k.labels)};m.legend&&p(m.legend,m.legendothers,m.legendmark,m.legendpos);k.push(t,w);k.series=t;k.covers=w;return k};Raphael.el.isAbsolute=true;Raphael.el.absolutely=function(){this.isAbsolute=1;return this};
Raphael.el.relatively=function(){this.isAbsolute=0;return this};Raphael.el.moveTo=function(c,e){this._last={x:c,y:e};return this.attr({path:this.attrs.path+["m","M"][+this.isAbsolute]+parseFloat(c)+" "+parseFloat(e)})};Raphael.el.lineTo=function(c,e){this._last={x:c,y:e};return this.attr({path:this.attrs.path+["l","L"][+this.isAbsolute]+parseFloat(c)+" "+parseFloat(e)})};
Raphael.el.arcTo=function(c,e,i,q,m,h,p){this._last={x:m,y:h};return this.attr({path:this.attrs.path+["a","A"][+this.isAbsolute]+[parseFloat(c),parseFloat(e),+p,i,q,parseFloat(m),parseFloat(h)].join(" ")})};Raphael.el.curveTo=function(){var c=Array.prototype.splice.call(arguments,0,arguments.length),e=[0,0,0,0,"s",0,"c"][c.length]||"";this.isAbsolute&&(e=e.toUpperCase());this._last={x:c[c.length-2],y:c[c.length-1]};return this.attr({path:this.attrs.path+e+c})};
Raphael.el.cplineTo=function(c,e,i){this.attr({path:this.attrs.path+["C",this._last.x+i,this._last.y,c-i,e,c,e]});this._last={x:c,y:e};return this};Raphael.el.qcurveTo=function(){var c=[0,1,"t",3,"q"][arguments.length],e=Array.prototype.splice.call(arguments,0,arguments.length);if(this.isAbsolute)c=c.toUpperCase();this._last={x:e[e.length-2],y:e[e.length-1]};return this.attr({path:this.attrs.path+c+e})};
Raphael.el.addRoundedCorner=function(c,e){var i=this.isAbsolute;i&&this.relatively();this._last={x:c*(!!(e.indexOf("r")+1)*2-1),y:c*(!!(e.indexOf("d")+1)*2-1)};this.arcTo(c,c,0,{lu:1,rd:1,ur:1,dl:1}[e]||0,this._last.x,this._last.y);i&&this.absolutely();return this};Raphael.el.andClose=function(){return this.attr({path:this.attrs.path+"z"})};
(function(c){c.widget("ui.dialogManager",{options:{apTemplate:null,staTemplate:null,startZ:100},_init:function(){this.dialogs=[];return this},addItem:function(e,i){var q=this.dialogs,m;for(var h in q)if(q[h].mac==e){m=q[h].element;break}if(m==null){if(i=="ap"){m=c(this.options.apTemplate+":first").clone();c(m).apDialog({mac:e,model:c("#model-aps")})}else{m=c(this.options.staTemplate+":first").clone();c(m).staDialog({mac:e,model:c("#model-stas")})}c(m).attr("title",e);c(this.element).append(m);q.push({element:m,
mac:e});this.centerItem(m)}this.bringToFront(m)},removeItem:function(e){for(var i=this.dialogs,q=0,m=0,h=0;h<i.length;h++)if(i[h].mac==e.attr("title"))m=h;else{c(i[h].element).css("z-index",this.options.startZ+q);q++}i.splice(m,1);c(e).remove()},centerItem:function(e){var i=this.dialogs;c(e).css("position","absolute");c(e).css("top",(c(window).height()-350)/2+c(window).scrollTop()+15*i.length+"px");c(e).css("left",(c(window).width()-300)/2+c(window).scrollLeft()+15*i.length+"px")},bringToFront:function(e){for(var i=
this.dialogs,q=0,m=0,h=0;h<i.length;h++)if(i[h].mac==e.attr("title"))m=h;else{c(i[h].element).css("z-index",this.options.startZ+q);q++}i.splice(m,1);i.push({element:e,mac:e.attr("title")});e.css("z-index",this.options.startZ+i.length-1)},removeAllItems:function(){for(var e=0;e<this.dialogs.length;e++)c(this.dialogs[e].element).remove();this.dialogs=[]}});c.widget("ui.dialogTabs",{option:{},_init:function(){var e=this;e.element.find("div.tab-content").hide();e.element.find("div.tab-content:first").show();
e.element.find("ul.dialog-tabs li").each(function(){var i=c(this).find("a").attr("href").substring(1);c(this).find("a").attr("href","javascript:void(0);");c(this).click(function(){e.element.find("li.selected").removeClass("selected");c(this).addClass("selected");e.element.find("div.tab-content").hide();e.element.find("div."+i).show()})});e.element.find("ul.dialog-tabs li:first").addClass("selected")}});c.widget("ui.apDialog",{options:{mac:null,model:null},_init:function(){var e=this,i=e.element;e.element.dialogTabs();
e.element.find("div.details-tab-content").accordion({autoHeight:false});e.element.find("div.config-tab-content").accordion({autoHeight:false});e.element.mousedown(function(){c(document.body).dialogManager("bringToFront",e.element)});e.element.draggable({handle:"div.dialog-header",containment:"window"});e.element.find("div.users-data-table").jtable({model:c("#model-stas"),className:"stat",pagesize:8}).jtable("addcol","Name","mac",true,Renderer.staDetailLink,Renderer.staNameLower).jtable("addcol","WLAN",
"essid",true).jtable("addcol","Signal","signal",true,function(u){return u+"dBm"}).jtable("addcol","TX","tx_rate",true,Renderer.apXRate).jtable("addfilter","is_guest",false).jtable("addfilter","ap_mac",this.options.mac);e.element.find("div.guests-data-table").jtable({model:c("#model-stas"),className:"stat",pagesize:8}).jtable("addcol","Name","mac",true,Renderer.staDetailLink,Renderer.staNameLower).jtable("addcol","WLAN","essid",true).jtable("addcol","Signal","signal",true,function(u){return u+"dBm"}).jtable("addcol",
"TX","tx_rate",true,Renderer.apXRate).jtable("addfilter","is_guest",true).jtable("addfilter","ap_mac",this.options.mac);var q=e.configForm=e.element.find("div.ap-config");q.jform({populate:function(u){i.find('input[name="alias"]:nofocus').val(u.name)},get_posts:function(){e.ap.name=e.element.find('input[name="alias"]').val();c("#model-aps").data("ap_names")[e.ap.mac]=e.ap.name;return[{url:"/upd/device/"+e.ap._id,payload:{name:e.ap.name},changed:function(){return true}}]},done:function(){q.find("p.settings-response").addClass("success").show().delay(1E3).fadeOut(500);
c("#model-aps").jtablemodel("firechanged")}});var m=e.radioForm=e.element.find("div.ap-radio");c.each(["ng","na"],function(u,x){m.find(".ap-"+x+'-configs select[name="tx-power-mode"]').change(function(){m.find(".ap-"+x+"-configs .tx-power-custom").setvisible(c(this).val()=="custom");m.find(".ap-"+x+"-configs .antenna-gain").attr("disabled")!="disabled"&&m.find(".ap-"+x+"-configs .antenna-gain").setvisible(c(this).val()=="custom");m.find(".ap-"+x+'-configs input[name="antenna-gain"]').val(e.ap[x+"-antenna_gain"]);
if(c(this).val()!="custom")m.find(".ap-"+x+'-configs input[name="tx-power"]').val("auto");else{e.ap[x+"-desired_txpower"]=="auto"?m.find(".ap-"+x+'-configs input[name="tx-power"]').val(e.ap[x+"-tx_power"]||"0"):m.find(".ap-"+x+'-configs input[name="tx-power"]').val(e.ap[x+"-desired_txpower"]||"0");m.find(".ap-"+x+'-configs input[name="tx-power"]').attr("title",m.find(".ap-"+x+'-configs select[name="builtin_antenna"]')?"Tx Power (EIRP)":"Tx Power (conducted)")}})});m.find('.ap-na-configs select[name="channel"]').change(function(){var u=
parseInt(c(this).val()),x=c("#model-sysinfo").jsysinfo("data").cur_ccode,C=isNaN(u)||u==0,J=c.inArray(u,x.channels_na_40)>=0||C;u=c.inArray(u,x.channels_na_80)>=0||C;m.find('.ap-na-configs select[name="ht"]').find("option[value=40]").setvisible(J);m.find('.ap-na-configs select[name="ht"]').find("option[value=80]").setvisible(u);J||m.find('.ap-na-configs select[name="ht"]').val("20")});m.jform({populate:function(u){var x=false,C=false;if(u.radio_table){c.each(u.radio_table,function(J,B){if(B.radio==
"ng")x=true;else if(B.radio=="na")C=true;u[B.radio+"-builtin_antenna"]=B.builtin_antenna;u[B.radio+"-max_txpower"]=B.max_txpower;u[B.radio+"-min_txpower"]=B.min_txpower;u[B.radio+"-desired_txpower"]=V.isNumber(B.tx_power)?B.tx_power:u[B.radio+"-tx_power"];i.find("dt.tx-power-settings").attr("title",B.builtin_antenna?"Tx Power (EIRP)":"Tx Power (conducted)");i.find(".ap-"+B.radio+'-configs select[name="channel"]').val(B.channel||0);i.find(".ap-"+B.radio+'-configs select[name="ht"]').val(B.ht||(B.radio==
"ng"?20:40));i.find(".ap-"+B.radio+'-configs input[name="tx-power"]').val(B.tx_power||"0");i.find(".ap-"+B.radio+'-configs input[name="antenna-gain"]').val(B.antenna_gain||(B.builtin_antenna?"0":"6"));i.find(".ap-"+B.radio+"-configs .antenna-gain").setenabled(!B.builtin_antenna);i.find(".ap-"+B.radio+"-configs .antenna-gain").setvisible(!B.builtin_antenna);i.find(".ap-"+B.radio+'-configs select[name="tx-power-mode"]').val(B.tx_power_mode||"auto").change();i.find(".ap-"+B.radio+"-configs p.max-txpower").html("(Max: "+
B.max_txpower+" dBm)");i.find(".ap-"+B.radio+'-configs select[name="radio-mode"]').val(B.mode||"all").change()});x?i.addClass("ap-ng-radio"):i.removeClass("ap-ng-radio");C?i.addClass("ap-na-radio"):i.removeClass("ap-na-radio")}},get_posts:function(){var u=[];e.element.hasClass("ap-ng-radio")&&u.push("ng");e.element.hasClass("ap-na-radio")&&u.push("na");e.ap.radio_table=[];c.each(u,function(x,C){e.ap.radio_table.push({radio:C,builtin_antenna:e.ap[C+"-builtin_antenna"],builtin_ant_gain:e.ap[C+"-builtin_ant_gain"],
max_txpower:e.ap[C+"-max_txpower"],min_txpower:e.ap[C+"-min_txpower"],channel:e.element.find(".ap-"+C+'-configs select[name="channel"]').val(),ht:e.element.find(".ap-"+C+'-configs select[name="ht"]').val(),tx_power_mode:e.element.find(".ap-"+C+'-configs select[name="tx-power-mode"]').val(),tx_power:e.element.find(".ap-"+C+'-configs input[name="tx-power"]').val(),antenna_gain:e.element.find(".ap-"+C+'-configs input[name="antenna-gain"]').val(),mode:e.element.find(".ap-"+C+'-configs select[name="radio-mode"]').val()})});
return[{url:"/upd/device/"+e.ap._id,payload:{radio_table:e.ap.radio_table},changed:function(){return true}}]},validate:function(){if(e.element.hasClass("ap-ng-radio")){if(m.find('.ap-ng-configs select[name="tx-power-mode"]').val()=="custom"){var u=e.ap["ng-max_txpower"],x=e.ap["ng-min_txpower"],C=m.find('.ap-ng-configs input[name="tx-power"]');if(!V.checkInteger(C,"Transmit Power"))return false;if(!V.checkMinMax(C,x,u,"Transmit Power"))return false}if(!V.checkInteger(m.find('.ap-ng-configs input[name="antenna-gain"]'),
"Antenna Gain"))return false}if(e.element.hasClass("ap-na-radio")){if(m.find('.ap-na-configs select[name="tx-power-mode"]').val()=="custom"){u=e.ap["na-max_txpower"];x=e.ap["na-min_txpower"];C=m.find('.ap-na-configs input[name="tx-power"]');if(!V.checkInteger(C,"Transmit Power"))return false;if(!V.checkMinMax(C,x,u,"Transmit Power"))return false}if(!V.checkInteger(m.find('.ap-na-configs input[name="antenna-gain"]'),"Antenna Gain"))return false}return true},done:function(){m.find("p.settings-response").addClass("success").show().delay(1E3).fadeOut(500);
c("#model-aps").jtablemodel("firechanged")}});var h=e.networkForm=e.element.find("div.ap-network");h.find('select[name="network_config"]').change(function(){h.find("div.ip-settings").setvisible(c(this).val()=="static")});h.jform({populate:function(u){u=u.config_network||{};h.find('select[name="network_config"]').val(u.type||"dhcp").change();h.find('input[name="address"]').val(u.ip);h.find('input[name="gateway"]').val(u.gateway);h.find('input[name="netmask"]').val(u.netmask);h.find('input[name="dns1"]').val(u.dns1);
h.find('input[name="dns2"]').val(u.dns2);h.find('input[name="dnssuffix"]').val(u.dnssuffix)},get_posts:function(){var u=null;u=e.element.find('select[name="network_config"]').val()=="static"?{type:e.element.find('select[name="network_config"]').val(),ip:e.element.find('input[name="address"]').val(),gateway:e.element.find('input[name="gateway"]').val(),netmask:e.element.find('input[name="netmask"]').val(),dns1:e.element.find('input[name="dns1"]').val(),dns2:e.element.find('input[name="dns2"]').val(),
dnssuffix:e.element.find('input[name="dnssuffix"]').val()}:{type:e.element.find('select[name="network_config"]').val()};e.ap.config_network=u;return[{url:"/upd/device/"+e.ap._id,payload:{config_network:u}}]},validate:function(){var u=true,x=e.element.find('input[name="address"]').val();e.element.find('select[name="network_config"]').val()=="static"&&e.element.find("input.ip-setting").each(function(C,J){return u=J.name=="address"?!V.checkEmpty(c(J),J.name)||!V.checkIP(c(J),c(J).val())?false:true:J.name==
"netmask"?!V.checkEmpty(c(J),J.name)||!V.checkNetmask(c(J),c(J).val(),x)?false:true:c(J).val()&&!V.checkIP(c(J),c(J).val())?false:true});return u},done:function(){c("#model-aps").jtablemodel("firechanged");e._paint()}});var p=e.element.find("form.ap-adv-adopt");p.find(".dialog-hide-button").click(function(){p.hide()});p.find('input[name="apply"]').japply({get_posts:function(){return{url:"/cmd/devmgr",payload:{cmd:"adv-adopt",mac:e.options.mac,ip:p.find('input[name="ip"]').val(),port:p.find('input[name="port"]').val(),
username:p.find('input[name="username"]').val(),password:p.find('input[name="password"]').val(),url:p.find('input[name="url"]').val()}}},validate:function(){var u=p.find('input[name="username"]'),x=p.find('input[name="password"]');if(!V.checkEmpty(u,"Username"))return false;if(!V.checkEmpty(x,"Password"))return false;return true},done:function(){e.element.find("div.details-tab-content").accordion("activate",0);c("#model-aps").jtablemodel("refresh")}});var w=e.element.find("div.ap-wlan"),k=w.find("form.settings-list"),
t=w.find("form.settings-form"),F=function(u,x){var C=null;c.each(e.ap.wlan_overrides||[],function(J,B){if(B.wlan_id==u&&B.radio==x){C=B;return false}});return C},z=function(u){if(isNaN(u.vlan))u.vlan=0;t.find('input[name="name"]').val(u.name);t.find('input[name="wlanEnabled"]').setchecked(u.enabled);t.find('input[name="vlanEnabled"]').setchecked(u.vlan_enabled);t.find('input[name="vlan"]').val(u.vlan>1?u.vlan:"");t.find(".wpapsk").setvisible(u.security=="wpapsk");t.find('input[name="passphrase"]').val(u.x_passphrase)};
c.each(["ng","na"],function(u,x){var C=e.element.find("select.wlan-group-"+x),J=e.element.find("div.wlan-data-table-"+x);C.jselect({model:c("#model-wlangroups"),showhidden:true,sortby:"name",compareRenderer:function(B){return B.toLowerCase()},renderer:function(B,L){var M=c('<option value="'+L._id+'"></option>');if(L.roam_enabled){if(x!=L.roam_radio)return null;M.addClass("roam");M.text(B+" (Zero-Handoff)")}else M.text(B);return M}}).change(function(){var B=C.val(),L=c("#model-wlangroups").jtablemodel("findrow",
"_id",B);C.data("wlangroup",L);var M=c.grep(c("#model-wlanconfs").jtablemodel("rows"),function(S){return S.wlangroup_id==C.val()});J.jtable("option","rows",M).jtable("option","pagesize",M.length).jtable("repaint");M=e.element.find("div.ap-radio .ap-"+x+"-configs");if(L.roam_enabled){M.find("select[name=channel]").val(x=="ng"?L.roam_channel_ng:L.roam_channel_na);M.find("select[name=ht]").val("20")}M.find("select[name=channel], select[name=ht]").setenabled(!L.roam_enabled);if(e.ap._id&&e.ap["radio_"+
x]&&e.ap["wlangroup_id_"+x]!=B){L={};L["wlangroup_id_"+x]=B;M=c.grep(e.ap.wlan_overrides||[],function(S){return S.radio!=x});L.wlan_overrides=M;c.jpost("/upd/device/"+e.ap._id,L);e.ap["wlangroup_id_"+x]=B;e.ap.wlan_overrides=M}}).jselect("repaint");J.jtable({rows:[],hidetoolbar:true,pagesize:0}).jtable("addcol","Name","name",false,function(B,L){var M=L.name;if(M.length>18){M=M.substr(0,15).concat("...");return c('<a href="javascript:void(0);" class="td.name" title="'+L.name+'"></a>').text(M)}else return M}).jtable("addcol",
"Overrides","_id",false,function(B,L){var M=[],S=F(B,x);if(!S)return"";if(S.enabled==false)return"Disabled";S.name!=L.name&&M.push("SSID:"+S.name);if(L.vlan_enabled||S.vlan_enabled)if(L.vlan_enabled&&!S.vlan_enabled)M.push("VLAN:disabled");else if(!L.vlan_enabled&&S.vlan_enabled)M.push("VLAN:"+S.vlan);else L.vlan!=S.vlan&&M.push("VLAN:"+S.vlan);L.security=="wpapsk"&&S.x_passphrase!=L.x_passphrase&&M.push("PSK");M=M.join(", ");if(M.length>14){S=M.substr(0,11).concat("...");return c('<a href="javascript:void(0);" class="td._id" title="'+
M+'"></a>').text(S)}else return M}).jtable("addaction","override","override",function(){return!C.data("wlangroup").roam_enabled}).bind("jtable_override",function(B,L){var M=F(L._id,x)||{wlan_id:L._id,radio:x,enabled:L.enabled,name:L.name,vlan_enabled:L.vlan_enabled,vlan:L.vlan||0,security:L.security,x_passphrase:L.x_passphrase};k.hide();z(M);t.data("o",M).data("wlan",L).show()});t.find("input[name=cancel]").click(function(){t.hide();k.show()});t.find("input[name=restore]").click(function(){z(t.data("wlan"));
t.find('input[name="apply"]').click()})});t.find('input[name="apply"]').japply({validate:function(){if(!V.checkEmpty(t.find('input[name="name"]'),"SSID"))return false;if(t.find('input[name="vlanEnabled"]').checked())if(!V.checkMinMax(t.find('input[name="vlan"]'),2,4095,"VLAN ID"))return false;if(t.data("wlan").security=="wpapsk")if(!V.checkPassphrase(t.find('input[name="passphrase"]'),"PSK"))return false;return true},get_posts:function(){e.ap.wlan_overrides=e.ap.wlan_overrides||[];var u=t.data("o").wlan_id,
x=t.data("o").radio,C=F(u,x);if(C==null){C=t.data("o");e.ap.wlan_overrides.push(C)}C.enabled=t.find('input[name="wlanEnabled"]').checked();C.vlan_enabled=t.find('input[name="vlanEnabled"]').checked();C.vlan=t.find('input[name="vlan"]').val();C.name=t.find('input[name="name"]').val();C.x_passphrase=t.find('input[name="passphrase"]').val();u=t.data("wlan");x=true;if(C.name!=u.name)x=false;if(!C.enabled!=!u.enabled)x=false;if(!C.vlan_enabled==!u.vlan_enabled){if(C.vlan_enabled&&C.vlan!=u.vlan)x=false}else x=
false;if(C.x_passphrase!=u.x_passphrase)x=false;if(x)e.ap.wlan_overrides=c.grep(e.ap.wlan_overrides,function(J){return J!=C});return{url:"/upd/device/"+e.ap._id,payload:{wlan_overrides:e.ap.wlan_overrides}}},done:function(){e._paint();w.find("p.settings-response").addClass("success").show().delay(1E3).fadeOut(500);t.hide();k.show()}});e.element.find('div.ap-configs input[name="remove"]').click(function(){confirm("Are you sure you want to remove the device from the system? UniFi will no longer be managing this device and the device will be restored to factory default.")&&
c.jcmd("devmgr","delete-ap",{mac:e._mac},function(){c("#model-aps").jtablemodel("refresh");e.dispose()})});var A=e.element.find("div.ap-configs select[name=move]");A.jselect({model:c("#model-sites"),defaultItem:"Move to ...",renderer:function(u,x){return x._id==c("body").attr("siteid")?u+" (current)":u}});A.change(function(){var u=A.val();if(u&&u!=c("body").attr("siteid"))confirm("Are you sure you want to move this device to another site, "+A.find("option:selected").text()+"?")?c.jpost("/cmd/sitemgr",
{cmd:"move-device",mac:e.ap.mac,site:u},function(){c("#RefreshSelect").jtimer("trigger")}):A.val("")});e.element.find('div.ap-configs input[name="shell"]').click(function(){window.open("/shell?mac="+e._mac+"&name="+e.ap.name,"_blank","toolbar=no,menubar=0,status=0,copyhistory=0,scrollbars=yes,resizable=1,location=0,Width=800,Height=600")});e.element.find(".debug-text").dblclick(function(u){u.metaKey?c.jcmd("devmgr","set-ssh",{mac:e.ap.mac},function(x){alert("SSH port: "+x.data[0].port)}):c.jcmd("devmgr",
"unset-ssh",{mac:e.ap.mac},function(){alert("SSH killed")})});e.element.find(".locate-button").click(function(){e.element.find(".locate-button").attr("disabled")!="disabled"&&c.jcmd.locate_ap(e.ap)});e.element.find(".restart-button").click(function(){c.jcmd.restart_ap(e.ap)});e.element.find(".adopt-button").click(function(){e.element.find(".adopt-button").attr("disabled")!="disabled"&&c.jcmd.adopt_ap(e.ap)});e.element.find(".scan-button").click(function(){if(!e.ap.scanning){e.ap.scanning=true;c.jcmd.scan_ap(e.ap)}});
e.element.find(".downlink-data-table").jtable({rows:[],pagesize:0}).jtable("addcol","AP","ap_mac",false,Renderer.apDetailLink,Renderer.apNameLower).jtable("addcol","Signal","rssi",false,Renderer.rssi).jtable("addaction","remove","unset_downlink",function(){return true}).bind("jtable_unset_downlink",function(u,x){c(u.originalTarget).disable();c.jcmd("devmgr","unset-vwire-uplink",{mac:x.ap_mac,uplink:e._mac},function(){c("#model-aps").jtablemodel("refresh");alert("Topology changed. Please wait a while for the new settings to propogate")})});
e.element.find(".uplinks-data-table").jtable({rows:[],emptydiv:e.element.find(".uplinks-data-table-none"),pagesize:0,debug:true}).jtable("addcol","AP","mac",false,Renderer.apDetailLink,Renderer.apNameLower).jtable("addcol","Channel","channel",false).jtable("addcol","Signal","rssi",false,Renderer.rssi).jtable("addaction","select","set_uplink",function(u){return!u.configured&&u.available}).jtable("addaction","remove","unset_uplink",function(u){return u.configured}).bind("jtable_set_uplink",function(u,
x){c(u.originalTarget).disable();c.jcmd("devmgr","set-vwire-uplink",{mac:e._mac,uplink:x.mac},function(){alert("Topology changed. Please wait a while for the new settings to propogate");c("#model-aps").jtablemodel("refresh")})}).bind("jtable_unset_uplink",function(u,x){c(u.originalTarget).disable();c.jcmd("devmgr","unset-vwire-uplink",{mac:e._mac,uplink:x.mac},function(){c("#model-aps").jtablemodel("refresh");alert("Topology changed. Please wait a while for the new settings to propogate")})});e.element.find("select.by-map").jselect({model:c("#model-maps"),
defaultItem:"All Locations"}).jselect("repaint");e.element.find("input[name=uplink-scan]").click(function(){var u=c(this);u.disable();c.jcmd("devmgr","scan-uplink",{map_id:e.element.find("select.by-map").val()},function(){setTimeout(function(){u.enable();c("#model-aps").jtablemodel("refresh")},5E3)})});c("#model-aps").bind("jtablemodel_refresh-done",e.model_aps_listener=function(){e.refresh()});c("#model-stas").bind("jtablemodel_refresh-done",e.model_stas_listener=function(){e._paint()});c("#model-wlangroups").bind("jtablemodel_refresh-done",
e.model_wlangroups_listener=function(){e._paint()});c("#model-wlanconfs").bind("jtablemodel_refresh-done",e.model_wlanconfs_listener=function(){e._paint()});e.element.find(".dialog-hide-button").click(function(){e.dispose()});e.refresh();return e},dispose:function(){c("#model-aps").unbind("jtablemodel_refresh-done",this.model_aps_listener);c("#model-stas").unbind("jtablemodel_refresh-done",this.model_stas_listener);c("#model-wlangroups").unbind("jtablemodel_refresh-done",this.model_wlangroups_listener);
c("#model-wlanconfs").unbind("jtablemodel_refresh-done",this.model_wlanconfs_listener);c(document.body).dialogManager("removeItem",this.element)},refresh:function(){this._mac=this.options.mac;this._model=this.options.model;(this.ap=this._model.jtablemodel("findrow","mac",this._mac))?this._paint():this.dispose()},_paint:function(){var e=this.ap||{},i=e.state==1||e.state==4||e.state==5,q=this.element;q.find("h2.ap-name").text(e.name||e.mac);this.configForm.jform("set_model",e);q.find("dd.mac-address").html(e.mac);
q.find("dd.model").html(Renderer.apModel(e.model));q.find("dd.version").html(e.version);q.find("dd.ip-address").html(e.ip);q.addClass("ap-model-"+e.model);var m=q.find("div.details-tab-content"),h=q.find("div.ap-radio"),p=q.find("div.ap-wlan");if(e.model=="U7E"||e.model=="U7O"||e.model=="U7Ev2"){m.find(".ap-na-header").text("Radio 5G (11n/a/ac)");h.find("fieldset.ap-na-configs legend").text("Radio 5G (11n/a/ac)");p.find("fieldset.ap-na-configs legend").text("WLANs 5G (11n/a/ac)")}else{m.find(".ap-na-header").text("Radio 5G (11n/a)");
h.find("fieldset.ap-na-configs legend").text("Radio 5G (11n/a)");p.find("fieldset.ap-na-configs legend").text("WLANs 5G (11n/a)")}q.removeClass("ap-unmanaged");q.removeClass("ap-adopted");q.removeClass("ap-adoptfailed");if(e.adopted){q.addClass("ap-adopted");e.locating?q.find(".locate-button").addClass("locating"):q.find(".locate-button").removeClass("locating");e.state==10&&q.addClass("ap-adoptfailed");q.find(".scan-button").setenabled(!e.scanning)}else e["default"]||q.addClass("ap-unmanaged");this.radioForm.jform("set_model",
e);q.find("div.ap-status").html(Renderer.apStatus(e.state,e));q.removeClass("ap-connected");q.removeClass("ap-disconnected");q.removeClass("ap-pending");q.removeClass("ap-uplink-wire");q.removeClass("ap-uplink-wireless");q.removeClass("ap-has-downlinks");q.removeClass("ap-needs-uplinks");if(i){q.addClass("ap-connected");q.find("dd.uptime").html(Renderer.uptime(e.uptime));q.find("dd.num-users").html(Renderer.staCount(e.mac,"user"));q.find("dd.num-guests").html(Renderer.staCount(e.mac,"guest"));q.find(".locate-button").setenabled(true);
var w=e.uplink||{};if(w.name=="eth0"||w.name=="eth1"){q.addClass("ap-uplink-wire");q.find(".uplink-type").html("(Wire)")}else if(w.name=="ath0"){q.addClass("ap-uplink-wireless");q.find(".uplink-type").html("(Wireless)")}q.find("dd.eth-duplex").html(w.full_duplex?"Full Duplex":"Half Duplex");q.find("dd.eth-speed").html(w.speed||"Unknown");q.find("dd.uplink-ap").html(Renderer.apDetailLink(w.ap_mac));q.find("dd.uplink-rssi").html(Renderer.rssi(w.rssi));q.find("dd.uplink-tx-rate").html(Renderer.apXRate(w.tx_rate));
q.find("dd.uplink-rx-rate").html(Renderer.apXRate(w.rx_rate));h=w.tx_packets||0;m=w.tx_bytes||0;p=w.rx_packets||0;var k=w.rx_bytes||0;w=(w["tx_bytes-r"]||0)+(w["rx_bytes-r"]||0);q.find("dd.uplink-bytes-rate").html(Renderer.pktsBytes(w)+"B/sec");q.find("dd.uplink-received").html(Renderer.pktsBytes(p)+" / "+Renderer.pktsBytes(k));q.find("dd.uplink-sent").html(Renderer.pktsBytes(h)+" / "+Renderer.pktsBytes(m));h=e.downlink_table||[];q.find(".downlink-data-table").jtable("option","rows",h).jtable("option",
"pagesize",h.length).jtable("refresh_options");if(h.length>0)q.addClass("ap-has-downlinks");else q.find("div.ap-downlink-content").hasClass("ui-accordion-content-active")&&q.find("div.details-tab-content").accordion("activate",0);var t=e.stat||{};e.radio_table=e.radio_table||[];c.each(e.radio_table,function(z,A){var u=A.radio,x=A.min_txpower||0,C=t[u+"-tx_packets"]||0,J=t[u+"-tx_bytes"]||0,B=t[u+"-tx_dropped"]||0,L=t[u+"-rx_packets"]||0,M=t[u+"-rx_bytes"]||0,S=t[u+"-rx_dropped"]||0,ga=t[u+"-tx_retries"]||
0,ca=t[u+"-rx_errors"]||0,R=C+B,ha=L+S,na=Math.min(e[u+"-tx_power"],30),va=e[u+"-gain"]||0,ua=e[u+"-eirp"]||parseInt(na)+va,wa=e[u+"-state"]||"RUN",la=e[u+"-extchannel"]||0;la=e[u+"-channel"]+(la>0?",+1":la<0?",-1":"");if("DFS_WAIT"==wa)la+=" (DFS Waiting)";if("INIT"==wa||!e[u+"-channel"]){q.find("dd."+u+"-channel").text("");q.find("dd."+u+"-tx-power").text("");q.find("dd."+u+"-tx-power").attr("title","")}else{q.find("dd."+u+"-channel").text(la);ua=ua+" dBm (EIRP)";x=na+" dBm"+(na==x?"(minimum)":
"")+(va>0?"+"+va+" dBi":"");q.find("dd."+u+"-tx-power").text(ua);q.find("dd."+u+"-tx-power").attr("title",x)}q.find("dd."+u+"-tx").html(Renderer.pktsBytes(C)+" / "+Renderer.pktsBytes(J));q.find("dd."+u+"-rx").html(Renderer.pktsBytes(L)+" / "+Renderer.pktsBytes(M));q.find("dd."+u+"-tx-error").html(Renderer.percentage(ga,R)+" / "+Renderer.percentage(B,R));q.find("dd."+u+"-rx-error").html(Renderer.percentage(ca,ha)+" / "+Renderer.percentage(S,ha));q.find("dd."+u+"-num-users").html(Renderer.staCount(e.mac,
"user-"+u));q.find("dd."+u+"-num-guests").html(Renderer.staCount(e.mac,"guest-"+u))})}else{q.addClass("ap-disconnected");q.addClass("ap-"+Renderer.apStatusType(e.state,e));q.find(".adopt-button").setenabled(e["default"]);q.find(".locate-button").setenabled(e["default"]&&e.state==2);q.find("dd.last-seen").html(Renderer.lastseen(e.last_seen*1E3))}h=q.find("div.ap-radio");m=h.find(".ap-na-configs select[name=channel]");p=c("#model-sysinfo").jsysinfo("data").cur_ccode;if(p.key=="US"||p.key=="CA"){this.ap.model==
"U5O"&&m.find("[band=1]").remove();this.ap.model=="U7P"&&m.find("[band=2]").remove()}if(!p.channels_na_80||p.channels_na_80.length==0||this.ap.model!="U7E"&&this.ap.model!="U7O"&&this.ap.model!="U7Ev2")h.find('.ap-na-configs select[name="ht"] option[value=80]').remove();if(this.ap.model=="U7E"||this.ap.model=="U7O"||this.ap.model=="U7Ev2")m.find("[band=2]").remove();if(q.hasClass("ap-uplink-wireless")||this.ap.model=="U7E"||this.ap.model=="U7O"||this.ap.model=="U7Ev2")q.find("option.roam").remove();
q.find("div.users-data-table").jtable("repaint");q.find("div.guests-data-table").jtable("repaint");this.element.find("select.wlan-group-ng").val(e.wlangroup_id_ng||c("#model-wlangroups").data("default_id")).change();this.element.find("select.wlan-group-na").val(e.wlangroup_id_na||c("#model-wlangroups").data("default_id")).change();h=q.find("form.ap-adv-adopt");h.find("input[name=ip]").val(e.adopt_ip||e.ip);h.find("input[name=url]").val(e.adopt_url||e.inform_url||"http://unifi:8080/inform");this.networkForm.jform("set_model",
e);e.uplink=e.uplink||{};h=e.uplink.type=="wireless";m=e.uplink_table||{};var F=false;c.each(m,function(z,A){if(A.configured)F=true});p=q.find(".uplinks-data-table");p.jtable("option","rows",m);p.jtable("option","pagesize",m.length);p.jtable("refresh_options");if(e.vwireEnabled&&(h||F||!i))q.addClass("ap-needs-uplinks");q.css("display","block");this.element.find("div.ap-configs select[name=move]").jselect("repaint")},widgetEventPrefix:"apDialog."});c.widget("ui.staDialog",{options:{mac:null,model:null},
_init:function(){var e=this,i=e.element;this._mac=this.options.mac;this._model=this.options.model;i.dialogTabs();i.find("div.config-tab-content").accordion({autoHeight:false});i.mousedown(function(){c(document.body).dialogManager("bringToFront",i)});i.draggable({handle:"div.dialog-header",containment:"window"});i.find('select[name="sta-usergroups"]').jselect({model:c("#model-usergroups"),defaultItem:"Automatic"}).jselect("repaint");i.find("div.history-data-table").jtable({url:"/list/session",params:{_limit:5,
_sort:"-assoc_time",mac:e.options.mac},pagesize:5,emptydiv:i.find(".history-data-table-empty")}).jtable("addcol","Date/Time","assoc_time",true,function(m){return Renderer.timestamp(m*1E3)}).jtable("addcol","Duration","duration",true,Renderer.uptime).jtable("addcol","Down","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Up","rx_bytes",true,Renderer.pktsBytes);var q=e.configForm=i.find("div.sta-config");q.jform({populate:function(m){q.find('input[name="alias"]:nofocus').val(m.name);q.find('textarea[name="note"]:nofocus').val(m.note);
q.find('select[name="sta-usergroups"]:nofocus').val(m.usergroup_id||"")},get_posts:function(){var m=i.find('textarea[name="note"]').val()!="";return{url:"/upd/user/"+e.user_id,payload:{name:q.find('input[name="alias"]').val(),note:q.find('textarea[name="note"]').val(),noted:m,usergroup_id:q.find('select[name="sta-usergroups"]').val()==""?null:i.find('select[name="sta-usergroups"]').val()}}},validate:function(){return true},done:function(){var m=q.find('input[name="alias"]').val(),h=q.find('textarea[name="note"]').val(),
p=q.find('select[name="sta-usergroups"]').val();c("#model-stas").data("sta_names")[e.sta.mac]=m;var w=e._model.jtablemodel("findrow","mac",e.sta.mac);if(w){w.name=m;w.note=h;w.usergroup_id=p}i.find("h2.sta-name").text(m);i.find('input[name="alias"]').val(m);i.find('textarea[name="note"]').val(h);i.find('select[name="sta-usergroups"]').val(p);i.find("p.settings-response").addClass("success").show().delay(1E3).fadeOut(500);c("#model-stas").jtablemodel("firechanged")}});c("#model-aps").bind("jtablemodel_refresh-done",
e.model_aps_listener=function(){e.refresh()});c("#model-stas").bind("jtablemodel_refresh-done",e.model_stas_listener=function(){e.refresh()});c("#model-usergroups").bind("jlistmodel_refresh-done",e.model_usergroups_listener=function(){e.refresh()});i.find(".dialog-hide-button").click(function(){e.dispose()});i.find(".block-button").click(function(){c.jcmd.block_sta(e.sta)});i.find(".reconnect-button").click(function(){c.jcmd.kick_sta(e.sta)});i.find(".unauthorize-button").click(function(){c.jcmd.unauthorize_guest(e.sta)});
e.refresh();return e},dispose:function(){c("#model-aps").unbind("jtablemodel_refresh-done",this.model_aps_listener);c("#model-stas").unbind("jtablemodel_refresh-done",this.model_stas_listener);c("#model-usergroups").unbind("jlistmodel_refresh-done",this.model_usergroups_listener);c(document.body).dialogManager("removeItem",this.element)},refresh:function(){var e=this;e.sta=this._model.jtablemodel("findrow","mac",this._mac);if(e.sta){e.sta.connected=true;e.user_id=e.sta.user_id;e._paint()}else c.jpost("/stat/user",
{mac:e._mac},function(i){e.sta=i.data[0];e.user_id=e.sta._id;e._paint()})},_paint:function(){var e=this.sta,i=this.options.mac;i=e.name||e.hostname||i;this.element.find("h2.sta-name").text(i);this.element.find("dd.mac-address").html(e.mac);this.element.find("dd.hostname").text(e.hostname);this.element.find("dd.connected-ap").html(Renderer.apDetailLink(e.ap_mac));this.element.find("dd.ip-address").html(e.ip);this.configForm.jform("set_model",e);this.element.find("dd.oui").text(e.oui||"Unknown");var q=
this.element.find("select.fixedAp");q.empty().append(c('<option value="auto">Any AP</option>'));c.each(c("#model-aps").jtablemodel("rows"),function(k,t){if(!t.adopted)return true;var F=Renderer.apName(t.mac);F+=t.mac==e.ap_mac?" (*)":t.state==1?" (up)":" (down)";c('<option value="'+t.mac+'">'+F+"</option>").appendTo(q)});this.element.find("div.history-data-table").jtable("refresh");this.element.removeClass("sta-connected");this.element.removeClass("sta-disconnected");this.element.removeClass("sta-isguest");
this.element.removeClass("sta-authorized");if(e.connected){this.element.addClass("sta-connected");e.is_guest&&this.element.addClass("sta-isguest");e.authorized&&this.element.addClass("sta-authorized");i=e.tx_packets||0;var m=e.tx_bytes||0,h=e.rx_packets||0,p=e.rx_bytes||0,w=(e["tx_bytes-r"]||0)+(e["rx_bytes-r"]||0);this.element.find("dd.essid").text(e.essid);this.element.find("dd.uptime").text(Renderer.uptime(e.uptime));this.element.find("dd.channel").text(Renderer.staChannel(e.channel,e));this.element.find("dd.signal").text(Renderer.rssi(e.rssi)+
" ("+e.signal+" dBm)");this.element.find("dd.powersave").text(e.powersave_enabled?"Enabled":"Not enabled");this.element.find("dd.tx-rate").text(e.tx_rate/1E3+"M");this.element.find("dd.rx-rate").text(e.rx_rate/1E3+"M");this.element.find("dd.bytes-rate").text(Renderer.pktsBytes(w)+"B/sec");this.element.find("dd.received").text(Renderer.pktsBytes(i)+" / "+Renderer.pktsBytes(m));this.element.find("dd.sent").text(Renderer.pktsBytes(h)+" / "+Renderer.pktsBytes(p))}else{this.element.addClass("sta-disconnected");
this.element.find("dd.last-seen").html(Renderer.lastseen(e.last_seen*1E3))}this.element.css("display","block")},widgetEventPrefix:"staDialog."})})(jQuery);function gmap_inited(){}function gmap_failed(){$(".gmap-dialog").find("iframe").remove();$(".gmap-dialog").dialog("close");alert("No Internet Connection. Please try again later.")}
$(function(){var c=$(".gmap-dialog");c.data("fn_open",function(e){$(".gmap-dialog").data("name",e);$(".gmap-dialog").find("h2").text("Map["+e+"]");c.find("iframe").length==0&&c.find("div.gsmap").append('<iframe src="/gsmap_iframe.jsp" height="100%" width="100%" style="border:0"></iframe>');$(".gmap-dialog").dialog("open")});c.dialog({autoOpen:false,modal:true,draggable:false,resizable:false,closeOnEscape:false,width:640,height:680,closeText:"",dialogClass:"gmap-snapshot-dialog"});c.find("input.cancel").click(function(){c.dialog("close")});
c.find("input.location").jsearch().bind("jsearch_search",function(){c.find("iframe").attr("contentWindow").set_location(c.find("input.location").val())});c.find("input.snapshot").click(function(){var e=c.find("iframe").attr("contentWindow").map;e&&$.jcmd("cfgmgr","save_gsmap",{name:c.data("name"),maptype:e.getMapTypeId(),zoom:e.getZoom(),lat:e.getCenter().lat(),lng:e.getCenter().lng()},function(i){i=i.data[0].map;i.selected=true;var q=$("#maplet").get(0);q&&q.flexcall("addMaps",[i]);c.dialog("close")})})});
$(function(){var c=$("#SiteSelect"),e=$("#AddSiteDialog");c.jselect({model:$("#model-sites"),renderer:function(i,q){return q.desc||i},fancy:true,fancy_paint:function(){if($("body").attr("super")){c.find("option:last").addClass("lastitem");c.append($('<option value="addsite" class="action">Add Site...</option>'))}c.val($("body").attr("siteid"))}});c.change(function(){var i=c.jselect("getprevselected"),q=c.val();if(q=="addsite"){e.jform("set_model",{name:"",desc:""});e.dialog("open");setTimeout(function(){e.find("input[name=name]").focus()},
100);c.val(i).click()}else{i=$("#model-sites").jtablemodel("findrow","_id",q);location.href=location.href.substring(0,location.href.indexOf(location.pathname))+"/manage/s/"+i.name}});e.dialog({modal:true,resizable:false,autoOpen:false,dialogClass:"ui-dark",buttons:[{"class":"ui-positive-alert apply",text:"Save",click:function(){}},{"class":"cancel",text:"Cancel",click:function(){$(this).dialog("close");return false}}]});e.jform({japply:e.dialog("widget").find(".apply"),detect_change:false,populate:function(i){e.find("input[name=name]").val(i.name);
e.find("input[name=desc]").val(i.desc)},get_posts:function(){return{url:"/cmd/sitemgr",payload:{name:e.find('input[name="name"]').val(),desc:e.find('input[name="desc"]').val(),cmd:"add-site"}}},validate:function(){V.checkEmpty(e.find("input[name=name]"),"Site Name");return true},done:function(){e.dialog("close");$("#model-sites").jtablemodel("refresh")}});$("#model-aps").bind("jtablemodel_refresh-done",function(i,q){var m=0,h=0,p=0;$("#Connected-AP-List").empty();$("#Disconnected-AP-List").empty();
$("#Pending-AP-List").empty();var w=$("#model-aps").data("ap_names");$.each(q._rows,function(){var k=$(this),t=k.attr("state");t=Renderer.apStatusType(t);var F=null;if(t=="ok"){F=$("#Connected-AP-List");p++}else if(t=="pending"){F=$("#Pending-AP-List");m++}else{F=$("#Disconnected-AP-List");h++}if(F.find("li").length<8)$('<li><a href="javascript:void(0);" class="ap-link" title="'+k.attr("mac")+'">'+w[k.attr("mac")]+"</a></li>").appendTo(F);else F.find("li").length==8&&$("<li> ... </li>").appendTo(F)});
$("#Connected-AP-List li").size()||$("#Connected-AP-List").append("<li>none</li>");$("#Disconnected-AP-List li").size()||$("#Disconnected-AP-List").append("<li>none</li>");$("#Pending-AP-List li").size()||$("#Pending-AP-List").append("<li>none</li>");$("#Connected-AP-Count").html(p);$("#Disconnected-AP-Count").html(h);$("#Pending-AP-Count").html(m)});$("#model-stas").bind("jtablemodel_refresh-done",function(i,q){var m=0,h=0;$.each(q._rows,function(){if(this.is_guest)h++;else m++});$("#User-Count").html(m);
$("#Guest-Count").html(h)});$("#model-aps").jtablemodel("refresh");$("#model-stas").jtablemodel("refresh");$("div.quick-ap-list").hide();$("li.connection-details").hover(function(){$(this).find('div.quick-ap-list[showing!="true"]').attr("showing","true").slideDown(250)},function(){$(this).find("div.quick-ap-list").slideUp(250,function(){$(this).attr("showing",null)})})});
$(function(){if($("body").attr("role")=="admin"){var c=$("#SettingsAdmins"),e=$("body").attr("adminid"),i=$("#InviteAdminDialog");c.find("form.admin-list");var q=$("#AdminTableContainer");q.jtable({url:"/cmd/sitemgr",params:{cmd:"get-admins"}}).jtable("addcol","Name","name",true,function(h,p){return h+(p._id==e?" (self)":p.is_super?" (super)":"")}).jtable("addcol","Email","email",true).jtable("addcol","Role","role",true,function(h){return h}).jtable("addaction","revoke","revoke",function(h){return h._id!=
e&&!h.is_super}).jtable("addaction","re-invite","invite",function(h){return h._id!=e&&h.email&&!h.is_super}).bind("jtable_invite",function(h,p){$.jpost("/cmd/sitemgr",{cmd:"invite-admin",email:p.email},function(){alert("An invitation has been sent to "+p.email)})}).bind("jtable_revoke",function(h,p){confirm("Are you sure you want to revoke?")&&$.jpost("/cmd/sitemgr",{cmd:"revoke-admin",admin:p._id},function(){q.jtable("refresh")})}).jtable("refresh");i.dialog({modal:true,resizable:false,autoOpen:false,
dialogClass:"ui-dark",buttons:[{"class":"ui-positive-alert apply",text:"Invite",click:function(){}},{text:"Cancel",click:function(){$(this).dialog("close");return false}}]});var m=i.find("form.admin-form");m.jform({japply:i.dialog("widget").find(".apply"),detect_change:false,populate:function(h){m.find("input[name=name]").val(h.name);m.find("input[name=email]").val(h.email);m.find("select[name=role]").val(h.role||"admin")},validate:function(){var h=m.find('input[name="email"]');if(!V.checkEmpty(h,
"Email Address"))return false;if(!V.checkEmail(h,"Email Address"))return false;if(!V.checkEmpty(m.find("input[name=name]"),"Admin Name")||!V.checkAdminName(m.find("input[name=name]"),"Admin Name"))return false;return true},get_posts:function(){return{url:"/cmd/sitemgr",payload:{name:m.find('input[name="name"]').val(),email:m.find("input[name=email]").val(),role:m.find("select[name=role]").val(),cmd:"invite-admin"}}},done:function(){i.dialog("close");q.jtable("refresh");alert("An invitation has been sent to "+
m.find("input[name=email]").val())}});c.find('input[name="invite"]').click(function(){m.jform("set_model",{});i.dialog("open")})}});
$(function(){if($("body").attr("role")=="admin"){var c=$("form.settings-form.controller");c.find('input[name="enableRemoteSyslog"]').change(function(){c.find('input[name="syslogHost"], input[name="syslogPort"]').setenabled($(this).checked())});c.find('input[name="enableSmtp"]').change(function(){var i=$(this).checked();c.find('input[name="smtpHost"], input[name="smtpPort"]').setenabled(i);c.find(".mail-server,.mail-sender,.test-mail-server").setvisible(i)});c.find('input[name="smtpSender"]').change(function(){var i=
$(this).checked();c.find('input[name="sender"]').setenabled(i)});c.find('input[name="smtpSSL"]').change(function(){var i=c.find("input[name=smtpPort]"),q=i.val();q=="25"&&$(this).checked()&&i.val("465");q=="465"&&!$(this).checked()&&i.val("25")});c.find('input[name="smtpAuthentication"]').change(function(){var i=$(this).checked();c.find('input[name="userName"], input[name="userPassword"]').setenabled(i)});var e=function(){var i=c.find('input[name="smtpHost"]'),q=c.find('input[name="smtpPort"]');if(!V.checkEmpty(i,
"SMTP Server host"))return false;if(!V.checkEmpty(q,"SMTP Server port")||!V.checkMinMax(q,1,65535))return false;if(c.find('input[name="smtpAuthentication"]').checked()){i=c.find('input[name="userName"]');q=c.find('input[name="userPassword"]');if(!V.checkEmpty(i,"Username"))return false;if(!V.checkEmpty(q,"Password"))return false}return true};c.find('input[name="testSmtp"]').click(function(){c.find('input[name="testSmtp"]');if(c.find('input[name="enableSmtp"]').checked()){if(e()){var i=c.find('input[name="email"]').val();
$.jcmd("cfgmgr","test_mail",{email:i,host:c.find('input[name="smtpHost"]').val(),port:c.find('input[name="smtpPort"]').val(),use_ssl:c.find('input[name="smtpSSL"]').checked(),use_auth:c.find('input[name="smtpAuthentication"]').checked(),username:c.find('input[name="userName"]').val(),use_sender:c.find('input[name="smtpSender"]').checked(),sender:c.find('input[name="sender"]').val(),x_password:c.find("input[name=userPassword]").jpass("val")},function(){alert(V.localize(Msg.I_SmtpEmailSent,i))})}}else alert(V.localize(Msg.E_SmtpNotConfigured))});
$("#model-settings").bind("jtablemodel_refresh-done",function(){c.jform("set_model",$("#model-settings").jtablemodel("map"))});c.jform({populate:function(i){var q=$(i.super_identity||{}),m=$(i.super_mgmt||{});i=$(i.super_smtp||{});c.data("super_identity",q).data("super_mgmt",m).data("super_smtp",i);c.find('input[name="systemName"]').val(q.attr("name"));c.find('input[name="enableServerDiscoverable"]').setchecked(m.attr_is("discoverable",false));c.find('input[name="enableSmtp"]').setchecked(i.attr_is("enabled",
false));c.find('input[name="smtpSender"]').setchecked(i.attr_is("use_sender",false));c.find('input[name="sender"]').val(i.attr("sender"));c.find('input[name="smtpHost"]').val(i.attr("host"));c.find('input[name="smtpPort"]').val(i.attr_get("port",25));c.find('input[name="smtpSSL"]').setchecked(i.attr_is("use_ssl",false));c.find('input[name="smtpAuthentication"]').setchecked(i.attr_is("use_auth",false));c.find('input[name="userName"]').val(i.attr("username"));c.find('input[name="userPassword"]').jpass({value:i.attr("x_password")})},
get_posts:function(){return[{url:"/set/setting/super_identity",payload:{name:c.find('input[name="systemName"]').val()}},{url:"/set/setting/super_mgmt",payload:{discoverable:c.find('input[name="enableServerDiscoverable"]').checked()}},{url:"/set/setting/super_smtp",payload:{enabled:c.find('input[name="enableSmtp"]').checked(),host:c.find('input[name="smtpHost"]').val(),port:c.find('input[name="smtpPort"]').val(),use_ssl:c.find('input[name="smtpSSL"]').checked(),use_auth:c.find('input[name="smtpAuthentication"]').checked(),
use_sender:c.find('input[name="smtpSender"]').checked(),sender:c.find('input[name="sender"]').val(),username:c.find('input[name="userName"]').val(),x_password:c.find("input[name=userPassword]").jpass("val")}}]},validate:function(){if(!V.checkEmpty(c.find('input[name="systemName"]'),"System Name"))return false;if(c.find('input[name="enableSmtp"]').checked()&&!e())return false;return true},done:function(){$("#model-settings").jtablemodel("refresh")}})}});
$(function(){function c(){var m=i.find('input[name="portalEnabled"]').checked();i.find(".auth-type").setvisible(m);var h=i.val_radio("guestAuthentication");i.find(".auth-password").setvisible(m&&h=="password");i.find(".term-of-use").setvisible(m&&(h=="none"||h=="password"));i.find(".expire").setvisible(m&&(h=="none"||h=="password"));i.find(".redirect").setvisible(m&&(h=="none"||h=="password"||h=="hotspot"));i.find(".custom-ip").setvisible(m&&h=="custom");i.find(".custom-portal").setvisible(m&&h!=
"custom");i.find("fieldset.hotspot").setvisible(m&&h=="hotspot");i.find(".portal-hostname").setvisible(m)}function e(){var m=i.find("input[name=doPayment]").checked(),h=i.find("select[name=gateway]").val();i.find(".gateway").setvisible(m);i.find(".paypal").setvisible(m&&h=="paypal");i.find(".stripe").setvisible(m&&h=="stripe");i.find(".quickpay").setvisible(m&&h=="quickpay");i.find(".authorize").setvisible(m&&h=="authorize");i.find(".merchantwarrior").setvisible(m&&h=="merchantwarrior")}var i=$("#GuestControlForm");
i.find("a.hotspotmanager").attr("href","/hotspot/s/"+$("body").attr("sitename"));i.find('input[name="portalEnabled"]').change(c);i.find('input[name="guestAuthentication"]').change(c);i.find('input[name="doRedirect"]').change(function(){i.find('input[name="redirectUrl"]').setenabled(i.val_radio("doRedirect")=="true")});i.find('select[name="expire"]').change(function(){i.find("span.customExpire").toggle(i.find('[name="expire"]').val()=="custom")});i.find("input[name=doPayment]").change(e);i.find("select[name=gateway]").change(e);
i.find("input[name=portalUseHostname]").change(function(){i.find("input[name=portalHostname]").setenabled(i.find("input[name=portalUseHostname]").checked())});$.each(["restricted","allowed"],function(m,h){i.find("input."+h+"-subnets").live("keyup",function(){var p=true;i.find("input."+h+"-subnets").each(function(w,k){if($(k).val()=="")p=false});p&&q(h,"")})});var q=function(m,h){var p=i.find("p."+m+"-subnets");$('<input text="text" class="'+m+'-subnets text-input" name="subnet"/>').val(h).appendTo(p);
$("<br />").appendTo(p)};$("#model-settings").bind("jtablemodel_refresh-done",function(){i.jform("set_model",$("#model-settings").jtablemodel("map"))});i.jform({populate:function(m){var h=$(m.guest_access||{});i.find('input[name="portalEnabled"]').setchecked(h.attr_is("portal_enabled",false));i.check_radio("guestAuthentication",h.attr_get("auth","none"));i.find('input[name="guestPassword"]').jpass({value:h.attr("x_password")});i.check_radio("doRedirect",h.attr_get("redirect_enabled",false));i.find('input[name="redirectUrl"]').val(h.attr("redirect_url"));
i.find('input[name="customIp"]').val(h.attr("custom_ip"));i.find('select[name="expire"]').val(h.attr_get("expire",480)).change();i.find('input[name="expireNumber"]').val(h.attr_get("expire_number",8));i.find('select[name="expireUnit"]').val(h.attr_get("expire_unit",60));i.find("input[name=doVoucher]").setchecked(h.attr_is("voucher_enabled",false));i.find("input[name=doPayment]").setchecked(h.attr_is("payment_enabled",false));i.find("select[name=gateway]").val(h.attr("gateway")||"paypal").change();
i.find("input[name=paypalUsername]").val(h.attr("x_paypal_username"));i.find("input[name=paypalPassword]").val(h.attr("x_paypal_password"));i.find("input[name=paypalSignature]").val(h.attr("x_paypal_signature"));i.find("input[name=doPaypalUseSandbox]").setchecked(h.attr_is("paypal_use_sandbox",false));i.find("input[name=stripeApiKey]").val(h.attr("x_stripe_api_key"));i.find("input[name=quickpayMerchantId]").val(h.attr("x_quickpay_merchantid"));i.find("input[name=quickpayMd5Secret]").val(h.attr("x_quickpay_md5secret"));
i.find("input[name=authorizeApiLoginId]").val(h.attr("x_authorize_loginid"));i.find("input[name=authorizeTransactionKey]").val(h.attr("x_authorize_transactionkey"));i.find("input[name=doAuthorizeSandbox]").setchecked(h.attr_is("authorize_use_sandbox",false));i.find("input[name=merchantwarriorMerchantUuid]").val(h.attr("x_merchantwarrior_merchantuuid"));i.find("input[name=merchantwarriorApiKey]").val(h.attr("x_merchantwarrior_apikey"));i.find("input[name=merchantwarriorApiPassphrase]").val(h.attr("x_merchantwarrior_apipassphrase"));
i.find("input[name=doMerchantWarriorSandbox]").setchecked(h.attr_is("merchantwarrior_use_sandbox",false));i.find("input[name=doCustomPortal]").setchecked(h.attr_is("portal_customized",false));i.find("input[name=portalUseHostname]").setchecked(h.attr_is("portal_use_hostname",false));i.find("input[name=portalHostname]").val(h.attr("portal_hostname"));$.each(["restricted","allowed"],function(p,w){i.find("p."+w+"-subnets").empty();for(var k=1;k<32;k++){var t=h.attr(w+"_subnet_"+k);if(!t)break;q(w,t)}q(w,
"")})},get_posts:function(){var m={};m.portal_enabled=i.find('input[name="portalEnabled"]').checked();m.auth=i.val_radio("guestAuthentication");m.x_password=i.find('input[name="guestPassword"]').jpass("val");m.redirect_enabled=i.val_radio("doRedirect")=="true";m.redirect_url=i.find('input[name="redirectUrl"]').val();m.custom_ip=i.find('input[name="customIp"]').val();m.expire=i.find('select[name="expire"]').val();if(m.expire=="custom"){m.expire_number=i.find('input[name="expireNumber"]').val();m.expire_unit=
i.find('select[name="expireUnit"]').val()}m.voucher_enabled=i.find("input[name=doVoucher]").checked();m.payment_enabled=i.find("input[name=doPayment]").checked();m.gateway=i.find("select[name=gateway]").val();m.x_paypal_username=i.find("input[name=paypalUsername]").val();m.x_paypal_password=i.find("input[name=paypalPassword]").val();m.x_paypal_signature=i.find("input[name=paypalSignature]").val();m.paypal_use_sandbox=i.find("input[name=doPaypalUseSandbox]").checked();m.x_stripe_api_key=i.find("input[name=stripeApiKey]").val();
m.x_quickpay_merchantid=i.find("input[name=quickpayMerchantId]").val();m.x_quickpay_md5secret=i.find("input[name=quickpayMd5Secret]").val();m.x_authorize_loginid=i.find("input[name=authorizeApiLoginId]").val();m.x_authorize_transactionkey=i.find("input[name=authorizeTransactionKey]").val();m.authorize_use_sandbox=i.find("input[name=doAuthorizeSandbox]").checked();m.x_merchantwarrior_merchantuuid=i.find("input[name=merchantwarriorMerchantUuid]").val();m.x_merchantwarrior_apikey=i.find("input[name=merchantwarriorApiKey]").val();
m.x_merchantwarrior_apipassphrase=i.find("input[name=merchantwarriorApiPassphrase]").val();m.merchantwarrior_use_sandbox=i.find("input[name=doMerchantWarriorSandbox]").checked();m.portal_customized=i.find("input[name=doCustomPortal]").checked();m.portal_use_hostname=i.find("input[name=portalUseHostname]").checked();m.portal_hostname=i.find("input[name=portalHostname]").val();$.each(["restricted","allowed"],function(h,p){h=1;i.find("input."+p+"-subnets").each(function(){var w=$.trim($(this).val());
if(w)m[p+"_subnet_"+h++]=w;else m[p+"_subnet_"+h++]=null})});return{url:"/set/setting/guest_access",payload:m}},validate:function(){if(i.find('input[name="portalEnabled"]').checked()){var m=i.val_radio("guestAuthentication");if(i.find('[name="expire"]').val()=="custom")if(!V.checkInteger(i.find('input[name="expireNumber"]'),"expire time"))return false;if(m=="password"){if(!V.checkEmpty(i.find('input[name="guestPassword"]'),"Guest Password"))return false}else if(m=="custom")if(!V.checkEmpty(i.find('input[name="customIp"]'),
"IP Address")||!V.checkIP(i.find('input[name="customIp"]'),"Custom Portal"))return false;if(i.val_radio("doRedirect")=="true")if(!V.checkEmpty(i.find('input[name="redirectUrl"]'),"Promotional URL"))return false;if(i.find("input[name=portalUseHostname]").checked())if(!V.checkEmpty(i.find("input[name=portalHostname]"),"Portal Hostname")||!V.checkRE(i.find("input[name=portalHostname]"),"Portal Hostname",V.reHostname,Msg.E_InvalidHostname))return false;if(i.find("input[name=doPayment]").checked()){var h=
i.find("select[name=gateway]").val();if(h=="paypal"){if(!V.checkEmpty(i.find("input[name=paypalUsername]"),"PayPal Username"))return false;if(!V.checkEmpty(i.find("input[name=paypalPassword]"),"PayPal Password"))return false;if(!V.checkEmpty(i.find("input[name=paypalSignature]"),"PayPal Signature"))return false}else if(h=="stripe"){if(!V.checkEmpty(i.find("input[name=stripeApiKey]"),"Stripe API Key"))return false}else if(h=="quickpay"){if(!V.checkEmpty(i.find("input[name=quickpayMerchantId]"),"Merchant ID"))return false;
if(!V.checkEmpty(i.find("input[name=quickpayMd5Secret]"),"MD5 Secret"))return false}else if(h=="authorize"){if(!V.checkEmpty(i.find("input[name=authorizeApiLoginId]"),"API Login ID"))return false;if(!V.checkEmpty(i.find("input[name=authorizeTransactionKey]"),"Transaction Key"))return false}else if(h=="merchantwarrior"){if(!V.checkEmpty(i.find("input[name=merchantwarriorMerchantUuid]"),"Merchant UUID"))return false;if(!V.checkEmpty(i.find("input[name=merchantwarriorApiKey]"),"API Key"))return false;
if(!V.checkEmpty(i.find("input[name=merchantwarriorApiPassphrase]"),"API Passphrase"))return false}}if(m=="hotspot"&&!i.find("input[name=doPayment]").checked()&&!i.find("input[name=doVoucher]").checked()){alert(V.localize(Msg.E_GuestNoHotspotPaymentSelected));return false}}var p=true;i.find("input.restricted-subnets, input.allowed-subnets").each(function(){var w=$.trim($(this).val());if(w)if(!V.checkSubnetSpec($(this),w))return p=false});if(!p)return false;return true},done:function(){i.find('input[name="guestPassword"]').jpass("hide")}})});
$(function(){var c=$("#SystemForm");c.find('input[name="useFixedURL"]').change(function(){c.find('input[name="fixedURLHost"], #SystemForm input[name="fixedURLPort"]').setenabled(c.find('input[name="useFixedURL"][value="true"]').checked())});c.find('input[name="enableConnectivityMonitor"]').change(function(){c.find(".isolated-wlan-status").setvisible($(this).checked());c.find(".uplink-type").setvisible($(this).checked());$(this).checked()?c.find('input[name="uplinkType"]').change():c.find(".custom-uplink-host").setvisible(false)});
c.find('input[name="uplinkType"]').change(function(){var q=c.val_radio("uplinkType");c.find(".custom-uplink-host").setvisible(q=="custom")});c.find("input[name=enableSNMP]").change(function(){c.find("input[name=snmpCommunity]").setenabled($(this).checked())});c.find('input[name="enableRemoteSyslog"]').change(function(){c.find('input[name="syslogHost"], input[name="syslogPort"]').setenabled($(this).checked())});c.find('input[name="sshPassword"]').jpass();c.find("input[name=delete]").japply({get_posts:function(){return{url:"/cmd/sitemgr",
payload:{cmd:"delete-site",site:$("body").attr("siteid")}}},validate:function(){if($("#model-sites").jtablemodel("findrow","_id",$("body").attr("siteid")).attr_no_delete){alert("This site cannot be deleted");return false}return confirm("Are you sure you want to delete the site? All data associated with the site will be removed permanantly.")},done:function(){location.href="/logout"}});var e=false,i=false;$("#model-settings").bind("jtablemodel_refresh-done",function(){(e=true)&&i&&c.jform("set_model",
$("#model-settings").jtablemodel("map"))});$("#model-sysinfo").bind("jsysinfo_changed",function(){i=true;e&&i&&c.jform("set_model",$("#model-settings").jtablemodel("map"))});$("#model-sites").bind("jtablemodel_refresh-done",function(){var q=$("#model-sites").jtablemodel("findrow","_id",$("body").attr("siteid"));c.find("input[name=siteDesc]").val(q.desc||q.name)});c.jform({populate:function(q){var m=$(q.rsyslogd||{}),h=$(q.connectivity||{}),p=$(q.mgmt||{}),w=$(q.country||{});q=$(q.snmp||{});c.data("mgmt",
p).data("connectivity",h).data("rsyslogd",m).data("country",w);var k=c.find('select[name="countryCode"]');$.each($("#model-sysinfo").jsysinfo("data").ccodes,function(t,F){$("<option></option>").val(F.code).html(F.name).appendTo(k)});k.val(w.attr_get("code",840));c.find('input[name="enableLED"]').setchecked(p.attr_is("led_enabled",true));c.find('input[name="enableAutoUpgrade"]').setchecked(p.attr_is("auto_upgrade",false));c.check_radio("uplinkType",h.attr_get("uplink_type","gateway"));c.find('input[name="uplink_host"]').val(h.attr("uplink_host"));
c.find('input[name="enableConnectivityMonitor"]').setchecked(h.attr_is("enabled",true));c.find('input[name="enableIsolatedWLAN"]').setchecked(h.attr_is("enable_isolated_wlan",false));c.find("input[name=enableSNMP]").setchecked(q.attr_is("enabled",false));c.find('input[name="snmpCommunity"]').val(q.attr("community"));c.find('input[name="enableRemoteSyslog"]').setchecked(m.attr_is("enabled",false));c.find('input[name="syslogHost"]').val(m.attr("ip"));c.find('input[name="syslogPort"]').val(m.attr_get("port",
514));c.find('input[name="sshUsername"]').val(p.attr("x_ssh_username"));c.find('input[name="sshPassword"]').jpass("val",p.attr("x_ssh_password"))},get_posts:function(){return[{url:"/cmd/sitemgr",payload:{cmd:"update-site",desc:c.find("input[name=siteDesc]").val()}},{url:"/set/setting/mgmt",payload:{auto_upgrade:c.find('input[name="enableAutoUpgrade"]').checked(),led_enabled:c.find('input[name="enableLED"]').checked(),x_ssh_username:c.find('input[name="sshUsername"]').val(),x_ssh_password:c.find('input[name="sshPassword"]').jpass("val")}},
{url:"/set/setting/connectivity",payload:{enabled:c.find('input[name="enableConnectivityMonitor"]').checked(),uplink_type:c.val_radio("uplinkType"),uplink_host:c.find('input[name="uplink_host"]').val(),enable_isolated_wlan:c.find('input[name="enableIsolatedWLAN"]').checked()}},{url:"/set/setting/rsyslogd",payload:{enabled:c.find('input[name="enableRemoteSyslog"]').checked(),ip:c.find('input[name="syslogHost"]').val(),port:c.find('input[name="syslogPort"]').val()}},{url:"/set/setting/snmp",payload:{enabled:c.find('input[name="enableSNMP"]').checked(),
community:c.find('input[name="snmpCommunity"]').val()}},{url:"/set/setting/country",payload:{code:c.find('select[name="countryCode"]').val()}}]},validate:function(){if(c.find('input[name="enableConnectivityMonitor"]').checked()&&c.val_radio("uplinkType")=="custom"&&!V.checkIP(c.find('input[name="uplink_host"]'),"Uplink IP address"))return false;if(!V.checkEmpty(c.find("input[name=sshUsername]"),"Device Username")||!V.checkAdminName(c.find("input[name=sshUsername]"),"Device Username"))return false;
if(!V.checkEmpty(c.find("input[name=sshPassword]"),"Device Password"))return false;if(c.find('input[name="enableRemoteSyslog"]').checked()){var q=c.find('input[name="syslogHost"]'),m=c.find('input[name="syslogPort"]');if(!V.checkEmpty(q,"Remote Syslog Server host"))return false;if(!V.checkEmpty(m,"Remote Syslog Server port")||!V.checkMinMax(m,1,65535))return false}return true},done:function(){e=i=false;$("#model-sysinfo").jsysinfo("refresh");$("#model-settings").jtablemodel("refresh");$("#model-sites").jtablemodel("refresh");
c.data("country").attr("code",c.find('select[name="countryCode"]').val())}})});
$(function(){var c=$("#SettingsUserGroups"),e=c.find(".settings-list"),i=$("#UserGroupsForm");e.find('input[name="create"]').click(function(){q({name:"UserGroup",qos_rate_max_up:"-1",qos_rate_max_down:"-1"})});c.find("li.list a").click(function(){m()});var q=function(h){var p=h._id==undefined?true:false;c.find("li.form a").text(p?"New User Group":h.name);c.find("li.form").show();i.find('input[name="apply"]').val(p?"Create":"Apply");i.jform("set_model",h);e.hide();i.show();p&&i.find('input[name="name"]').select().focus()},
m=function(){c.find("li.form").hide();i.hide();e.show()};$("#UserGroupsTableContainer").jtable({model:$("#model-usergroups"),className:"stat"}).jtable("addcol","Name","name",true).jtable("addcol","Bandwidth Limit","qos_rate_max_down",true,function(h,p){return"Download: "+(p.qos_rate_max_down==-1?"Unlimited":p.qos_rate_max_down+" Kbps")+", Upload: "+(p.qos_rate_max_up==-1?"Unlimited":p.qos_rate_max_up+" Kbps")}).jtable("addaction","edit","edit").jtable("addaction","delete","delete",function(h){return $("body").attr("role")==
"admin"&&!h.attr_no_delete}).bind("jtable_edit",function(h,p){q(p)}).bind("jtable_delete",function(h,p){if(p.attr_no_delete)alert(V.localize(Msg.E_InvalidDelete,p.name));else confirm("Are you sure you want to delete the object?")&&$.jpost("/del/usergroup/"+p._id,{},function(){$("#UserGroupsTableContainer").jtable("option","model").jtablemodel("deleterow","_id",p._id);$("#UserGroupsTableContainer").jtablemodel("firechanged");$("#model-usergroups").jlistmodel("deleterow","_id",p._id)})});i.jform({populate:function(h){i.find('input[name="name"]').val(h.name);
i.find('input[name="downRateEnabled"]').setchecked(h.downRate_enabled);i.find('input[name="downRate"]').val(h.qos_rate_max_down>-1?h.qos_rate_max_down:"");i.find('input[name="upRateEnabled"]').setchecked(h.upRate_enabled);i.find('input[name="upRate"]').val(h.qos_rate_max_up>-1?h.qos_rate_max_up:"")},validate:function(){if(!V.checkEmpty(i.find('input[name="name"]'),"Name"))return false;if(i.find('input[name="downRateEnabled"]').checked())if(!V.checkMinMax(i.find('input[name="downRate"]'),2,102400,
"Download Bandwidth Limit")||!V.checkEmpty(i.find('input[name="downRate"]'),"Download Bandwidth"))return false;if(i.find('input[name="upRateEnabled"]').checked())if(!V.checkMinMax(i.find('input[name="upRate"]'),2,102400,"Upload Bandwidth Limit")||!V.checkEmpty(i.find('input[name="upRate"]'),"Upload Bandwidth"))return false;return true},get_posts:function(h){var p=h._id,w=i.find('input[name="downRateEnabled"]').checked(),k=i.find('input[name="upRateEnabled"]').checked();return{url:p?"/upd/usergroup/"+
h._id:"/add/usergroup",payload:{name:i.find('input[name="name"]').val(),downRate_enabled:i.find('input[name="downRateEnabled"]').checked(),qos_rate_max_down:w?i.find('input[name="downRate"]').val():-1,upRate_enabled:i.find('input[name="upRateEnabled"]').checked(),qos_rate_max_up:k?i.find('input[name="upRate"]').val():-1}}},done:function(){$("#UserGroupsTableContainer").jtable("refresh");m()}});i.find('input[name="downRateEnabled"]').change(function(){i.find('input[name="downRate"]').setenabled($(this).checked())});
i.find('input[name="upRateEnabled"]').change(function(){i.find('input[name="upRate"]').setenabled($(this).checked())});i.find('input[name="cancel"]').click(function(){m()})});
$(function(){var c=$("#SettingsWirelessNetworksControl"),e=c.find("ul.bread-crumbs"),i=c.find("form.groups"),q=c.find("li.grouplist select"),m=c.find("li.grouplist .add"),h=c.find("li.grouplist .del"),p=c.find("li.grouplist .label"),w=$("#AddWlangroupDialog"),k=c.find("form.wlangroup"),t=$("#WirelessNetworksForm"),F=c.find(".choose-view"),z=function(x){p.show();e.find(".grouplist .select").hide();var C=x._id==undefined?true:false;c.find("li.form a").text(C?"New Wireless Network":x.name);c.find("li.form").setvisible(true);
t.find('input[name="apply"]').val(C?"Create":"Apply");t.jform("set_model",x);k.hide();t.show();C&&t.find('input[name="name"]').select().focus()},A=function(){c.find("li.form").hide();t.hide();k.show();p.hide();e.find(".grouplist .select").show()};k.find('input[name="create"]').click(function(){z({name:"Name",security:"wpapsk",enabled:true})});k.find("select[name=roam_radio]").change(function(){var x=k.find("select[name=roam_radio]").val()=="ng";k.find("select[name=roam_channel_ng]").setvisible(x);
k.find("select[name=roam_channel_na]").setvisible(!x)});k.find("input[name=loadbalance_enabled]").change(function(){k.find("input[name=maxsta]").setenabled(k.find("input[name=loadbalance_enabled]").checked())});k.jform({populate:function(x){var C=x.roam_enabled;k.find("input[name=name]").val(x.name);k.find(".roamRadio, .roamChannel").setvisible(C);k.find(".legacySupported, .loadBalance").setvisible(!C);k.find("input[name=roam_enabled]").setchecked(C);k.find("select[name=roam_radio]").val(x.roam_radio||
"ng").change();x.roam_channel_ng&&k.find("select[name=roam_channel_ng]").val(x.roam_channel_ng);x.roam_channel_na&&k.find("select[name=roam_channel_na]").val(x.roam_channel_na);k.find("input[name=loadbalance_enabled]").setchecked(x.loadbalance_enabled);k.find("input[name=maxsta]").val(x.maxsta);k.find("input[name=b_supported]").setchecked(x.b_supported)},validate:function(){if(!V.checkEmpty(k.find("input[name=name]"),"WLAN Group Name"))return false;if(k.find("input[name=loadbalance_enabled]").checked()&&
!V.checkInteger(k.find("input[name=maxsta]"),"Stations per radio"))return false;return true},get_posts:function(){return{url:"/upd/wlangroup/"+k.jform("model")._id,payload:{name:k.find('input[name="name"]').val(),roam_enabled:k.find("input[name=roam_enabled]").checked(),roam_radio:k.find("select[name=roam_radio]").val(),roam_channel_ng:k.find("select[name=roam_channel_ng]").val(),roam_channel_na:k.find("select[name=roam_channel_na]").val(),loadbalance_enabled:k.find("input[name=loadbalance_enabled]").checked(),
maxsta:k.find("input[name=maxsta]").val(),b_supported:k.find("input[name=b_supported]").checked()}}},done:function(){$("#model-wlangroups").jtablemodel("refresh")}});w.dialog({modal:true,resizable:false,autoOpen:false,dialogClass:"ui-dark",buttons:[{"class":"ui-positive-alert apply",text:"Create",click:function(){}},{text:"Cancel",click:function(){$(this).dialog("close");return false}}]});var u=w.find("form");u.jform({japply:w.dialog("widget").find(".apply"),detect_change:false,get_posts:function(){var x=
u.find("select[name=roam_radio]").val();return{url:"/add/wlangroup",payload:{name:u.find('input[name="name"]').val(),roam_enabled:u.find("input[name=roam_enabled]").checked(),roam_radio:x,roam_channel_ng:u.find("select[name=roam_channel_ng]").val(),roam_channel_na:u.find("select[name=roam_channel_na]").val()}}},validate:function(){if(!V.checkEmpty(u.find("input[name=name]"),"WLAN Group Name"))return false;return true},done:function(x){x=x.data[0];$("#model-wlangroups").jtablemodel("appendrows",[x]);
q.val(x._id).change();w.dialog("close")}});u.find("input[name=roam_enabled]").change(function(){var x=u.find("input[name=roam_enabled]").checked();u.find(".roamChannel, .roamRadio").setvisible(x)}).setchecked(false);u.find("select[name=roam_radio]").change(function(){var x=u.find("select[name=roam_radio]").val()=="ng";u.find("select[name=roam_channel_ng]").setvisible(x);u.find("select[name=roam_channel_na]").setvisible(!x)}).val("ng").change();F.jchoose({selected:"wlans"}).bind("jchoose_selected",
function(){k.find(".settings-fieldset").hide();k.find(".settings-fieldset."+F.jchoose("selected")).show()});$("#model-wlangroups").bind("jtablemodel_refresh-done",function(){A();e.find(".group").hide();k.hide();i.show();q.val($("#model-wlangroups").jtablemodel("findrow","attr_hidden_id","Default")._id).change()});q.jselect({model:$("#model-wlangroups"),sortby:"name",compareRenderer:function(x){return x.toLowerCase()},renderer:function(x,C){var J=x;if(C.roam_enabled){J+=" (Zero-Handoff, "+(C.roam_radio==
"ng"?"2G":"5G");J+=" ,channel "+(C.roam_radio=="ng"?C.roam_channel_ng:C.roam_channel_na)+")"}return J}}).change(function(){var x=q.jselect("getselected");if(x){h.setenabled(!x.attr_hidden_id);p.text("["+x.name+"]");$("#WlanConfTableContainer").jtable("addfilter","wlangroup_id",x._id).jtable("filter");k.find('input[name="create"]').setenabled($("#WlanConfTableContainer").jtable("size")<4);k.jform("set_model",x);k.show();F.find("a[href=#wlans]").click()}});m.click(function(){$("#AddWlangroupDialog").dialog("open")});
h.click(function(){var x=k.jform("model");if(x)h.is(".disabled")||confirm("Are you sure you want to delete the wlan group along with all the settings associated?")&&$.jpost("/del/wlangroup/"+x._id,{},function(){$("#model-wlangroups").jtablemodel("deleterow","_id",x._id)})});p.click(A);$("#model-wlanconfs").bind("jtablemodel_refresh-done",function(){$("#WlanGroupTableContainer").jtable("repaint")});$("#WlanConfTableContainer").jtable({model:$("#model-wlanconfs"),hidetoolbar:true,className:"stat"}).jtable("addcol",
"Name","name",true).jtable("addcol","Security","security",true).jtable("addcol","Guest Network","is_guest",true,function(x){return x?"Yes":"No"}).jtable("addaction","edit","edit").jtable("addaction","delete","delete",function(){return $("body").attr("role")=="admin"}).bind("jtable_edit",function(x,C){z(C)}).bind("jtable_delete",function(x,C){confirm("Are you sure you want to delete the object?")&&$.jpost("/del/wlanconf/"+C._id,{},function(){$("#WlanConfTableContainer").jtable("option","model").jtablemodel("deleterow",
"_id",C._id);$("#WlanConfTableContainer").jtablemodel("firechanged")})}).bind("jtable_refresh-done",function(){q.change()});t.find('input[name="passphrase"]').jpass();t.find('input[name="wepKey"]').jpass();t.find('input[name="radiusSecret1"]').jpass();t.find('select[name="userGroup"]').jselect({model:$("#model-usergroups")});t.find('input[name="securityType"]').change(function(){var x=t.val_radio("securityType");t.find(".security").hide();t.find(".security."+x).show();x=x=="wpapsk"||x=="wpaeap"?true:
false;t.find(".WPA").setvisible(x&&!k.jform("model").roam_enabled)});t.find('input[name="vlanEnabled"]').change(function(){t.find('input[name="vlan"]').setenabled($(this).checked())});t.jform({populate:function(x){var C=x._id==undefined?true:false,J=k.jform("model").roam_enabled;t.find(".no-roam").setvisible(!J);t.find('input[name="name"]').val(x.name);t.find('input[name="enabled"]').setchecked(x.enabled);t.check_radio("securityType",x.security);t.find('input[name="passphrase"]').jpass("val",x.x_passphrase||
"").jpass(C?"show":"hide");t.find('select[name="wepIdx"]').val(x.wep_idx||1);t.find('input[name="wepKey"]').jpass("val",x.x_wep||"").jpass(C?"show":"hide");t.find('input[name="radiusIp1"]').val(x.radius_ip_1);t.find('input[name="radiusPort1"]').val(x.radius_port_1||1812);t.find('input[name="radiusSecret1"]').jpass("val",x.x_radius_secret_1||"").jpass(C?"show":"hide");t.find('input[name="is_guest"]').setchecked(x.is_guest);C=x.vlan||0;t.find('input[name="vlanEnabled"]').setchecked(x.vlan_enabled);
t.find('input[name="vlan"]').val(C>1?C:"");t.find('input[name="hideSSID"]').setchecked(x.hide_ssid||false);t.find("select[name=wpaMode]").val(x.wpa_mode||"auto");t.find("select[name=wpaEnc]").val(x.wpa_enc||"ccmp");t.find('select[name="userGroup"]').val(x.usergroup_id)},validate:function(){var x=t.find('input[name="name"]');if(!V.checkEmpty(x,"Name")||!V.checkSsid(x,"Name"))return false;x=t.val_radio("securityType");if(x=="wep"){x=t.find('input[name="wepKey"]');if(!V.checkEmpty(x,"WEP Key")||!V.checkRE(x,
"WEP Key",V.reWEP,Msg.E_InvalidWEP))return false}else if(x=="wpapsk"){x=t.find('input[name="passphrase"]');if(!V.checkPassphrase(x,"Passphrase"))return false}else if(x=="wpaeap"){x=t.find('input[name="radiusIp1"]');var C=t.find('input[name="radiusPort1"]'),J=t.find('input[name="radiusSecret1"]');if(!V.checkEmpty(x,"IP Address")||!V.checkIP(x,"IP Address"))return false;if(!V.checkEmpty(C,"IP Address")||!V.checkMinMax(C,1,65535,"Port"))return false;if(!V.checkEmpty(J,"Password"))return false}if(t.find('input[name="vlanEnabled"]').checked())if(!V.checkMinMax(t.find('input[name="vlan"]'),
2,4095,"VLAN ID"))return false;return true},get_posts:function(x){return{url:x._id?"/upd/wlanconf/"+x._id:"/add/wlanconf",payload:{name:t.find('input[name="name"]').val(),security:t.val_radio("securityType"),x_passphrase:t.find('input[name="passphrase"]').jpass("val"),wep_idx:t.find('select[name="wepIdx"]').val(),x_wep:t.find('input[name="wepKey"]').jpass("val"),enabled:t.find('input[name="enabled"]').checked(),radius_ip_1:t.find('input[name="radiusIp1"]').val(),radius_port_1:t.find('input[name="radiusPort1"]').val(),
x_radius_secret_1:t.find('input[name="radiusSecret1"]').jpass("val"),is_guest:t.find('input[name="is_guest"]').checked(),vlan_enabled:t.find('input[name="vlanEnabled"]').checked(),vlan:t.find('input[name="vlan"]').val(),hide_ssid:t.find('input[name="hideSSID"]').checked(),wpa_mode:t.find('select[name="wpaMode"]').val(),wpa_enc:t.find('select[name="wpaEnc"]').val(),usergroup_id:t.find('select[name="userGroup"]').val(),wlangroup_id:k.jform("model")._id}}},done:function(){$("#model-wlanconfs").jtablemodel("refresh");
A()}});t.find('input[name="cancel"]').click(function(){A()})});
$(function(){var c=$("#AccessPoints"),e=$("#AccessPointDataTableContainer"),i=$("body").attr("role")=="admin",q={overview:["state","ip","num_sta","tx_bytes","rx_bytes","channel","actions"],config:["state","modelname","version","wlangroup_id_ng","wlangroup_id_na","radio_ng","radio_na","actions"],activity:["state","ip","ng-num_sta","na-num_sta","client_rates","tx_bytes-d","rx_bytes-d","radio_ng_act","radio_na_act","channel"]},m=c.find("ul.choose-view").jchoose().bind("jchoose_selected",function(z,A){$.each(q,
function(u,x){u!=A&&$.each(x,function(C,J){e.jtable("hidecol",J)})});$.each(q[A],function(u,x){e.jtable("showcol",x)});e.jtable("repaint")}),h=c.find("input[name=rollupgrade]"),p=function(){var z=true,A=false;$.each($("#model-aps").jtablemodel("rows"),function(u,x){if(x.upgradable)z=false;if(x.rollupgrade)A=true});h.removeClass("inprogress");A&&h.addClass("inprogress");h.val(A?"rolling upgrade in progress...":"start rolling upgrade");h.setenabled(!z)};h.click(function(){h.hasClass("inprogress")?$.jcmd("devmgr",
"unset-rollupgrade",{},function(){$("#model-aps").jtablemodel("refresh")}):$.jcmd("devmgr","set-rollupgrade",{},function(){$("#model-aps").jtablemodel("refresh");alert("Rolling upgrade scheduled, click the button again to cancel")})});var w=function(z,A,u){if(!u.adopted||!u["radio_"+z])return"";A=$("#model-wlangroups").jtablemodel("findrow","_id",A);if(A==null)A=$("#model-wlangroups").jtablemodel("findrow","attr_hidden_id","Default");var x=false;u.wlan_overrides&&u.wlan_overrides.length>0&&$.each(u.wlan_overrides,
function(C,J){if(J.radio==z){x=true;return false}});return A.name+(A.roam_enabled?" (ZH)":x?" (*)":"")},k=function(z,A){if(!A.adopted||!z)return"";var u=parseInt(z.channel)||"auto",x=z.tx_power_mode||"auto";if(x=="custom")x=parseInt(z.tx_power)+parseInt(z.antenna_gain)+" dBm";return u+" / "+x},t=function(z,A){var u=0,x=100;$.each(z,function(J,B){u+=B});if(!u)return"";var C=$('<ul class="ratio-bar"></ul>');$.each(z,function(J,B){var L=Math.ceil(B*100/u);if(L>x)L=x;$("<li></li>").addClass(A[J]).css("width",
(J+1==z.length?x:L)+"px").appendTo(C);x-=L});C.attr("title",z.join(" / "));return C},F=function(z,A){if(!A.adopted||A.state!=1||!z)return"";var u=z.radio;return t([A[u+"_ast_txto"]+A[u+"_ast_cst"],A[u+"_tx_retries"],A[u+"_ast_be_xmit"]+A[u+"_tx_packets"]],["red","yellow","green"])};e.jtable({model:$("#model-aps"),className:"",pagesize:$("#model-maintabpagesizer").jlistmodel("selected"),sortby:"state",sortdir:"-"}).jtable("addcol","","model",true,Renderer.apIcon).jtable("addcol",Msg.Name_MACAddress,
"mac",true,Renderer.apDetailLink,Renderer.apNameLower).jtable("addcol","IP Address","ip",true,null,Renderer.ip2str15).jtable("addcol","Model","modelname",true,function(z,A){return Renderer.apModel(A.model)},function(z,A){return Renderer.apModel(A.model)}).jtable("addcol","Version","version",true).jtable("addcol","Status","state",true,Renderer.apStatus).jtable("addcol","WLAN 2G","wlangroup_id_ng",true,function(z,A){return w("ng",z,A)}).jtable("addcol","WLAN 5G","wlangroup_id_na",true,function(z,A){return w("na",
z,A)}).jtable("addcol","Radio 2G","radio_ng",false,function(z,A){return k(A.radio_ng,A)}).jtable("addcol","Radio 5G","radio_na",false,function(z,A){return k(A.radio_na,A)}).jtable("addcol","Num Clients","num_sta",true,Renderer.number).jtable("addcol","2G Clients","ng-num_sta",true,Renderer.number).jtable("addcol","5G Clients","na-num_sta",true,Renderer.number).jtable("addcol","TX","tx_bytes-d",true,Renderer.pktsBytes).jtable("addcol","RX","rx_bytes-d",true,Renderer.pktsBytes).jtable("addcol","TX 2G",
"radio_ng_act",false,function(z,A){return F(A.radio_ng,A)}).jtable("addcol","TX 5G","radio_na_act",false,function(z,A){return F(A.radio_na,A)}).jtable("addcol","Download","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Upload","rx_bytes",true,Renderer.pktsBytes).jtable("addcol","Channel","channel",true,Renderer.apChannel,Renderer.apDualChannel).jtable("addaction",Msg.Adopt,"adopt",function(z){return i&&(z.state==2||z.state==12)&&z["default"]}).jtable("addaction",Msg.Restart,"restart",function(z){return i&&
$(z).attr("state")=="1"}).jtable("addaction",Msg.Locate,"locate",function(z){return i&&z.state==1},function(z){return(z.locating?"locating ":"")+"locate-button"}).jtable("addaction","Upgrade","upgrade",function(z){return i&&z.state==1&&z.upgradable==true}).bind("jtable_adopt",function(z,A){$(z.originalTarget).disable();$.jcmd("devmgr","adopt",{mac:$(A).attr("mac")},function(u){u.meta.rc=="error"&&alert(V.localizeMsg(ApiMsg[u.meta.msg],u.meta));$("#model-aps").jtablemodel("refresh");$("#alarm-table").jtable("refresh")})}).bind("jtable_restart",
function(z,A){$(z.originalTarget).disable();$.jcmd.restart_ap(A)}).bind("jtable_locate",function(z,A){$.jcmd.locate_ap(A)}).bind("jtable_upgrade",function(z,A){$.jcmd.upgrade_ap(A,z.originalTarget)});$("#AccessPointDataTableSearch").jsearch().bind("jsearch_search",function(){var z=$("#AccessPointDataTableSearch").val();$("#AccessPointDataTableContainer").jtable("addfilter","*",z==""?null:z).jtable("filter")});m.jchoose("select","overview");$("#model-maintabpagesizer").bind("jlistmodel_select-changed",
function(){$("#AccessPointDataTableContainer").jtable("option","pagesize",$(this).jlistmodel("selected")).jtable("repaint")});$("#model-aps").bind("jtablemodel_refresh-done",function(){$("#AccessPointDataTableContainer").jtable("repaint");p()});$("#model-stas").bind("jtablemodel_refresh-done",function(){$("#AccessPointDataTableContainer").jtable("repaint")})});
$(function(){var c=$("#Admin").find("fieldset.support"),e=["device","mgmt","system"];$("#FooterPanel").bind("tabsshow",function(i,q){if(q.panel.id=="Admin"){var m=$("#model-sysinfo").jsysinfo("data");$("#ServerVersion").text(m.version);if(m.update_available&&m.update_downloaded){$("#UpgradeVersion").text(" (Update "+m.update_version+" is available)");$("#UpgradeVersion, #UpgradeButton").css("display","inline")}$.each(e,function(h,p){c.find("select."+p).val(m["debug_"+p]||"warn")})}return true});$("#UpgradeButton").click(function(){if(confirm("You will have to login again. Do you want to upgrade now?")){$("#UpgradeButton").disable();
location.href="/op/upgrade"}});$("#DownloadBackupLink").click(function(){$("#DownloadBackupLink").disable();$.jcmd("system","backup",{days:$("select.backup-keep").val()},function(i){location.replace(i.data[0].url);$("#DownloadBackupLink").enable()})});$("#BackupFile").jupload().bind("jupload_uploaded",function(i,q){$("#BackupFile-confirm .confirm-text").text(V.localizeMsg(Msg.I_ConfirmRestore,q))});$('#BackupFile-confirm input[name="confirm"]').click(function(){location.href="/op/restore"});$('#BackupFile-confirm input[name="cancel"]').click(function(){$("#BackupFile").jupload("cancel")});
c.find("input[name=apply]").japply({get_posts:function(){var i=[];$.each(e,function(q,m){i.push({url:"/cmd/system",payload:{cmd:"set-param",key:"debug."+m,value:c.find("select."+m).val()}})});return i}});$("#DownloadSupportLink").click(function(){$("#DownloadSupportLink").disable();$.jcmd("system","support",{browser_info:$.extend({userAgent:navigator.userAgent,language:navigator.language},swfobject.ua)},function(){location.replace("/dl/support");$("#DownloadSupportLink").enable()})})});
$(function(){var c=$("#Alerts").find("ul.choose-shown"),e=function(){var i={};if(c.jchoose("selected")=="unarchived")i.archived=false;$("#AlertsDataTableContainer").jtable("refresh",i)};$("#AlertPopUp").hide();$("#AlertsDataTableContainer").jtable({url:"/list/alarm",params:{_sort:"-time"},className:"stat"}).jtable("addcol",Msg.DateTime,"time",true,Renderer.timestamp).jtable("addcol",Msg.Message,"msg",true,Renderer.eventMessage).jtable("addaction",Msg.Adopt,"adopt",function(i){return(i.key=="EVT_AP_DiscoveredPending"||
i.key=="EVT_AP_RediscoveredPending")&&!i.archived&&$("body").attr("role")=="admin"}).jtable("addaction",Msg.Archive,"archive",function(i){return!i.archived&&$("body").attr("role")=="admin"}).bind("jtable_adopt",function(i,q){$.jcmd("devmgr","adopt",{mac:$(q).attr("ap")},function(){$("#model-aps").jtablemodel("refresh");e()})}).bind("jtable_archive",function(i,q){$.jcmd("evtmgr","archive-alarm",{_id:$(q).attr("_id")},function(){e()})}).bind("jtable_refresh-done",function(){var i=0;$.each($("#AlertsDataTableContainer").jtablemodel("rows"),
function(){this.archived==false&&i++});i>0?$("#AlertsTab").addClass("alert"):$("#AlertsTab").removeClass("alert")}).jtable("refresh");c.jchoose().bind("jchoose_selected",e);$("#AlertsDataTableSearch").jsearch().bind("jsearch_search",function(){var i=$("#AlertsDataTableSearch").val();$("#AlertsDataTableContainer").jtable("addfilter","*",i==""?null:i).jtable("filter")});$("#RefreshSelect").bind("jtimer_due",e);$("#model-aps").bind("jtablemodel_refresh-done",function(){$("#AlertsDataTableContainer").jtable("repaint")});
$("#model-stas").bind("jtablemodel_refresh-done",function(){$("#AlertsDataTableContainer").jtable("repaint")});$("#Alerts").find('input[name="archive-all"]').click(function(){var i=$(this);i.disable();$.jcmd("evtmgr","archive-all-alarms",{},function(){e();i.enable()})})});
$(function(){var c=$("#Guests"),e=c.find("#GuestsDataTableContainer"),i=c.find("ul.choose-na-ng");e.jtable({model:$("#model-stas"),className:"stat",pagesize:$("#model-maintabpagesizer").jlistmodel("selected")}).jtable("addcol",Msg.Name_MACAddress,"mac",true,Renderer.staDetailLink,Renderer.staNameLower).jtable("addcol","Status","authorized",true,function(q){return q?"Authorized":"Pending"}).jtable("addcol","IP Address","ip",true,null,Renderer.ip2str15).jtable("addcol","Access Point","ap_mac",true,
Renderer.apDetailLink,Renderer.apNameLower).jtable("addcol","Signal","rssi",true,Renderer.rssiWithRadio).jtable("addcol","Down","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Up","rx_bytes",true,Renderer.pktsBytes).jtable("addcol","Activity","bytes-r",true,Renderer.activityBar).jtable("addcol","Uptime","uptime",true,Renderer.uptime).jtable("addaction","block","block",function(){return $("body").attr("role")=="admin"}).jtable("addaction","authorize","authorize",function(q){return!q.authorized&&
$("body").attr("role")=="admin"}).jtable("addaction","unauthorize","unauthorize",function(q){return q.authorized&&$("body").attr("role")=="admin"}).bind("jtable_block",function(q,m){$.jcmd.block_sta(m)}).bind("jtable_kick",function(q,m){$.jcmd.kick_sta(m)}).bind("jtable_unauthorize",function(q,m){$.jcmd.unauthorize_guest(m)}).bind("jtable_authorize",function(q,m){$.jcmd.authorize_guest(m)});e.jtable("addfilter","is_guest",true);e.jtable("filter");$("#GuestsDataTableFilterByAP").jselect({model:$("#model-apfilters"),
defaultItem:"All",renderer:function(q,m){var h=Renderer.apName(m.mac),p=m["guest-num_sta"];if(p>0)h=h+"("+p+")";return h}});$("#GuestsDataTableFilterByAP").change(function(){var q=$("#GuestsDataTableFilterByAP").val();q=$("#model-apfilters").jlistmodel("findrow","_id",q);e.jtable("addfilter","ap_mac",q?q.mac:null).jtable("filter")});i.jchoose().bind("jchoose_selected",function(){var q=i.jchoose("selected");q=="all"?e.jtable("delfilter","radio"):e.jtable("addfilter","radio",q);e.jtable("filter")});
$("#GuestsDataTableSearch").jsearch().bind("jsearch_search",function(){var q=$("#GuestsDataTableSearch").val();e.jtable("addfilter","*",q==""?null:q).jtable("filter")});$("#model-maintabpagesizer").bind("jlistmodel_select-changed",function(){e.jtable("option","pagesize",$(this).jlistmodel("selected")).jtable("repaint")});$("#model-aps").bind("jtablemodel_refresh-done",function(){e.jtable("repaint")})});
$(function(){var c=$("#Insights"),e=c.find("select[name=selector]"),i=c.find("div.datatable-container.known-wireless-clients"),q=c.find("div.datatable-container.rogue-aps"),m=c.find("div.datatable-container.sessions"),h=c.find("div.datatable-container.authorizations");e.change(function(){c.find("div.datatable-container").hide();var B=c.find("div.datatable-container."+e.val());B.show();B.data("refresh")()});$("#model-maintabpagesizer").bind("jlistmodel_select-changed",function(){$("#AllUsersDataTableContainer, #RogueApsDataTableContainer, #SessionsDataTableContainer, #AuthorizationsDataTableContainer").jtable("option",
"pagesize",$(this).jlistmodel("selected")).jtable("repaint")});c.data("fn_shown",function(){e.change()});var p=i.find("ul.choose-guest-user"),w=i.find("ul.choose-offline"),k=i.find("select.time-filter"),t=function(){var B=p.jchoose("selected"),L=w.jchoose("selected")=="offline";L={type:B,is_offline:L};$.log("query",L,k,k.val());if(B!="blocked")L.within=k.val();$("#AllUsersDataTableContainer").jtable("refresh",L)};i.data("refresh",t);$("#AllUsersDataTableContainer").jtable({url:"/stat/alluser",className:"stat",
pagesize:$("#model-maintabpagesizer").jlistmodel("selected")}).jtable("addcol",Msg.Name_MACAddress,"mac",true,Renderer.staDetailLink,Renderer.staNameLower).jtable("addcol","User/Guest","is_guest",true,function(B){return B?"Guest":"User"}).jtable("addcol","Down","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Up","rx_bytes",true,Renderer.pktsBytes).jtable("addcol","Last Seen","last_seen",true,Renderer.timestamp_sec).jtable("addaction","block","block",function(B){return!B.blocked&&$("body").attr("role")==
"admin"}).jtable("addaction","unblock","unblock",function(B){return B.blocked&&$("body").attr("role")=="admin"}).bind("jtable_block",function(B,L){$.jcmd.block_sta(L)}).bind("jtable_unblock",function(B,L){$.jcmd.unblock_sta(L)}).bind("jcmd_stablocked",t).bind("jcmd_staunblocked",t);p.jchoose({selected:"all"}).bind("jchoose_selected",function(){var B=p.jchoose("selected");c.find("li.time-filter, li.offline-filter").setvisible(B!="blocked"&&B!="noted");t()});w.jchoose({selected:"all"}).bind("jchoose_selected",
t);k.change(t);$("#AllUsersDataTableSearch").jsearch().bind("jsearch_search",function(){var B=$("#AllUsersDataTableSearch").val();$("#AllUsersDataTableContainer").jtable("addfilter","*",B==""?null:B).jtable("filter")});var F=q.find("ul.choose-guest-user"),z=q.find("select.time-filter"),A=function(){w.jchoose("selected");var B={within:z.val()};$("#RogueApsDataTableContainer").jtable("refresh",B)};q.data("refresh",A);$("#RogueApsDataTableContainer").jtable({url:"/stat/rogueap",className:"stat",pagesize:$("#model-maintabpagesizer").jlistmodel("selected")}).jtable("addcol",
"Name/SSID","essid",true,function(B){return B?B:"<hidden>"}).jtable("addcol","BSSID","bssid",true).jtable("addcol","Channel","channel",true,function(B,L){return L.channel+" ("+L.radio+")"}).jtable("addcol","Type","security",true,Renderer.rogueType,Renderer.rogueType).jtable("addcol","Manufacturer","oui",true).jtable("addcol","Location","ap_mac",true,function(B){return $("<span>near </span>").append(Renderer.apDetailLink(B))},Renderer.apNameLower).jtable("addcol","Last Seen","last_seen",true,Renderer.timestamp_sec);
F.jchoose({selected:"all"}).bind("jchoose_selected",function(){F.jchoose("selected");A()});z.change(A);$("#RogueApsDataTableSearch").jsearch().bind("jsearch_search",function(){var B=$("#RogueApsDataTableSearch").val();$("#RogueApsDataTableContainer").jtable("addfilter","*",B==""?null:B).jtable("filter")});var u=m.find("ul.choose-guest-user"),x=function(){var B={type:u.jchoose("selected"),start:C.jdateslider("option","start").getTime()/1E3,end:C.jdateslider("option","end").getTime()/1E3};$("#SessionsDataTableContainer").jtable("refresh",
B)},C=m.find(".datetime-slider").jdateslider({scale:"1h",scales:["1h","1d","7d"]}).bind("jdateslider_changed",x);m.data("refresh",x);$("#SessionsDataTableContainer").jtable({url:"/stat/session",className:"stat",pagesize:$("#model-maintabpagesizer").jlistmodel("selected")}).jtable("addcol",Msg.Name_MACAddress,"mac",true,Renderer.staDetailLink,Renderer.staNameLower).jtable("addcol","User/Guest","is_guest",true,function(B){return B?"Guest":"User"}).jtable("addcol","Associated","assoc_time",true,Renderer.timestamp_sec).jtable("addcol",
"Duration","duration",true,Renderer.uptime).jtable("addcol","Down","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Up","rx_bytes",true,Renderer.pktsBytes).jtable("addcol","IP","ip").jtable("addcol","Last AP","ap_mac",true,Renderer.apDetailLink);u.jchoose({selected:"all"}).bind("jchoose_selected",function(){u.jchoose("selected");x()});$("#SessionsDataTableSearch").jsearch().bind("jsearch_search",function(){var B=$("#SessionsDataTableSearch").val();$("#SessionsDataTableContainer").jtable("addfilter",
"*",B==""?null:B).jtable("filter")});i=function(){var B={start:J.jdateslider("option","start").getTime()/1E3,end:J.jdateslider("option","end").getTime()/1E3};$("#AuthorizationsDataTableContainer").jtable("refresh",B)};var J=h.find(".datetime-slider").jdateslider({scale:"1d",scales:["1h","1d","7d"]}).bind("jdateslider_changed",i);h.data("refresh",i);$("#AuthorizationsDataTableContainer").jtable({url:"/stat/authorization",className:"stat",pagesize:$("#model-maintabpagesizer").jlistmodel("selected")}).jtable("addcol",
Msg.Name_MACAddress,"mac",true,function(B,L){var M=Renderer.staName(B,L);return M==B?M:M+" ["+B+"]"}).jtable("addcol","Package","package").jtable("addcol","Amount","amount",true,Renderer.amount).jtable("addcol","Authorized By","authorized_by",true,function(B,L){if(B=="none")return"None";else if(B=="password")return"Password";else if(B=="api")return"API";else if(B=="voucher")return"Voucher["+L.voucher_code+"]";else if(B=="credit")return(L.payment_cardtype||"Credit Card")+"("+L["package"]+","+Renderer.amount(L.amount)+
")";else if(B=="paypal")return"PayPal";return"None"}).jtable("addcol","Start","start",true,Renderer.timestamp_sec).jtable("addcol","Duration","duration",true,Renderer.uptime).jtable("addcol","Down","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Up","rx_bytes",true,Renderer.pktsBytes).jtable("addcol","IP","ip").jtable("addcol","Last AP","ap_mac",true,Renderer.apDetailLink);$("#AuthorizationsDataTableSearch").jsearch().bind("jsearch_search",function(){var B=$("#AuthorizationsDataTableSearch").val();
$("#AuthorizationsDataTableContainer").jtable("addfilter","*",B==""?null:B).jtable("filter")})});
function maplet_jscall(c,e){var i=$("body").attr("role")!="admin",q={};switch(c){case "maplet_loaded":maplet_loaded();break;case "show_ap_detail":$(document.body).dialogManager("addItem",e.mac,"ap");break;case "ap_modified":if(i)break;var m=$("#model-aps").jtablemodel("findrow","_id",e._id);if(!m)break;$.each(["map_id","x","y","locked"],function(){q[this]=e[this];m[this]=e[this]});$.jpost("/upd/device/"+e._id,q,function(){$("#model-maps").jlistmodel("refresh")});break;case "map_ordered":if(i)break;
$(e).each(function(h,p){$.jpost("/upd/map/"+p,{order:h})});break;case "map_removed":if(i)break;$.jcmd("cfgmgr","delete_map",{_id:e._id},function(){$("#model-maps").jlistmodel("deleterow","_id",e._id)});break;case "map_selected":if(i)break;$.jcmd("cfgmgr","select_map",{_id:e._id},function(){});break;case "map_modified":if(i)break;$.each(["description","upp","unit","scale","theta","name"],function(){q[this]=e[this]});$.jpost("/upd/map/"+e._id,q);break;case "esc_pressed":closeBottomPanel();break;case "prompt_gmap":$(".gmap-dialog").data("fn_open")(e.name||
"unknown");break;case "log":$.log(e);break;default:$.log("jscall "+c+"() not handled")}}var maplet;
function maplet_loaded(){maplet=$("#maplet").get(0);var c=[];$("#Map").data("ap_ids",c);$("#model-aps").bind("jtablemodel_refresh-done",function(){if($("#Map").data("inited")){var e=$.extend([],c);c.splice(0,c.length);$.each($("#model-aps").jtablemodel("rows"),function(i,q){if(!q.adopted||q.state==8)return true;c.push(q._id);var m=$.inArray(q._id,e);if(m>=0){maplet.flexcall("updateAp",q);e.splice(m,1)}else{maplet.flexcall("addAp",q);c.push(q._id)}});$.each(e,function(i,q){maplet.flexcall("deleteAp",
{_id:q})})}});$.jpost("/list/map",{_sort:"order"},function(e){maplet.flexcall("setUploadInfo",{host:location.hostname,port:parseInt($("#maplet-http-port").text()),uri:"/upload/map/s/"+$("body").attr("sitename"),role:$("body").attr("role"),key:$("#maplet-upload-key").text()});$.each(e.data,function(i,q){q.url?maplet.flexcall("addMaps",[q]):$.jcmd("cfgmgr","save_gsmap",q,function(m){q.url||maplet.flexcall("addMaps",[m.data[0].map])})});maplet.flexcall("deleteAllAps");$.each($("#model-aps").jtablemodel("rows"),
function(i,q){if(!q.adopted||q.state==8)return true;maplet.flexcall("addAp",q);c.push(q._id)});$("#Map").data("inited",true);$.log("maplet_inited")})}$(function(){swfobject.embedSWF("/library/swf/MapApplet.swf","Maplet","100%","100%","10.0.0","library/js/flex/expressInstall.swf",{},{wmode:"transparent",allowScriptAccess:"always"},{id:"maplet"},function(c){c.success||$("#Maplet div.install-flash a").show()})});
$(function(){$("#EventsDataTableContainer").jtable({model:$("#model-events"),className:"stat",sortby:"time",sortdir:"-"}).jtable("addcol",Msg.DateTime,"time",true,Renderer.timestamp).jtable("addcol",Msg.Message,"msg",true,Renderer.eventMessage).jtable("refresh");$("#EventsDataTableSearch").jsearch().bind("jsearch_search",function(){var m=$("#EventsDataTableSearch").val();$("#EventsDataTableContainer").jtable("addfilter","*",m==""?null:m).jtable("filter")});var c=$("#RecentEvents"),e=c.find("ul.choose-shown"),
i=c.find("select.time-filter"),q=function(){var m=e.jchoose("selected"),h={};if(m!="all")h.type=m;h.within=i.val();$("#EventsDataTableContainer").jtable("refresh",h)};c.data("fn_shown",q);$("#RefreshSelect").bind("jtimer_due",function(){if($("#model-events").data("lastId")){var m=e.jchoose("selected");$.jpost("/stat/event",{lastId:$("#model-events").data("lastId"),type:m=="all"?null:m},function(h){h.data.length>0&&$("#model-events").jtablemodel("prependrows",h.data)})}else q()});e.jchoose({selected:"all"}).bind("jchoose_selected",
q);i.change(q);$("#model-events").bind("jtablemodel_refresh-done",function(){$("#EventsDataTableContainer").jtable("repaint");$("#model-events").jtablemodel("rows").length>0&&$("#model-events").data("lastId",$("#model-events").jtablemodel("rows")[0]._id)});$("#model-aps").bind("jtablemodel_refresh-done",function(){$("#EventsDataTableContainer").jtable("repaint")});$("#model-stas").bind("jtablemodel_refresh-done",function(){$("#EventsDataTableContainer").jtable("repaint")})});
$(function(){$("div.settings-panel").hide();$("#SettingsNavigation li").each(function(){$(this).click(function(){var c=$(this).find("a").attr("href");$(c).show();$("#SettingsNavigation").hide();return false})});$("#SettingsNavigation li").each(function(){$(this).click(function(){var c=$(this).find("a").attr("href");$(c).show();$("#SettingsNavigation").hide();return false})});$("ul.bread-crumbs li:first-child").each(function(){$(this).click(function(){$("#SettingsNavigation").show();$("div.settings-panel").hide();
return false})});$("#SettingsTab").click(function(){$("#SettingsNavigation").show();$("div.settings-panel").hide();return false})});
$(function(){var c=$("#Statistics"),e=c.find("select[name=category]").val("overview"),i=function(){$.jpost("/stat/quicklook",{},function(z){var A=z.data[0].aps_current[0],u=$("div.quick-look dd.most-active-ap");if(A){u.find(".name").html(Renderer.apDetailLink(A.ap));u.find(".sent").html(Renderer.pktsBytes(A.tx_bytes));u.find(".received").html(Renderer.pktsBytes(A.rx_bytes))}else u.find(".name").html("N/A");u.find("p:nth-child(1)").siblings().setvisible(A);A=z.data[0].stas_current[0];u=$("div.quick-look dd.most-active-sta");
if(A){u.find(".name").html(Renderer.staDetailLink(A.mac));u.find(".sent").html(Renderer.pktsBytes(A.tx_bytes));u.find(".received").html(Renderer.pktsBytes(A.rx_bytes))}else u.find(".name").html("N/A");u.find("p:nth-child(1)").siblings().setvisible(A);A=z.data[0].users_life[0];u=$("div.quick-look dd.top-user");if(A){u.find(".name").html(Renderer.staDetailLink(A.user));u.find(".sent").html(Renderer.pktsBytes(A.tx_bytes));u.find(".received").html(Renderer.pktsBytes(A.rx_bytes));u.find(".duration").html(Renderer.uptime(A.duration))}else u.find(".name").html("N/A");
u.find("p:nth-child(1)").siblings().setvisible(A)})},q=$("#usage-chart").jusagechart({attrs:[{name:"bytes",label:"Traffic"},{name:"num_sta",label:"# of Clients"}],by_attr:"ap",no_data_msg:"Waiting for more data",legendRenderer:Renderer.apName,limit:10,autoResize:true}),m=$("#wlan-chart").jusagechart({attrs:[{name:"num_sta",label:"# of Clients"}],legend_x:220,by_attr:"wlan",no_data_msg:"Waiting for data",limit:10}),h=$("#time-chart").jtimechartmodel(),p=$("#time-chart").jtimechart({model:h,autoResize:true}),
w=c.find(".datetime-slider").jdateslider({}).bind("jdateslider_changed",function(){var z=w.jdateslider("option","scale")=="30d";p.jtimechart("option","timeRenderer",z?Renderer.timeMonthDay:Renderer.timeHour24);h.jtimechartmodel("option","scale",z?"daily":"hourly").jtimechartmodel("setend",w.jdateslider("get_date")).jtimechartmodel("refresh")});c.find("input[name=reset]").click(function(){$.jcmd("stat","reset-current",{},function(){$("#model-aps").jtablemodel("refresh")})});$("#model-stas").bind("jtablemodel_refresh-done",
function(){c.hasClass("ui-tabs-hide")||k()});$("#model-aps").bind("jtablemodel_refresh-done",function(){c.hasClass("ui-tabs-hide")||k()});var k=function(){var z={},A=[],u=$("#model-stas").data("sta_counts");$.each(u,function(C,J){if(C=="by_essid")return true;z[C]={ap:C,num_sta:J.total}});$.each($("#model-aps").jtablemodel("rows"),function(C,J){if(!z[J.mac])return true;z[J.mac].bytes=J.bytes;A.push(z[J.mac])});var x=[];$.each(u.by_essid,function(C,J){x.push({wlan:C,num_sta:J})});x.sort(function(C,
J){return J.num_sta-C.num_sta});A.sort(function(C,J){return J.bytes-C.bytes});m.jusagechart("set_model",x);q.jusagechart("set_model",A)},t=function(){if(!c.hasClass("ui-tabs-hide"))if(e.val()=="overview"){k();p.jtimechart("refresh");i()}};e.change(function(){var z=e.val()=="overview";c.removeClass("overview");c.removeClass("by-ap");c.addClass(z?"overview":"by-ap");z?t():F.jtimechart("refresh")});var F=$("#time-chart-by-ap").jtimechart({model:h,autoResize:true});$("#StatByAPDataTableContainer").jtable({model:$("#model-aps"),
rowhoverable:true,pagesize:10,fnrowhover:function(z,A){$("#StatByAPDataTableContainer").jtimechartmodel("option","scale",h.jtimechartmodel("option","scale")).jtimechartmodel("option","scope","ap."+A.mac).jtimechartmodel("refresh")}}).jtable("addcol","","model",true,Renderer.apIcon).jtable("addcol",Msg.Name_MACAddress,"mac",true,Renderer.apDetailLink,Renderer.apName).jtable("addcol","Num Clients","num_sta",true).jtable("addcol","Download","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Upload",
"rx_bytes",true,Renderer.pktsBytes).jtable("addcol","Channel","channel",true,Renderer.apChannel,Renderer.apDualChannel);$("#StatByAPDataTableContainer").jtimechartmodel({scale:"hourly",scope:"ap.unknown"}).bind("jtimechartmodel_refresh-done",function(){F.jtimechart("overlay",$("#StatByAPDataTableContainer"))});c.data("fn_shown",t);$("#RefreshSelect").bind("jtimer_due",t)});
$(function(){var c=$("#Users"),e=c.find("#UsersDataTableContainer"),i=c.find("ul.choose-na-ng");e.jtable({model:$("#model-stas"),className:"stat",pagesize:$("#model-maintabpagesizer").jlistmodel("selected"),sortby:"tx_bytes",sortdir:"-"}).jtable("addcol",Msg.Name_MACAddress,"mac",true,Renderer.staDetailLink,Renderer.staNameLower).jtable("addcol","IP Address","ip",true,null,Renderer.ip2str15).jtable("addcol","WLAN","essid",true).jtable("addcol","Access Point","ap_mac",true,Renderer.apDetailLink,Renderer.apNameLower).jtable("addcol",
"Signal","rssi",true,Renderer.rssiWithRadio).jtable("addcol","Down","tx_bytes",true,Renderer.pktsBytes).jtable("addcol","Up","rx_bytes",true,Renderer.pktsBytes).jtable("addcol","Activity","bytes-r",true,Renderer.activityBar).jtable("addcol","Uptime","uptime",true,Renderer.uptime).jtable("addaction","block","block",function(){return $("body").attr("role")=="admin"}).jtable("addaction","reconnect","kick",function(){return $("body").attr("role")=="admin"}).bind("jtable_block",function(q,m){$.jcmd.block_sta(m)}).bind("jtable_kick",
function(q,m){$.jcmd.kick_sta(m)});e.jtable("addfilter","is_guest",false);e.jtable("filter");$("#UsersDataTableFilterByAP").jselect({model:$("#model-apfilters"),defaultItem:"All",renderer:function(q,m){var h=Renderer.apName(m.mac),p=m["user-num_sta"];if(p>0)h=h+"("+p+")";return h}});$("#UsersDataTableFilterByAP").change(function(){var q=$("#UsersDataTableFilterByAP").val();q=$("#model-apfilters").jlistmodel("findrow","_id",q);e.jtable("addfilter","ap_mac",q?q.mac:null).jtable("filter")});i.jchoose().bind("jchoose_selected",
function(){var q=i.jchoose("selected");q=="all"?e.jtable("delfilter","radio"):e.jtable("addfilter","radio",q);e.jtable("filter")});$("#UsersDataTableSearch").jsearch().bind("jsearch_search",function(){var q=$("#UsersDataTableSearch").val();e.jtable("addfilter","*",q==""?null:q).jtable("filter")});$("#model-maintabpagesizer").bind("jlistmodel_select-changed",function(){e.jtable("option","pagesize",$(this).jlistmodel("selected")).jtable("repaint")});$("#model-aps").bind("jtablemodel_refresh-done",function(){e.jtable("repaint")})});
$(function(){$("#RefreshSelect").jtimer();$("#RefreshButton").button({text:false,icons:{primary:"ui-icon-refresh"}}).click(function(){$("#RefreshSelect").jtimer("trigger");return false});$("#RefreshSelect").bind("jtimer_due",function(){$("#model-aps").jtablemodel("refresh");$("#model-stas").jtablemodel("refresh")}).selectmenu().jtimer("start")});
$(function(){$("#WelcomeLogoutButton").button({icons:{primary:"ui-icon-power"}}).click(function(){window.location.href="/logout"});var c=$("#ChangePasswordDialog");$("#ChangePassword").click(function(){$.jcmd("sitemgr","get-self",{},function(e){e=e.data[0];var i=e.requires_new_password;c.dialog("option","closeOnEscape",!i);c.dialog("widget").find("button.cancel").button(i?"disable":"enable");c.dialog("widget").find("a.ui-dialog-titlebar-close").setvisible(!i);c.jform("set_model",e);c.dialog("open")})});
c.dialog({modal:true,resizable:false,autoOpen:false,dialogClass:"ui-dark",buttons:[{"class":"ui-positive-alert apply",text:"Save",click:function(){}},{"class":"cancel",text:"Cancel",click:function(){$(this).dialog("close");return false}}]});c.jform({japply:c.dialog("widget").find(".apply"),detect_change:false,populate:function(e){var i=e.requires_new_password;c.find("input[name=name]").val(e.name);c.find("input[type=password]").val(i?"":$.jpass_hint);c.find("input[name=email]").val(e.email);c.find("select[name=lang]").val(e.lang||
"en_US")},get_posts:function(){var e={name:c.find('input[name="name"]').val()};c.find("input[name=password1]").val()!=$.jpass_hint&&$.extend(e,{x_password:c.find("input[name=password1]").val()});$.extend(e,{email:c.find('input[name="email"]').val()});e.lang=c.find("select[name=lang]").val();$.extend(e,{cmd:"set-self"});return{url:"/cmd/sitemgr",payload:e}},validate:function(){if(!V.checkEmpty(c.find("input[name=name]"),"Admin Name")||!V.checkAdminName(c.find("input[name=name]"),"Admin Name"))return false;
if(!V.checkAdminPasswords(c.find("input[name=password1]"),c.find("input[name=password2]"),"Admin Password","Confirm"))return false;var e=c.find('input[name="email"]');if(!V.checkEmpty(e,"Email Address"))return false;if(!V.checkEmail(e,"Email Address"))return false;return true},done:function(){c.dialog("close")}});$("body").attr("adminnewpass")=="true"&&$("#ChangePassword").click()});
