+sub print_navlink {
+ my($params, $cond, $caption, $skip) = @_;
+
+ if ($cond) {
+ print(' <a href="', navlink($params, $caption, $skip),
+ '"', ">$caption</a>\n");
+ } else {
+ print qq[ <span class="disabled">$caption</span>\n];
+ }
+}
+
+sub navlink {
+ my($params, $caption, $skip) = @_;
+ local $params->{_skip} = $skip;
+ my $url = "?" . join("&", map { "$_=" . $params->{$_} } sort keys %$params);
+ $url = xml_encode($url);
+ return $url;
+}
+
+# Identical to the same-named function in full.mc
+# So maybe this should go into IRSpy::Utils.pm?
+#
+sub calc_reliability {
+ my($xc) = @_;
+
+ my @allpings = $xc->findnodes("i:status/i:probe");
+ my $nall = @allpings;
+ return "[untested]" if $nall == 0;
+ my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]');
+ my $nok = @okpings;
+ return "$nok/$nall = " . int(100*$nok/$nall) . "%";
+}
+
+
+# Just make this once; forge the connection on first use
+our $conn = undef;