(function(a){a.fn.ie8CanvasHack=function(){this.find("canvas").filter(function(){return a(this).css("position")=="absolute"}).wrap(function(){var b=a(this),c=a("<div />").css({position:"absolute",top:b.css("top"),left:b.css("left")});jQuery.data(this,"prev_top",b.css("top"));jQuery.data(this,"prev_lft",b.css("left"));b.css({top:"0",left:"0"});return c});return this};a.fn.CanvasUnHack=function(){for(var b=this.find("canvas").filter(function(){return a(this).css("position")=="absolute"}),c=0;c<b.length;c++){canvas=
b[c];a(canvas).css("top",jQuery.data(canvas,"prev_top"));a(canvas).css("left",jQuery.data(canvas,"prev_lft"));a(canvas).parent().css("display","block");a(canvas).unwrap()}return this}})(jQuery);function getInternetExplorerVersion(){var a=-1;if(navigator.appName=="Microsoft Internet Explorer")if(/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)!=null)return a=parseFloat(RegExp.$1)}var ver=getInternetExplorerVersion();
if(ver>-1)if(ver<=7){var conf=confirm("We have detected that you are running Internet Explorer 7 or lower, although the site will work, it will be very slow. \nClick 'ok' to continue\nClick 'cancel' to upgrade");if(!conf)window.location="http://windowsupdate.microsoft.com"}function gelement(a,b){return b?document.getElementById(a):gelement.cache[a]=gelement.cache[a]||document.getElementById(a)}gelement.cache={};var LOGGER;SORT_LIST=[[5,1]];HAS_ASKED=IS_FIRST_SORT=false;
var REQUEST_PENDING=0,MAP_ZOOM_LEVEL,MAX_POINTS,MAX_TABLE;MAX_POINTS=ver<=7?100:250;var HIDE_EVENTS=0,LISTENER_STATUS=0,EVENT_LIST_LIMIT=25,AGENCIES=[],A_C=[],VISIBLE_AGENCIES=[],SEARCHES=[],EVENT_LIST=[],VISIBLE_TYPES={},TYPE_TOTALS=[],SUBSCRIBE_RESULT,BLINK_TIMES=15,BLINK_ON=1,CATEGORY_MARKERS=[];CATEGORY_MARKERS[1]="orange_MarkerP.png";CATEGORY_MARKERS[2]="red_MarkerV.png";CATEGORY_MARKERS[3]="yellow_MarkerT.png";CATEGORY_MARKERS[4]="green_MarkerP.png";CATEGORY_MARKERS[5]="purple_MarkerN.png";
CATEGORY_MARKERS[6]="blue_MarkerD.png";CATEGORY_MARKERS[7]="paleblue_MarkerO.png";var CATEGORY_COLORS=[];CATEGORY_COLORS[1]="#FFA54F";CATEGORY_COLORS[2]="#CD4F39";CATEGORY_COLORS[3]="#FBEC5D";CATEGORY_COLORS[4]="#9ACD32";CATEGORY_COLORS[5]="#DB70DB";CATEGORY_COLORS[6]="#3F73FB";CATEGORY_COLORS[7]="#AFEEEE";var P_N=[];P_N[1]="Here be chaos o' th' land";P_N[2]="Mutiny";P_N[3]="Landlubber Boats";P_N[4]="Anti-Pirating";P_N[5]="You be too loud!";P_N[6]="Here be chaos";P_N[7]="Nethers";
var SEARCH_DISP=1,CATEGORIES=[],CAT_COUNTS=[],TYPES=[],URL_ACTIVE_CATEGORIES=[],VISIBLE_CATEGORIE_IDS=[],INITIAL_LOAD=0,GRAPH_DATA=[],O_EVENTLIST,O_SERVER,O_SCOREBOARD,O_MAP,O_CAL={},O_GRAPH,PLEASE_WAIT,ZOOM_LISTENER,DRAG_LISTENER,EVENT_FROM_DRAG=false,EVENT_FROM_ZOOM=false;google.load("visualization","1",{packages:["linechart","piechart"]});var c_y=0,c_x=0,d_y=0,offset_l=0,offset_t=-5;
function pre_load(){var a=new Image,b=[];b[0]="http://myneighborhoodupdate.net/images/normal_left.png";b[1]="http://myneighborhoodupdate.net/images/normal_right.png";b[2]="http://myneighborhoodupdate.net/images/normal_bottom_left.png";b[3]="http://myneighborhoodupdate.net/images/normal_bottom_right.png";for(var c=0;c<b.length;c++)a.src=b[c]}function remove_dupes(a){var b=[],c=0,d=a.length;a:for(;c<d;c++){for(var e=c+1;e<d;e++)if(a[e]==a[c])continue a;b[b.length]=a[c]}return b}
function show_previous_searches(){SEARCHES=remove_dupes(SEARCHES);SEARCHES.sort();if(SEARCHES.length>1){var a=gelement("search_div");a.innerHTML="";a.style.display="block";a.style.visibility="visible";for(var b=0;b<5;b++)if(SEARCHES[b]!==undefined){var c=["<a onclick=\"javascript: document.addr.sb.value = '",SEARCHES[b],"'; SEARCH_DISP=0; \">",SEARCHES[b],"</a> <br />"].join("");a.innerHTML+=c}a.innerHTML+='<div style="text-align: right; width: 100%;"><hr />Recent searches</div>'}}
function set_cursor_pos(a){if(!a)a=window.event;if(a){c_x=a.pageX;c_y=a.pageY}}function set_cursor_pos_all(a){if(!a)a=window.event;if(a){c_x=a.clientX;c_y=a.clientY}}document.onmousemove=document.all?set_cursor_pos_all:set_cursor_pos;
function assign_position(a){if(self.pageYOfset){d_x=self.pageXOffset;d_y=self.pageYOffset}else if(document.documentElement&&document.documentElementScrollTop){d_x=document.documentElement.scrollLeft;d_y=document.documentElement.scrollTop}else if(document.body){d_x=document.body.scrollLeft;d_y=document.body.scrollTop}if(document.all){c_x+=d_x;c_y+=d_y}a.style.left=c_x+offset_l+"px";a.style.top=c_y+offset_t+"px"}
function show_types(a){var b=gelement(a);if(CAT_COUNTS[a]===undefined)b.innerHTML="No events for this category.";assign_position(b);b.style.zIndex=210;b.style.display="block"}function hide_types(a,b){var c=gelement(a),d=window.event||b,e=window.event?d.srcElement:d.target;if(e.nodeName=="DIV"){for(d=d.relatedTarget?d.relatedTarget:d.toElement;d!=e&&d.nodeName!="BODY";)d=d.parentNode;if(d!=e)c.style.display="none"}}
function get_cookie(a){if(document.cookie.length>0){start=document.cookie.indexOf(a+"=");if(start!=-1){start=start+a.length+1;end=document.cookie.indexOf(";",start);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(start,end))}}return""}
function add_email_notification(){var a=gelement("link_popup"),b=gelement("link_popup_info"),c=gelement("link_type"),d=gelement("link_title");c.src="/images/email_notification_icon.gif";d.innerHTML="Email Notification";c=get_cookie("email")||"";d=O_MAP.get_extents();var e=d.split(","),f=new GLatLng(e[1],e[0]);e=new GLatLng(e[3],e[2]);var g=O_MAP.get_center(),k=O_MAP.get_zoom(),i=[];i=['By providing your e-mail address and a short description, an e-mail message will be sent when new events occur within the map area you are currently viewing.<br /><br /><center><form target="return" method="get" onsubmit="submit_email(); return true;" action="/manage_alerts.cgi" name="email_sub"><input type="hidden" value="add_email" name="m"><table border="0"><tr><td style="text-align: right;">E-Mail:</td><td style="text-align: right;"><input id="email" type="text" name="email" size="30" onchange="validate( \'email\' )" value=',
c,'></td></tr><tr><td style="text-align: right;">Description:</td><td style="text-align: right;"><input id="desc" type="text" name="desc" size="30" onchange="validate( \'desc\' )"></td><input type="hidden" value="',d,'" name="ext"><input type="hidden" value="',g,'" name="center"><input type="hidden" value="',k,'" name="zoom"></tr><tr><td></td><td style="text-align: right;"><input type="submit" name="submit" value="Subscribe" /></td></tr></form></tr><tr><td colspan="2"><iframe name="return" width="240px" height="40px" frameborder="0" scrolling="no"></iframe></td></tr><tr><td style="text-align: left" colspan="3">See our <a href="/help/privacy.shtml" target="_blank">privacy</a> section for more details.</td></tr></table></center>'].join("");
b.innerHTML=i;if(e.distanceFrom(f)>12E3)alert("Sorry, the area you are viewing is too wide for e-mail alerts.  Please zoom in closer and try again.");else a.style.visibility="visible";c!==""?document.email_sub.desc.focus():document.email_sub.email.focus()}
function validate(a){var b;if(a=="email"){b=RegExp(/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/);var c=document.email_sub.email;if(c.value.match(b)){c.style.color="black";c.style.background="white"}else{alert("Invalid E-Mail");c.style.color="white";c.style.background="red"}}if(a=="desc"){b=RegExp(/^[A-Za-z0-9]|\s+$/);a=document.email_sub.desc;if(a.value.match(b)){a.style.color="black";a.style.background="white"}else{alert("Invalid Description:\n\tOnly use Alphanumeric");
a.style.color="white";a.style.background="red"}}}function set_cookie(a,b,c){var d=new Date;d.setDate(d.getDate()+c);document.cookie=a+"="+escape(b)+(c===null?"":";expires="+d.toGMTString())}function submit_email(){set_cookie("email",document.email_sub.email.value,10)}function get_num_points(){var a=0;if(gelement("p_sel")){a=gelement("p_sel");set_cookie("num_points",a.options[a.selectedIndex].value,1);a=a.options[a.selectedIndex].value}else a=250;return a}
function get_param(a){var b="",c=window.location.href;c.substr(c.indexOf("?")).toLowerCase();c=c.split("&");for(var d=0;d<c.length;d++)if(c[d].indexOf(a.toLowerCase()+"=")>-1)b=c[d].split("=")[1];if(b!=="")return unescape(b)}
function refresh(){VISIBLE_TYPES={};if(!(REQUEST_PENDING>0)){MAP_ZOOM_LEVEL=O_MAP.get_zoom();if(MAP_ZOOM_LEVEL>10){if(LISTENER_STATUS==1){DRAG_LISTENER=GEvent.bind(O_MAP.map_canvas,"dragend",O_MAP,function(){refresh()});GEvent.addListener(DRAG_LISTENER);LISTENER_STATUS=2}extents=O_MAP.get_extents();VISIBLE_CATEGORIE_IDS="";var a=0,b;for(b in CATEGORIES){if(!CATEGORIES[b].hidden){VISIBLE_CATEGORIE_IDS+=b;VISIBLE_CATEGORIE_IDS+=a==6?"":","}a++}if(VISIBLE_CATEGORIE_IDS.length===13)VISIBLE_CATEGORIE_IDS=
"all";O_SERVER.get_events(O_CAL.begin_epoch,O_CAL.end_epoch,extents,VISIBLE_CATEGORIE_IDS)}else{O_MAP.show_agencies();window.setTimeout("O_GRAPH.refresh();",150);O_EVENTLIST.refresh();LISTENER_STATUS=1}set_cookie("center",O_MAP.get_center(),1);set_cookie("zoom",O_MAP.get_zoom(),1)}}function date_to_epoch(a){if(a!==undefined&&a.match("/")){a.split("/");a=new Date(a);return parseInt(a.getTime()/1E3,10)}else alert("date_to_epoch: undefined date, "+a)}
function epoch_to_date(a){var b=new Date(a*1E3);a=b.getMonth()+1;var c=b.getFullYear();b=b.getDate();return a+"/"+b+"/"+c}function blink_image(){BLINK_ON=BLINK_ON==1?0:1;var a=gelement("blinker"),b="visible";BLINK_ON||(b="hidden");a.style.visibility=b;BLINK_TIMES--;if(BLINK_TIMES<=0)a.style.visibility="visible";else setTimeout("blink_image()",750)}
function init(a){$.tablesorter.addWidget({id:"sortPersist",format:function(m){var p=$.cookie("MY_SORT_COOKIE"),h={path:"/"},j={},r=m.config.sortList,l=$(m).attr("id"),n=typeof p!="undefined"&&p!=null;if(r.length>0){if(n)j=$.evalJSON(p);j[l]=r;$.cookie("MY_SORT_COOKIE",$.toJSON(j),h);if(IS_FIRST_SORT)if(HAS_ASKED===false&&EVENT_FROM_ZOOM===false&&EVENT_FROM_DRAG===false){m=confirm("Sorting will only sort the "+EVENT_LIST_LIMIT+" visible events.  Would you like to expand the event list prior to sorting?");
IS_FIRST_SORT=false;m&&O_EVENTLIST.refresh_nolimit();HAS_ASKED=true}}else if(n){j=$.evalJSON($.cookie("MY_SORT_COOKIE"));if(typeof j[l]!="undefined"&&j[l]!=null){r=j[l];r.length>0&&$(m).trigger("sorton",[r])}IS_FIRST_SORT=true}else $(m).trigger("sorton",[[[5,1]]])}});pre_load();O_SERVER=new Server;if(typeof Log!=="undefined"){Log.options.sort_obj=true;Log.options.timestamp=true;Log.options.max_recurs=1;Log.debug("Logging enabled!")}O_EVENTLIST=new EventList("event_list");PLEASE_WAIT=gelement("please_wait");
O_MAP=new Map("map_canvas");O_SCOREBOARD=new ScoreBoard("score_board");O_GRAPH=new Graph;var b=new Date,c=new Date;c.setDate(b.getDate());b.setDate(b.getDate()-365);$(function(){$("#cal_begin").datepicker({minDate:b,maxDate:c,onSelect:function(m){O_CAL.begin_epoch=date_to_epoch(m);refresh()}})});$(function(){$("#cal_end").datepicker({minDate:b,maxDate:c,onSelect:function(m){O_CAL.end_epoch=date_to_epoch(m);refresh()}})});O_SERVER.get_types();O_SERVER.get_categories();O_SERVER.get_agencies();var d=
get_cookie("begin_epoch"),e=get_cookie("end_epoch"),f=epoch_to_date(e);if(e>0)f=epoch_to_date(e);else{dt=new Date;e=parseInt(dt.getTime()/1E3,10);f=dt.getMonth()+1;var g=dt.getDate(),k=dt.getFullYear();f=f+"/"+g+"/"+k}$("#cal_end").attr("value",f);if(!(d>0)){dt=new Date;d=e-2592E3}f=epoch_to_date(d);$("#cal_begin").attr("value",f);O_CAL.begin_epoch=d;O_CAL.end_epoch=e;d=get_cookie("center");e=window.location.href;var i;$("#p_sel").attr("value",MAX_POINTS);if(e.indexOf("/?center")>-1){a=get_param("center");
zoom=get_param("zoom");O_CAL.begin_epoch=get_param("b")||O_CAL.begin_epoch;O_CAL.end_epoch=get_param("e")||O_CAL.end_epoch;i=get_param("c")||"all";d=unescape(a).split(", ");for(a=0;a<i.length;a++)URL_ACTIVE_CATEGORIES[i[a]]=parseInt(i[a],10);O_MAP.map_canvas.setCenter(new GLatLng(d[0],d[1]),parseInt(zoom,10))}else if(a)O_MAP.geocode(a);else if(d!==null&&d!==""){a=get_cookie("zoom");e=get_cookie("num_points");i=get_cookie("categories")||"all";e&&$("#p_sel").attr("value",e);d=d.split(", ");O_MAP.map_canvas.setCenter(new GLatLng(d[0],
d[1]),parseInt(a,10))}else{if(google.loader&&google.loader.ClientLocation!==null&&google.loader.ClientLocation.address.country_code=="US"&&google.loader.ClientLocation.address.region)O_MAP.map_canvas.setCenter(new GLatLng(google.loader.ClientLocation.latitude,google.loader.ClientLocation.longitude),11);else{INITIAL_LOAD=1;O_MAP.map_canvas.setCenter(new GLatLng(37.0625,-95.67706),4)}i="all"}$("#cal_end").attr("value",epoch_to_date(O_CAL.end_epoch));$("#cal_begin").attr("value",epoch_to_date(O_CAL.begin_epoch));
extents=O_MAP.get_extents();window.setTimeout(function(){O_SERVER.get_events(O_CAL.begin_epoch,O_CAL.end_epoch,extents,i)},500);ZOOM_LISTENER=GEvent.bind(O_MAP.map_canvas,"zoomend",O_MAP,function(){EVENT_FROM_ZOOM=true;refresh()});DRAG_LISTENER=GEvent.bind(O_MAP.map_canvas,"dragend",O_MAP,function(){EVENT_FROM_DRAG=true;refresh()});GEvent.addListener(ZOOM_LISTENER);GEvent.addListener(DRAG_LISTENER);setTimeout("blink_image()",2E3)}
function show_search(){$("#address_input").is(":none")?$("#address_input").hide().fadeIn(3E3):alert("nohere")}
function close_link(a,b){if(b){if(b=="search_div"){var c=window.event||a,d=window.event?c.srcElement:c.target;if(d.nodeName!="DIV")return;for(c=c.relatedTarget?c.relatedTarget:c.toElement;c!=d&&c.nodeName!="BODY";)c=c.parentNode;if(c==d)return}d=document.getElementById(b);O_MAP.pano&&O_MAP.pano.remove();d.style.visibility="hidden"}else document.getElementById("link_popup").style.visibility="hidden"}
function show_link(){var a=O_MAP.get_center(),b=MAP_ZOOM_LEVEL,c="http://";c+=window.location.hostname;c+="?center="+escape(a);c+="&zoom="+escape(b);c+="&b="+O_CAL.begin_epoch;c+="&e="+O_CAL.end_epoch;if(VISIBLE_CATEGORIE_IDS.length===0)VISIBLE_CATEGORIE_IDS="all";c+="&c="+VISIBLE_CATEGORIE_IDS;a=document.getElementById("link_popup");b=document.getElementById("link_textarea");var d=document.getElementById("link_popup_info"),e=document.getElementById("link_type"),f=document.getElementById("link_title");
e.src="/images/link_icon.gif";f.innerHTML="Link to current view";d.innerHTML="";if(b)close_link();else{b=document.createElement("textarea");b.id="link_textarea";b.cols=45;b.rows=5;d.innerHTML+="Copy and paste the text below to share this view with someone else.<br /><br />";d.innerHTML+='<form name="url_selector">Exclude date ranges: <input onclick="javascript: update_url( );" type="checkbox" name="cb"/></form><br />';d.appendChild(b);b.value=c;a.style.visibility="visible";b.focus();b.select()}}
function update_url(){var a=document.url_selector.cb,b=O_MAP.get_center(),c=MAP_ZOOM_LEVEL,d="http://";d+=window.location.hostname;d+="?center="+escape(b);d+="&zoom="+escape(c);if(!a.checked){d+="&b="+O_CAL.begin_epoch;d+="&e="+O_CAL.end_epoch}if(VISIBLE_CATEGORIE_IDS.length===0)VISIBLE_CATEGORIE_IDS="all";a=gelement("link_textarea");d+="&c="+VISIBLE_CATEGORIE_IDS;a.value=d;a.focus()}
function send_param(){var a=O_MAP.get_center(),b=MAP_ZOOM_LEVEL,c="http://";c+=window.location.hostname;c+="?center="+escape(a);c+="&zoom="+escape(b);c+="&b="+O_CAL.begin_epoch;c+="&e="+O_CAL.end_epoch;c+="&c="+VISIBLE_CATEGORIE_IDS;a="Someone sent you a link from myneighborhoodupdate.net%0DPaste the following link into your browser:%0D%0D";a+=escape(c);window.open("mailto:?subject=My Neighborhood Update&body="+a,"emailWindow").close()}
function soft_refresh(){VISIBLE_CATEGORIE_IDS="";var a=0,b;for(b in CATEGORIES){if(!CATEGORIES[b].hidden){VISIBLE_CATEGORIE_IDS+=b;VISIBLE_CATEGORIE_IDS+=","}a++}if(VISIBLE_CATEGORIE_IDS.length===13)VISIBLE_CATEGORIE_IDS="all";if(VISIBLE_CATEGORIE_IDS.length===0){O_GRAPH.refresh();O_EVENTLIST.refresh()}extents=O_MAP.get_extents();O_SERVER.get_events(O_CAL.begin_epoch,O_CAL.end_epoch,extents,VISIBLE_CATEGORIE_IDS)}
function sort_projects(a){var b=[],c;for(c in a)b.push([c,a[c]]);b.sort(function(d,e){return d[1].name<e[1].name?-1:d[1].name>e[1].name?1:0});return b}
function update_visible_agencies(){for(var a=gelement("visible_agencies"),b='<b>Visible agencies:</b><br/><table id="visible_agencies_table">',c=0,d=sort_projects(AGENCIES),e=0;e<d.length;e++){var f=d[e][0];b+=c%2==1?"<tr>":'<tr style="background-color: #eee">';if(d[e][1]!==undefined&&f in VISIBLE_AGENCIES){f=d[e][1].city;var g=d[e][1].state,k="O_MAP.show_long_lat("+d[e][1].longitude+", "+d[e][1].latitude+", "+d[e][1].zoom+" )",i=d[e][1].name;if(f.length&&g.length)i='<td><a href="javascript:'+k+';" title="Zoom in to this agency" id="'+
f+'_zoomto">'+i+"</a></td>";b+="<td>"+i+"</td>"}b+="</tr>";c++}b+="</table>";a.innerHTML=b}function show_wait(){PLEASE_WAIT.style.visibility="visible"}function hide_wait(){PLEASE_WAIT.style.visibility="hidden"}function un_init(){GEvent.clearListeners(O_MAP.map_canvas);GUnload();O_GRAPH=O_MAP=O_EVENTLIST=O_SERVER=null};function Server(){this.service_url=location.host=="oxford.coronasolutions.com"?"http://"+location.host+"/nusvc-dev":"http://"+location.host+"/nusvc"}
Server.prototype.make_request=function(a,b){var c=false;try{c=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){c=false}}if(!c&&typeof XMLHttpRequest!="undefined")c=new XMLHttpRequest;show_wait();c.open("GET",this.service_url+a,true);c.onreadystatechange=function(){if(c.readyState===4)if(c.status===200)b(c);else if(c.status===500)alert("Internal Server Error");else if(c.status===501)alert("Not Implemented");else if(c.status===502)alert("Bad Gateway");
else if(c.status===503)alert("Service Unavailable\nPlease try again.");else c.status===504&&alert("Gateway Timeout\nPlease try again.")};c.send(null);delete c.onreadystatechange;window.CollectGarbage&&CollectGarbage()};Server.prototype.report_error=function(a,b){this.make_request("?m=report_error&e="+a+"&msg="+b,function(){})};
Server.prototype.get_events=function(a,b,c,d){if(d){var e;if(a===undefined||b===undefined)return 0;if(!(REQUEST_PENDING>0)){REQUEST_PENDING++;e=MAP_ZOOM_LEVEL<=10?1:0;var f=get_cookie("email");f=f===""?"":"&email="+f;this.make_request("?m=get_events&b="+a+"&e="+b+"&extents="+c+"&mx="+get_num_points()+"&ac="+e+"&nolist="+e+"&categories="+d+f,function(g){g=eval("("+g.responseText+")");EVENT_LIST=g.events;GRAPH_DATA=g.graph_linedata;CAT_COUNTS=g.category_counts;if(e==1)A_C=g.agency_counts;window.setTimeout(function(){EVENT_FROMDRAG=
EVENT_FROM_ZOOM=false},500);window.setTimeout("update_visible_agencies();",1E3);window.setTimeout("O_GRAPH.refresh();",250);window.setTimeout("O_EVENTLIST.refresh();",270);window.setTimeout("O_MAP.draw_points();",400);window.setTimeout("O_SCOREBOARD.refresh();",550);REQUEST_PENDING--})}}else O_MAP.map_canvas.clearOverlays()};Server.prototype.get_categories=function(){this.make_request("?m=get_categories",function(a){CATEGORIES=eval("("+a.responseText+")")})};
Server.prototype.get_agencies=function(){this.make_request("?m=get_agencies",function(a){AGENCIES=eval("("+a.responseText+")")})};Server.prototype.get_types=function(){this.make_request("?m=get_types",function(a){TYPES=eval("("+a.responseText+")")})};Server.prototype.add_email_alert=function(a,b,c,d){this.make_request("?m=add_email&email="+a+"&ext="+c+"&desc="+b+"&zoom="+d,function(e){SUBSCRIBE_RESULT=eval("("+e.responseText+")");return SUBSCRIBE_RESULT.code})};function Browser(){var a,b,c;this.isNS=this.isIE=false;this.version=null;a=navigator.userAgent;b="MSIE";if((c=a.indexOf(b))>=0){this.isIE=true;this.version=parseFloat(a.substr(c+b.length))}else{b="Netscape6/";if((c=a.indexOf(b))>=0){this.isNS=true;this.version=parseFloat(a.substr(c+b.length))}else{b="Gecko";if(a.indexOf(b)>=0){this.isNS=true;this.version=6.1}}}};function EventList(a){this.div=document.getElementById(a);$.tablesorter.addParser({id:"hourmin",is:function(){return false},format:function(b){var c=0;if(b.toLowerCase()==="< 1")c=0;if(b.toLowerCase()==="&nbsp;")c=0;if(b.match(/h$/)){c=b.replace(/h/,"");c*=60}if(b.match(/m$/))c=b.replace(/m/,"");return c},type:"numeric"});$.tablesorter.addParser({id:"address",is:function(){return false},format:function(b){var c="";b=b.toLowerCase();if(b.match(/^\d+/)){var d=c="";b=b.split(" ");for(var e=0;e<b.length;e++){var f=
b[e];if(!(f.length<=2))if(f.match(/^\d+$/))c=f;else d=f}c=c+" "+d}else c=b.replace(/^[e|w|n|s] /,"");return c},type:"text"})}
EventList.prototype.start=function(){if(events===undefined||events.length<1)this.div.innerHTML="No events displayed for the area shown. Zoom in or change to a different location.";else{this.div.innerHTML="";["<table width='100%' id=\"events_table\"><tr>","<th colspan='6'>Listing "+EVENT_LIST.length+" Significant Events of "+O_SCOREBOARD.cat_total+" (click a row to get more info)</th></tr><tr>","<th>Type</th><th>Location</th><th>Received</th><th>&nbsp;&nbsp;Cars </th><th> Time </th></tr>"].join("");
VISIBLE_AGENCIES=[]}};EventList.prototype.refresh_nolimit=function(){O_EVENTLIST.refresh("none");EVENT_LIST_LIMIT=EVENT_LIST.length;O_MAP.draw_points();O_SCOREBOARD.fill_most_sig_lst()};
EventList.prototype.refresh=function(a){var b;if(MAX_TABLE)limit=EVENT_LIST_LIMIT;if(!a&&!MAX_TABLE){limit=EVENT_LIST_LIMIT;b='<tfoot><tr ><td style="text-align: center;" colspan="6"><a href="javascript: O_EVENTLIST.refresh_nolimit();">Click here to display '+EVENT_LIST.length+" events.</a></td></tr><tfoot>"}else if(a==="none"){MAX_TABLE=true;limit=EVENT_LIST.length;b=""}a=EVENT_LIST;var c=TYPES,d=CATEGORIES;if(O_MAP.get_zoom()<=10){b="<div id='no_events'>";b+="You are zoomed out too far to view any events.</div>";
this.div.innerHTML=b}else if(a===undefined||a.length<1){VISIBLE_AGENCIES=[];update_visible_agencies();b="<div id='no_events' class='no_print'> There were no events found in this geographic area.  Potential reasons are:<ul>";b+="<li>The agency responsible for this jurisdiction is not a member of the Neighborhood Update program.</li>";b+="<li>There are no events reported for this area within the specified date range, try selecting a longer date span.</li>";b+="<li>The agency has not yet provided any data for the selected date range.</li>";
b+="<li>You are zoomed in too close to see events.  Try using the vertical slider on the map to zoom out.</li></ul></div>";this.div.innerHTML=b}else{this.div.innerHTML="";var e="<table id=\"events_table\"><thead><tr><th class='nofinger' colspan='6' id='most_sig_lst'></th></tr><tr><th class='nofinger'></th><th>Type</th><th>Location</th><th>Received</th><th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cars&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th><th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th></tr></thead><tbody>";
VISIBLE_AGENCIES=[];var f=(new Date).getFullYear(),g=f-1+"",k=g-1+"";f+="";for(var i=f.replace(/^20/,""),m=g.replace(/^20/,""),p=k.replace(/^20/,""),h=0;h<a.length;h++){var j="?",r,l=0,n=a[h][1];n=n.replace(/:[0-9]+\s[A-Z]+$/,"");n=n.replace(f,i);n=n.replace(g,m);n=n.replace(k,p);try{r=a[h][6]||"?";cat_icon=parseInt(r,10);j=c[a[h][7]].type||"?";l=d[r].hidden}catch(u){O_SERVER.report_error(u.description,"can't assign values")}if(h==limit)break;if(!l){var o=a[h][16];if(o.length>21)o=o.substr(0,18)+
"...";l=Math.round(a[h][13]);if(l>60){l/=60;l=Math.round(l*100)/100;l+="h"}else if(l>0)l+="m";else l=l===0?"< 1":"&nbsp;";var s=a[h][12];if(parseInt(a[h][18],10)===1)s="N/A";if(parseInt(a[h][19],10)===1)l="N/A";var q=a[h][2];this.zoom_to_event(h+1,a[h][4],a[h][5],q);e+=['<tr  title="',a[h][16],'" id="',q,'"><td>','<img src="/icons/'+CATEGORY_MARKERS[cat_icon]+'"/>',"</td><td>",j,"</td><td>",o,"</td><td>",n,'</td><td class="cars">',s,'</td><td class="time">',l,"</td></tr>"].join("");o=a[h][0]}VISIBLE_AGENCIES[o+
""]=1}e+=b;e+="</tbody></table>";this.div.innerHTML=e;$("#events_table").tablesorter({widgets:["sortPersist"],headers:{0:{sorter:false},1:{sorter:false},2:{sorter:"address"},5:{sorter:"hourmin"}}})}};EventList.prototype.zoom_to_event=function(a,b,c,d){return['onclick="javascript:O_MAP.zoom_to_point(',b,", ",c,", '",d,"' )\""].join("")};function sort_keys(a){var b=[],c;for(c in a)b.push(c);b.sort(function(d,e){return parseInt(d,10)<parseInt(e,10)?-1:parseInt(d,10)>parseInt(e,10)?1:0});return b}
function Graph(){this.months=Array(12);this.months[0]="Jan.";this.months[1]="Feb.";this.months[2]="Mar.";this.months[3]="Apr.";this.months[4]="May.";this.months[5]="June";this.months[6]="July";this.months[7]="Aug.";this.months[8]="Sep.";this.months[9]="Oct.";this.months[10]="Nov.";this.months[11]="Dec.";this.color=[];this.color[0]="#3F73FB";this.color[1]="#9ACD32";this.color[2]="#FFA54F";this.color[3]="#FBEC5D";this.color[4]="#AFEEEE";this.color[5]="#CD4F39";this.color[6]="#DB70DB";this.color_index=
[];this.color_index[1]=2;this.color_index[2]=5;this.color_index[3]=3;this.color_index[4]=1;this.color_index[5]=6;this.color_index[6]=0;this.color_index[7]=4}Graph.prototype.refresh=function(){var a=gelement("line_graph"),b=gelement("pie_graph");a.innerHTML="";b.innerHTML="";if(O_MAP.get_zoom()<=10){a.innerHTML="Zoom in to view graph data.";b.innerHTML=""}else this.draw_chart()};
Graph.prototype.draw_chart=function(){var a=GRAPH_DATA,b=CATEGORIES,c=1,d=0;TYPE_TOTALS=[];for(var e in a.type)for(var f in a.type[e])for(var g in a.type[e][f])if(TYPE_TOTALS[e]===undefined)TYPE_TOTALS[e]=parseInt(a.type[e][f][g],10);else TYPE_TOTALS[e]+=parseInt(a.type[e][f][g],10);var k=(new Date).getMonth(),i=[],m=[];e={};f=[];g={};var p=[],h;for(h in a.cat)if(b[h].hidden!==1){e[h]=[];g[h]=[];var j={};j.label=b[h].category;j.color=this.color[this.color_index[h]];p.push(this.color[this.color_index[h]]);
m.push(j);j=0;for(var r=sort_keys(a.cat[h]),l=0;l<r.length;l++)for(var n=r[l]+"",u=sort_keys(a.cat[h][n]),o=0,s=0;s<u.length;s++){var q=u[s];if(l+1==r.length&&s+1==k+1)break;else{var v;v=q==0?parseInt(a.cat[h][n][1],10):parseInt(a.cat[h][n][q],10);g[h]=g[h]?parseInt(v,10)+0:parseInt(v,10)}if(d===0){n.replace(/20/,"");try{i.push([o,(this.months[q-1]||this.months[q])+" "+n])}catch(x){}}try{value=q==0?parseInt(a.cat[h][n][1],10):parseInt(a.cat[h][n][q],10);if(q<10)q="0"+q;e[h].length<13&&e[h].push(value);
f.length<13&&this.months[q-1]&&f.push(this.months[q-1]+" "+n.replace(/20/,""))}catch(y){}j++;o++}d=1;c++}a=[];c=(new Date).getMonth();(new Date).getFullYear();d=[];for(var w in e){h={name:b[w].category,data:e[w],color:this.color[this.color_index[w]]};a.push(h)}for(var t in g){h={name:b[t].category,y:g[t],color:this.color[this.color_index[t]]};d.push(h)}if(c<10)c="0"+c;new Highcharts.Chart({credits:{enabled:false},chart:{renderTo:"line_graph",defaultSeriesType:"line"},xAxis:{categories:f,labels:{rotation:-45,
align:"right",style:{font:"normal 13px Verdana, sans-serif"}}},yAxis:{title:{text:"Number of Events"},min:0,plotLines:[{value:0,width:1,color:"#808080"}]},title:{text:"12-Month Trend in Current Map Area"},series:a});new Highcharts.Chart({credits:{enabled:false},chart:{renderTo:"pie_graph",plotBackgroundColor:null,plotBorderWidth:null,spacingLeft:60,spacingRight:60,plotShadow:false},title:{text:"% of Events by Category"},tooltip:{formatter:function(){return"<b>"+this.point.name+"</b>: "+Math.ceil(this.y/
this.total*100)+" %"}},plotOptions:{pie:{allowPointSelect:true,cursor:"pointer",dataLabels:{enabled:true,color:"#808080",connectorColor:"#808080",formatter:function(){return"<b>"+this.point.name+"</b>"}}}},series:[{type:"pie",name:"% Events by Category",data:d}]})};function InfoOverlay(a,b){this.marker=a;this.msg=b}InfoOverlay.prototype=new GOverlay;InfoOverlay.prototype.initialize=function(a){this.outer_div=document.createElement("div");this.div=document.createElement("div");this.map=a};
InfoOverlay.prototype.redraw=function(a){gelement("bubble")&&this.remove();if(a){this.outer_div.style.top=0;this.outer_div.style.left=0;this.outer_div.id="bubble_outer";this.div.id="bubble";this.div.innerHTML='<div class="right" id="bubble_top"><a href="" onclick="javascript: O_MAP.map_canvas.removeOverlay( O_MAP.ol ); return false;">close [-]</a><br />';this.div.innerHTML+=this.msg;this.div.innerHTML+="</div>";a=this.map.fromLatLngToContainerPixel(this.marker.getPoint()).x;var b=this.map.fromLatLngToContainerPixel(this.marker.getPoint()).y,
c="left";this.div.style.width="270px";this.div.style.height="200px";if(270+a>735&&200+b>400){if(b>b/2)c="bottom_right";a=a-270-65;b=b-200+40}else{if(270+a>735){c="right";a=a-270-65}if(200+b>400){if(a>a/2)c="bottom_left";b=b-200+40}}this.outer_div.style.top=b-35+"px";this.outer_div.style.left=a+"px";this.outer_div.appendChild(this.div);this.div.style.left="20px";this.outer_div.style.backgroundImage="url( /images/normal_"+c+".png )";this.outer_div.style.backgroundRepeat="no-repeat";this.outer_div.style.backgroundPosition=
"center";gelement("map_canvas").appendChild(this.outer_div)}};InfoOverlay.prototype.remove=function(){gelement("bubble_outer",1)&&gelement("map_canvas").removeChild(document.getElementById("bubble_outer"))};function Map(a){this.map_div=gelement(a);this.have_events=this.previous_extents=0;this.gevent_array=[];this.marker_xy=[];if(GBrowserIsCompatible())this.map_canvas=new GMap2(this.map_div);else{alert("This browser is not compatible with Google Maps!");return false}this.map_canvas.enableDoubleClickZoom();GEvent.addListener(this.map_canvas,"zoomend",function(b,c){MAP_ZOOM_LEVEL=c});this.geocoder=new GClientGeocoder;typeof Log!=="undefined"&&Log.debug("Geocoder",this.geocoder);this.map_canvas.setUIToDefault();
this.map_canvas.setMapType(G_NORMAL_MAP);this.base_icon=new GIcon(G_DEFAULT_ICON);this.base_icon.shadow=null}
Map.prototype.create_marker=function(a,b,c,d,e){d||(d=new GSize(9,15));this.base_icon.infoWindowAnchor=new GPoint(d.width/2,d.height);var f=new GIcon(this.base_icon);f.iconSize=d;f.image="http://myneighborhoodupdate.net/icons/"+c;f.printImage="http://myneighborhoodupdate.net/icons/"+c;f.printShadow=null;this.have_events=1;var g=new GMarker(a,{icon:f});c=GEvent.addListener(g,"click",function(){scroll(0,0);if(e){O_MAP.pano_client&&document.getElementById("map_pano").style.visibility==="visible"&&O_MAP.create_pano(a.lat(),
a.lng());for(var m=document.getElementById("events_table"),p=document.getElementById(e),h=0;h<m.rows.length;h++)m.rows[h].style.background="white";p.style.background="#ffff99"}O_MAP.ol=new InfoOverlay(g,b);O_MAP.map_canvas.addOverlay(O_MAP.ol)});if(e)try{var k=GEvent.addDomListener(document.getElementById(e),"click",function(){for(var m=document.getElementById("events_table"),p=document.getElementById(e),h=0;h<m.rows.length;h++)m.rows[h].style.background="white";p.style.background="#ffff99";m=GEvent.trigger(g,
"click");O_MAP.gevent_array.push(m)})}catch(i){}this.gevent_array.push(k);this.gevent_array.push(c);this.marker_xy.push(a.x+","+a.y);return g};
Map.prototype.create_pano=function(a,b){var c=gelement("map_pano"),d=gelement("pano_info");d.innerHTML="";d.style.width="695px";d.style.height="320px";d.style.border="1px solid #333333";O_MAP.pano_client=new GStreetviewClient;c.style.visibility="visible";c=new GLatLng(a,b);O_MAP.pano=new GStreetviewPanorama(gelement("pano_info"));O_MAP.pano_client.getNearestPanorama(c,function(e){d.style.textAlign="center";if(e.code===600)d.innerHTML="<br /><br /><br /><br /><br /><br /><br /><br />Sorry, street view not found for this area.";
else if(e.code===603)d.innerHTML="<br /><br /><br /><br /><br /><br /><br /><br />Sorry, flash plugin required for street view."});O_MAP.pano.setLocationAndPOV(c);GEvent.addListener(O_MAP.pano,"error",function(e){d.style.textAlign="center";if(e===600)d.innerHTML="<br /><br /><br /><br /><br /><br /><br /><br />Sorry, street view not found for this area.";else if(e===603)d.innerHTML="<br /><br /><br /><br /><br /><br /><br /><br />Sorry, flash plugin required for street view."})};
Map.prototype.draw_points=function(){this.map_canvas.clearOverlays();if(gelement("count_div")){var a=gelement("count_div");this.map_canvas.getPane(G_MAP_MAP_PANE).removeChild(a)}if(this.have_events==1){for(a=0;a<this.gevent_array.length;a++)this.gevent_array[a]&&GEvent.removeListener(this.gevent_array[a]);this.gevent_array=[]}a=EVENT_LIST;a.length==0&&hide_wait();window.setTimeout(function(){O_MAP.map_canvas.addControl(new PointCount)},1E3);var b=CATEGORIES,c=AGENCIES;this.center=this.map_canvas.getCenter();
MAX_POINTS=get_num_points();if(MAP_ZOOM_LEVEL<=10||INITIAL_LOAD==1){this.show_agencies();INITIAL_LOAD=0}else for(var d=0,e=0;e<a.length;e++){var f=a[e][7],g=parseInt(a[e][6],10);if(!b[g].hidden||b[g].hidden===1){if(VISIBLE_TYPES[f]===undefined)VISIBLE_TYPES[f]=1;else VISIBLE_TYPES[f]+=1;var k=a[e][12],i=a[e][16],m=a[e][2],p=b[g].category||"?",h=Math.round(a[e][13]);if(parseInt(h,10)===0)h="< 1";var j="",r="",l=c[a[e][0]].phone||"",n="";j=c[a[e][0]].url?'<a href="'+c[a[e][0]].url+'" target="_blank">'+
c[a[e][0]].name+"</a>":c[a[e][0]].name;r=c[a[e][0]].email?'<a href="mailto:'+c[a[e][0]].email+"?subject=Regarding dispatched event # "+a[e][2]+'">Send e-mail</a>':"";n=parseInt(a[e][19],10)===1?"":"<br /><b>Consumed time:</b> "+h+" minutes";units_string=parseInt(a[e][18],10)===1?"":"<br /><b># cars arrived:</b> "+k;var u=new GLatLng(parseFloat(a[e][5]),parseFloat(a[e][4])),o=a[e][1],s=(new Date).getFullYear(),q=s-1+"",v=q-1+"";s+="";var x=s.replace(/^20/,""),y=q.replace(/^20/,""),w=v.replace(/^20/,
"");o=o.replace(/:[0-9]+\s[A-Z]+$/,"");o=o.replace(s,x);o=o.replace(q,y);o=o.replace(v,w);f=["<b>Type:</b> ",TYPES[f].type,'<br /><b>Category:</b> <a href="javascript:show_types(',g,');">',p,"</a><br /><b>Received:</b> ",o,"<br /><b>Location:</b> ",i,units_string,n,"<br /><b>Agency:</b> ",j,"<br /><b>Contact: </b> ",l," ",r,"<br /><b>Police Event #: </b>",a[e][2],'<br /><hr /><center><a style="color: #91919f;" href="javascript: O_MAP.create_pano( ',a[e][5],", ",a[e][4],' );"><img src="/images/sv.jpg" style="width: 20px; vertical-align: middle;"/><b> Show street view</b></a></center>'].join("");
g=g;var t;i=j=10;j+=j-MAP_ZOOM_LEVEL*0.15;i+=j-MAP_ZOOM_LEVEL*0.15;if(k>1&&h>10&&h<5E3){if(k>13)k=13;p=h/40;if(p>5)p=5;j=j+j*j/200*p;i=i+i*i/200*p;if(h/k>5)t=new GSize(j,i)}else t=new GSize(j,i);k=d>=EVENT_LIST_LIMIT?this.create_marker(u,f,CATEGORY_MARKERS[g],t):this.create_marker(u,f,CATEGORY_MARKERS[g],t,m,true);this.map_canvas.addOverlay(k);d++;if(d==a.length){if(O_MAP.input_address_point){k=new GSize(35,35);k=this.create_marker(this.input_address_point,O_MAP.input_address,"youarehere.gif",k);
this.map_canvas.addOverlay(k)}hide_wait()}if(d>=MAX_POINTS)break}}};
Map.prototype.show_agencies=function(){this.map_canvas.clearOverlays();hide_wait();VISIBLE_AGENCIES=[];for(var a in AGENCIES){var b=new GSize(16,25),c=AGENCIES[a].longitude,d=AGENCIES[a].latitude,e=O_MAP.get_extents().split(",");if(parseInt(AGENCIES[a].longitude,10)>=parseInt(e[0],10)&&parseInt(AGENCIES[a].latitude,10)>=parseInt(e[1])&&parseInt(AGENCIES[a].longitude,10)<=parseInt(e[2],10)&&parseInt(AGENCIES[a].latitude,10)<=parseInt(e[3],10))VISIBLE_AGENCIES[a+""]=1;e=new GLatLng(parseFloat(d),parseFloat(c));
var f='<br /><br /><div style="font-size: 12px;">';f+=AGENCIES[a].name;f+=[" ("+c+" : "+d+")<br />"].join();c=["javascript:O_MAP.zoom_to_point( "+c+", "+d+");"].join();f+=['<br /><a href="'+c+'"><img src="/images/magnify_icon.gif"/> &nbsp;Zoom in &raquo;</a>'].join();f+="</div>";this.map_canvas.addOverlay(this.create_marker(e,f,"agency.png",b,"",false))}update_visible_agencies()};
Map.prototype.show_address=function(a){if(a==="pirate!"){alert("Pirate mode activated!");O_SCOREBOARD.use_pirate=true;O_SCOREBOARD.refresh()}else if(a==="Pants the squirrel"){alert(":O");gelement("footer").style.backgroundImage="url( '/images/sq.jpg' ) "}else{var b=new GIcon(this.base_icon);b.image="http://myneighborhoodupdate.net/icons/youarehere.gif";b.printImage="http://myneighborhoodupdate.net/icons/youarehere.gif";b.printShadow=null;this.have_events=1;SEARCHES.push(a);document.addr.sb.value=
a;gelement("search_div").style.display="none";this.geocoder.getLatLng(a,function(c){if(c){O_MAP.input_address_point=c;O_MAP.input_address=a;O_MAP.map_canvas.setCenter(c,15);refresh()}else alert(a+" isn't recognized as an address or location.")})}};
Map.prototype.show_long_lat=function(a,b,c){var d=new GIcon(this.base_icon);d.image="http://myneighborhoodupdate.net/icons/youarehere.gif";d.printImage="http://myneighborhoodupdate.net/icons/youarehere.gif";d.printShadow=null;this.have_events=1;a=new GLatLng(b,a);O_MAP.map_canvas.setCenter(a,c);refresh()};
Map.prototype.get_extents=function(){this.map_canvas.bounds=this.map_canvas.getBounds();var a=this.map_canvas.bounds.getSouthWest(),b=this.map_canvas.bounds.getNorthEast();return a.lng()+","+a.lat()+","+b.lng()+","+b.lat()};Map.prototype.get_center=function(){return this.map_canvas.getCenter().toString().replace("(","").replace(")","")};Map.prototype.get_zoom=function(){return this.map_canvas.getZoom()};
Map.prototype.zoom_to_address=function(a){this.geocoder.getLatLng(a,function(b){b&&O_MAP.map_canvas.setCenter(b,13)})};Map.prototype.geocode=function(a){return this.geocoder.getLatLng(a,function(b){if(b)return b})};Map.prototype.zoom_to_point=function(a,b){this.map_canvas.setCenter(new GLatLng(b,a),15)};function PointCount(){}PointCount.prototype=new GControl;PointCount.prototype.initialize=function(a){var b=document.createElement("div"),c;this.setButtonStyle_(b);c=EVENT_LIST.length;if(O_SCOREBOARD.cat_total===undefined)O_SCOREBOARD.cat_total=0;b.appendChild(document.createTextNode("Displaying "+c+" of "+O_SCOREBOARD.cat_total+" events."));a.getContainer().appendChild(b);return b};PointCount.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(3,365))};
PointCount.prototype.setButtonStyle_=function(a){a.style.textDecoration="none";a.style.color="black";a.style.backgroundColor="white";a.style.font="small Arial";a.style.border="1px solid black";a.style.padding="1px";a.style.marginBottom="3px";a.style.textAlign="center";a.style.width="14em";a.style.height="14px";a.style.cursor="pointer"};function ScoreBoard(a){this.div=gelement(a);this.selected_type=this.selected_id=0}
ScoreBoard.prototype.refresh=function(){this.div.innerHTML="";var a='<table id="score_board_table"><tr>';a+='<th class="no_print">On</th>';a+="<th>&nbsp;</th>";a+="<th>Category</th>";a+="<th>#</th></tr>";var b;b=CATEGORIES;var c=0,d=[];this.cat_total=0;for(var e in b){var f;if(CAT_COUNTS[e]){f=CAT_COUNTS[e].count;this.cat_total+=parseInt(CAT_COUNTS[e].count,10)}else{f=0;this.cat_total+=0}d.push(f)}d=d.sort(function(k,i){return k-i});for(var g in CATEGORIES){e=parseInt(g,10);if(CATEGORIES[g].hidden===
1||!(g in URL_ACTIVE_CATEGORIES)&&CATEGORIES[g].hidden===undefined&&URL_ACTIVE_CATEGORIES.length!==0){CATEGORIES[g].hidden=1;b=""}else{CATEGORIES[g].hidden=0;b="checked"}a+=c%2==1?"<tr>":'<tr style="background-color: #eee">';a+=['<td class="no_print"><input type="checkbox" ',b,' title="Show or hide this category" id="',g,'_checkbox" onclick="O_SCOREBOARD.update_selected_categories(this, ',g,');"></input></td>'].join("");a+='<td><img src="/icons/'+CATEGORY_MARKERS[e]+'" /></td>';b=CAT_COUNTS[g]?CAT_COUNTS[g].count:
0;e='onclick="show_types('+g+');"';f="<div "+(' onmouseout="hide_types('+g+', event );"')+' style="display: none;" class="score_board_type" id="'+g+'">'+this.get_types(g)+"</div>";if(this.use_pirate===true)CATEGORIES[g].category=P_N[g];a+='<td class="help_link" id="parent_to_'+g+'" '+e+"> "+CATEGORIES[g].category+' </td><td class="right">'+b+"</td>";a+="</tr>";a+='<tr><td></td><td></td><td colspan="2">'+f+"</td></tr>";b=10*(b-d[0])*9/(d[6]-d[0]);if(isNaN(b))b=0;a+='<tr class="mini_graph"><td colspan="5"><div style="border: 1px solid #aaaaaa; width: '+
b+'%; height: 4px; margin-bottom: 7px; font-size: 5px;"><div style="border: 2px solid '+CATEGORY_COLORS[g]+' "></div></td></tr>';c++}URL_ACTIVE_CATEGORIES.length=0;a+="</table>";this.fill_print_div();this.fill_most_sig_lst();this.div.innerHTML=a};function sortAssoc(a){var b=[],c;for(c in a)b.push([c,a[c]]);b.sort(function(d,e){return d[1]-e[1]});a=[];for(c=b.length-1;c>=0;c--)a[b[c][0]]=b[c][1];return a}
ScoreBoard.prototype.fill_print_div=function(){var a=[],b=gelement("type_totals_div"),c;for(c in TYPES)if(VISIBLE_TYPES[c]!==undefined)a[TYPES[c].type+""]=VISIBLE_TYPES[c]+"";sortAssoc(a);a="";a+='<table id="type_table">';a+="<tr>";c="";for(cat in CATEGORIES){a+="<th>"+CATEGORIES[cat].category+'(<img src="/icons/'+CATEGORY_MARKERS[cat]+'"/>)</th>';c+="<td>"+this.get_types(cat,true)+"</td>"}a+="</tr>";a+="<tr>";a+=c;a+="</tr>";a+="</table>";b.innerHTML=a};
ScoreBoard.prototype.fill_most_sig_lst=function(){var a=document.getElementById("most_sig_lst");if(a)a.innerHTML=EVENT_LIST.length+" most significant events out of "+this.cat_total+" (click a row to get more info)"};
ScoreBoard.prototype.get_types=function(a,b){var c=[],d=[],e='<table width="100%">',f;for(f in TYPES)if(TYPES[f].type&&TYPES[f].categoryid===parseInt(a)&&TYPE_TOTALS[f])c[TYPES[f].type+""]=TYPE_TOTALS[f];d=sortAssoc(c);for(var g in d)e+=b?"<tr><td>"+g+"</td><td align='right'>"+c[g+""]+"</td></tr>":"<tr><td>&nbsp;&#8227;&nbsp;"+g+"</td><td align='right'>"+c[g+""]+"</td></tr>";e+="</table>";return e};
ScoreBoard.prototype.update_selected_categories=function(a,b){CATEGORIES[b].hidden=a.checked===false?1:0;soft_refresh()};

