#!/usr/local/bin/perl

$highband_main = "main.html";

$referer = $ENV{'HTTP_REFERER'};

if ($referer =~ /^http:\/\/([^\/]*)\/main.text.html/) {
   $result = substr($referer, 0, rindex($referer, '/') + 1);
   $result = $result.$highband_main;
}
else {
   $result = substr($referer, 0, rindex($referer, '/') + 1);
}

print "Location: $result\n\n";
