// fchat.js (version 0.2 - NOT the one on sheffmusic!!! Don't forget, Alch)
// Extracted from main chat by Alch (17 Nov 2002) to speed up chat
// Based on a suggestion aeons ago by Baph... i.e. I'm lazy
//
function multiPopUp(path,w,h) {
  var params = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=" + w + ",height=" + h;
  return window.open(path,"_blank",params);
}
function doNewwin(path) { multiPopUp(path,500,300); }
function doCredits() { multiPopUp("credits.html",500,400); }
function timestamp() {
  var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  var days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
  var date = new Date(document.lastModified);
  var year = date.getYear(),month=months[date.getMonth()],day=days[date.getDay()];
  if ( year < 1900 ) year += 1900;
  return day + " " + ordinal(date.getDate()) + " " + month + ", " + year + " (" 
       + TwoDigits(date.getHours()) + ":" 
       + TwoDigits(date.getMinutes()) + ":" 
       + TwoDigits(date.getSeconds()) + " UK Time)";
}
function TwoDigits(n) { return (n==0) ? "00" : (n<10) ? "0"+n : n; }
function ordinal(n) {
  var ending = new String();
  var num = parseInt(n);
  var abs = Math.abs(num);
  var tens = parseInt((abs%100)/10);
  if ( tens == 1 )
    ending = "th";
  else switch(abs%10) {
    case 1:  ending = "st"; break;
    case 2:  ending = "nd"; break;
    case 3:  ending = "rd"; break;
    default: ending = "th"; break;
  }
  return "" + num + ending.sup();
}
function force_reload() { self.setTimeout("location.reload()",8000); }

// Invoke force_reload NOW, before the page has finished loading. Otherwise
// large or slow images could freeze the page for aeons. Allow 10 seconds
// - not too long, but long enough...

self.setTimeout("location.reload()",10000);
