   downloadDate = new Date;

// A function to return the current time in the form hh:mm:ss

function get_stime() {

   var sec = downloadDate.getSeconds();

   if (sec <= 9)  sec = "0"+sec;
   
   var min = downloadDate.getMinutes();

   if (min <= 9)  min = "0"+min;

   var hrs = downloadDate.getHours();

   var start = "s"+hrs+":"+min+":"+sec;

 return start;

}

function inFrameset() {
  if (window==window.parent) {
	// alert('In the top frame');
	return false;
  } else {
	// alert('In a frameset');
	return true;
  }
}

function escapeGET (theURL) {
   theURL=myreplace(theURL,'\?','QQ');        
   theURL=myreplace(theURL,'\&','|');  
   theURL=myreplace(theURL,'\=',':');
   return (theURL);
}

// A function to pass the parameters back to the CGI script in Edinburgh

function callCGI(imgstring) {

  if (!inFrameset() || !top.lastPageURL) {  
   // not in frameset - use referer
   refURL=escapeGET(document.referrer);
  } else {
  // use variable stored in top frame
    refURL=escapeGET(top.lastPageURL.href);
  }
 
 // write the GET URL to an image tag
 var imgstring = "<img src='/cgi-bin/msgtrack.pl?"
   //   +"time_start=" + get_stime()
   //   +"&lurl="+top.Lasturl
   +"&referer="+refURL
   +"&email="+msgcal.email
   +"&swidth="+screen.width
   +"&sheight="+screen.height
   +"'width='1' height='1'>";
 document.write(imgstring);
 
 // update "lastPage"
 if (inFrameset()) {
  top.lastPageURL=this.location;
 }

}
