text: "undefined"!==typeof CCPEVE&&CCPEVE.requestTrust("http://www.yourwebsite.org");function parse_date(a){a=a.split(/[- :]/);return new Date(a[0],a[1]-1,a[2],a[3],a[4],a[5])}function shorten_date(a){a=a.split(/[- :]/);return a[3]+":"+a[4]}function update_hostile(){EveLiveData.update_local_hostile()}function update_clear(){EveLiveData.update_local_clear()}function toggle_options(){var a=document.getElementById("header_options");a.style.display="block"==a.style.display?"none":"block"}
  var Options={map_mode:0,show_links:!0,show_names:!0,show_elapsed_times:!0,show_security_status:!0,orbit_targets:!1},JUMP_CIRCLE_RADIUS=80,NODE_RADIUS=8;function set_map_mode(a){Options.map_mode=a;draw_map()}function toggle_show_links(){Options.show_links=!Options.show_links;draw_map()}function toggle_show_names(){Options.show_names=!Options.show_names;draw_map()}function toggle_show_elapsed_times(){Options.show_elapsed_times=!Options.show_elapsed_times;draw_map()}
  function toggle_show_security_status(){Options.show_security_status=!Options.show_security_status;draw_map()}function toggle_show_intel_panel(){var a=document.getElementById("intel_container");a.style.display="none"==a.style.display?"inline-block":"none"}function toggle_orbit_target(){Options.orbit_targets=!Options.orbit_targets}var Data={max_jumps:1,max_x:1,min_x:-1,max_y:1,min_y:-1,nodes:[],links:[],nodes_per_jumps:[]},map_container=document.getElementById("map_container");width=map_container.clientWidth;
  height=map_container.clientHeight;var message_overlay=null;function setMessageOverlay(a){removeMessageOverlay();message_overlay=d3.select("svg").append("text").attr("class","info").attr("x",map_container.clientWidth/2).attr("y",map_container.clientHeight/2).attr("dy",".35em").text("text")}function removeMessageOverlay(){null!=message_overlay&&(message_overlay.remove(),message_overlay=null)}function print_error(a){setMessageOverlay("Error: "+a)}
  var security_status_color_V=[-1,-.9,-.8,-.7,-.6,-.5,-.4,-.3,-.2,-.1,0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],security_status_color_C="#8B0000 #960001 #A10002 #AC0002 #B80002 #C30002 #CF0002 #DB0001 #E70001 #F30001 #FF0000 #FF5F00 #FF8C00 #FF9500 #FF9D00 #FFA500 #D4C800 #9BE500 #00FF00 #46FF9C #00FFFF".split(" ");function security_status_color(a){return security_status_color_C[10+Math.floor(10*a)]}
  var main_svg=d3.select("#map_container").append("svg").style("width","100%").style("height","100%"),map_svg=null,system_menu=null,nodes=null,node_names=null,node_circles=null,links=null,circles_ref=null,scaleFactor=1,translation=[0,0];d3.select("#map_container").call(zm=d3.behavior.zoom().scaleExtent([.25,12]).on("zoom",zoom).on("zoomstart",zoom_start).on("zoomend",zoom_end));
  function draw_map(){null!=map_svg&&map_svg.remove();map_svg=main_svg.append("g").attr("id","map_svg");if(0!=Options.map_mode){for(var a=[],b=1;b<=Data.max_jumps;++b)a.push(JUMP_CIRCLE_RADIUS*b);circles_ref=map_svg.selectAll(".jump_circle").data(a).enter().append("circle").attr("class","jump_circle").attr("cx",width/2).attr("cy",height/2).attr("r",function(a){return a})}else circles_ref=null;var a=d3.layout.force().gravity(0).charge(-700).linkStrength(1).linkDistance(10).size([width,height]),c=0,d=
  0,e=Data.max_x-Data.min_x,f=Data.max_y-Data.min_y,g=.9*Math.min(width/e,height/f);Data.nodes.forEach(function(a){a.px=(a.system.x-Data.min_x)*g;a.py=(f-a.system.y+Data.min_y)*g;0==a.jumps?(c=width/2-a.px,d=height/2-a.py,a.fixed=!0):a.fixed=0==Options.map_mode});0!=Options.map_mode?Data.nodes.forEach(function(a){a.px+=c;a.py+=d;a.x=a.px;a.y=a.py}):Data.nodes.forEach(function(a){a.px+=(width-g*e)/2;a.py+=(height-g*f)/2;a.x=a.px;a.y=a.py});a.nodes(Data.nodes).links(Data.links).on("tick",function(a){if(1==
  Options.map_mode)nodes.each(function(a){if(0<a.jumps){var b=a.x-width/2,d=a.y-height/2,c=Math.sqrt(b*b+d*d);a.x=width/2+b/c*a.jumps*JUMP_CIRCLE_RADIUS;a.y=height/2+d/c*a.jumps*JUMP_CIRCLE_RADIUS}else a.x=width/2,a.y=height/2});else if(2==Options.map_mode){var b=[];for(a=0;a<Data.max_jumps+1;++a)b.push(0);nodes.each(function(a){if(0<a.jumps){var d=-Math.PI/2+2*Math.PI*b[a.jumps]/Data.nodes_per_jumps[a.jumps];a.x=width/2+Math.cos(d)*a.jumps*JUMP_CIRCLE_RADIUS;a.y=height/2+Math.sin(d)*a.jumps*JUMP_CIRCLE_RADIUS;
  b[a.jumps]++}else a.x=width/2,a.y=height/2})}});links=Options.show_links?map_svg.selectAll(".link").data(Data.links).enter().append("line").attr("class","link"):null;nodes=map_svg.selectAll(".node").data(Data.nodes).enter().append("g").attr("class","node").attr("id",function(a){return"system_"+a.system.id});Options.show_security_status&&nodes.style("stroke",function(a){return security_status_color(a.system.sec)});node_circles=nodes.append("circle").attr("r",NODE_RADIUS);Options.show_names?node_names=
  nodes.append("text").attr("text-anchor","middle").text(function(a){return a.system.name}):Options.show_elapsed_times&&(node_names=nodes.append("text").attr("text-anchor","middle"));if(1==Options.map_mode)for(a.start(),b=100;0<b;--b)a.tick();else a.start(),a.tick();a.stop();draw_node_names();draw_intel();zoom()}
  function draw_node_names(){node_names.each(function(a){var b=d3.select(this),c=a.x-width/2;a=a.y-height/2;var d=c*c+a*a,e=this.getBBox();1>d?(c=0,a=-1):(d=Math.sqrt(d),c/=d,a/=d);b.attr("dx",12*c+c*e.width/2);b.attr("dy",12*a+(a+.5)*e.height/2)})}function zoom_start(){}function zoom_end(){}
  function zoom(){null!=d3.event&&(scaleFactor=d3.event.scale,translation=d3.event.translate);for(var a=NODE_RADIUS,b=1;b<Data.nodes_per_jumps.length;++b){var c=1*Math.PI*JUMP_CIRCLE_RADIUS*b*scaleFactor/Data.nodes_per_jumps[b]-1;c<a&&(a=c)}a<NODE_RADIUS&&node_circles.attr("r",a);null!=nodes&&nodes.attr("transform",function(a){return"translate("+(translation[0]+scaleFactor*a.x)+","+(translation[1]+scaleFactor*a.y)+")"});Options.show_links&&null!=links&&links.attr("x1",function(a){return translation[0]+
  scaleFactor*a.source.x}).attr("y1",function(a){return translation[1]+scaleFactor*a.source.y}).attr("x2",function(a){return translation[0]+scaleFactor*a.target.x}).attr("y2",function(a){return translation[1]+scaleFactor*a.target.y});null!=circles_ref&&circles_ref.attr("cx",function(a){return translation[0]+scaleFactor*width/2}).attr("cy",function(a){return translation[1]+scaleFactor*height/2}).attr("r",function(a){return scaleFactor*a})}var tracked_targets=[],t_ar=["t1","t2","t3"],target_timer=new Date;
  d3.timer(orbit_targets);function orbit_targets(){if(Options.orbit_targets)for(var a=new Date-target_timer,b=0;b<tracked_targets.length;b++)tracked_targets[b].attr("transform","rotate("+50*a/360+")")}
  function draw_targets(a){tracked_targets=[];for(var b=0;b<t_ar.length;b++){var c=d3.select("#target_"+t_ar[b]);if(t_ar[b]in a){var d=d3.select("#system_"+a[t_ar[b]]);if(d.empty())c.empty()||c.remove();else{var e=!0;c.empty()||(c.node().parentNode!=d.node()?c.remove():(e=!1,tracked_targets.push(c)));e&&(c=NODE_RADIUS+7,e=45*b*Math.PI/180,d=d.append("rect").attr("class","tracking_target "+t_ar[b]).attr("id","target_"+t_ar[b]).attr("x",c*Math.cos(e)-3).attr("y",c*Math.sin(e)-3).attr("width",6).attr("height",
  6),tracked_targets.push(d))}}else c.empty()||c.remove()}}
  function draw_intel(){var a=EveLiveData.get_server_time();nodes.each(function(b){b=EveLiveData.get_intel_by_system(b.system.id);if(null!=b){var c=d3.select(this),d=c.select("circle"),e=parse_date(b.seen_at),e=.001*(a-e);if(1800<e||3==b.status)d.attr("class","gray"),Options.show_elapsed_times&&(b=c.select("text"),b.text(function(a){return Options.show_names?a.system.name:""}));else if(0==b.status?900<e?d.attr("class","oldBlue"):300<e?d.attr("class","middleBlue"):d.attr("class","freshBlue"):900<e?d.attr("class",
  "oldRed"):300<e?d.attr("class","middleRed"):d.attr("class","freshRed"),Options.show_elapsed_times){b=c.select("text");var f=Math.min(e,1800);b.text(function(a){return Options.show_names?a.system.name+" "+toMMSS(f):toMMSS(f)})}}});Options.show_elapsed_times&&draw_node_names()}function toMMSS(a){a=Math.floor(a);a-=3600*Math.floor(a/3600);var b=Math.floor(a/60);a-=60*b;10>b&&(b="0"+b);10>a&&(a="0"+a);return b+":"+a}
  var local_server_timespan_seconds=0,timer_start=new Date,local_status=0,timer_interval=0;
  function update_local_timer(){var a=.001*(new Date-timer_start),a=a+local_server_timespan_seconds,b=document.getElementById("local_timer_text"),c=document.getElementById("progress_friendly"),d=document.getElementById("progress_hostile");1800<a||3==local_status?(b.innerHTML="??:??",a=1800):b.innerHTML=toMMSS(a);a=1-a/1800;0==local_status?(c.style.width=Math.round(100*a)+"%",d.style.width=null):1==local_status?(c.style.width=null,d.style.width=Math.round(100*a)+"%"):(c.style.width=null,d.style.width=
  null)}EveLiveData.tracker1Elem=document.getElementById("tracker_1");EveLiveData.tracker2Elem=document.getElementById("tracker_2");EveLiveData.tracker3Elem=document.getElementById("tracker_3");EveLiveData.on_local_change=function(a){Data=EveStaticData.getSystemsWithin(a,4);draw_map();a=EveStaticData.getSystemByID(a);document.getElementById("local_system_name").innerHTML=a.name};
  EveLiveData.on_local_status_change=function(a){clearInterval(timer_interval);if("undefined"!==typeof a){var b=EveLiveData.get_server_time(),c=parse_date(a.seen_at);local_server_timespan_seconds=.001*(b-c);timer_start=new Date;local_status=a.status;update_local_timer();timer_interval=setInterval(update_local_timer,1E3)}else console.log("no local intel"),local_status=3;update_local_timer()};
  EveLiveData.on_new_intel=function(a){var b=d3.select("#intel_container");a.forEach(function(a){var d=b.insert("div",":first-child");0==a.status?d.attr("style","background-color: #0000AA"):1==a.status&&d.attr("style","background-color:#AA0000");var e=EveStaticData.getSystemByID(a.system_id),f=EveStaticData.getRegionByID(e.region_id);d.html(shorten_date(a.seen_at)+"  -  "+f.name+" - "+e.name)})};EveLiveData.on_tracker_change=function(a){draw_targets(a)};EveLiveData.on_intel_update=function(){draw_intel()};
  EveStaticData.init(function(){draw_map();EveLiveData.init()});