// Fix for Years with Netscape
var YearAdd = 0;
var DayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var MonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];

if (navigator.appName == "Netscape")
  YearAdd = 1900;
	
function WriteDate() {
  var now = new Date();
  var DayofMonth = now.getDate();
  var Ending = "th";
  var sb = "";

  sb += "<span class='s6'><strong>Welcome to RailwayMania.Info, at ";
  sb += now.getHours() + ":" + ((now.getMinutes()<10) ? "0":"");
  sb += now.getMinutes() + " on " + DayNames[now.getDay()] + " the " + now.getDate();

  if((DayofMonth==1) || (DayofMonth==21) || (DayofMonth==31)) { Ending = "st"; }
  if((DayofMonth==2) || (DayofMonth==22)) { Ending = "nd"; }
  if((DayofMonth==3) || (DayofMonth==23)) { Ending = "rd"; }

  sb += Ending + " of " + MonthNames[now.getMonth()] + " " + now.getFullYear() + ".";
  sb += "<\/strong><\/span><br>";
  document.write(sb);
}

function LastUpdated() {
  var LastModified = new Date(document.lastModified);
  var DayofMonth = LastModified.getDate();
  var Ending = "th";

  if((DayofMonth==1) || (DayofMonth==21) || (DayofMonth==31)) {
	Ending = "st";
  }
  if((DayofMonth==2) || (DayofMonth==22)) {
	Ending = "nd";
  }
  if((DayofMonth==3) || (DayofMonth==23)) {
	Ending = "rd";
  }

  document.write("Last Updated: ");
  document.write(DayofMonth,Ending," of ",MonthNames[LastModified.getMonth()]," ",LastModified.getFullYear());
  document.write(".</font></center>");
}

function DisplayPicture() {
  var intMaxPics = 28;
  var dblPicNumber = 0;
  var intPicNumber = 0;
  var strPicName = "";

  dblPicNumber=Math.random() * (intMaxPics - 1);
  intPicNumber=Math.round(dblPicNumber);
  strPicName = "fr" + (intPicNumber + 1) + ".jpg";
  document.write("<img border=0 width=400 height=300 src=images/" + strPicName + ">");
}

function RandomHTML() {
  var HTMLCodeNo = 0;
  var HTMLCodes = [
    "More Photographs wanted, especially post privatisation liveries and rolling stock.",
    "<a href=ukrailmap.html>Click Here</a> to View the Railmap of Great Britain.",
    "<a href=photoindex.html>Latest Pictures</a> - Locomotives Classes 56, 57, 66, 67; EMU Classes 444, 450, 458.",
    "<a href=links.html>Links to Excellent Railway Pages</a> - Is yours among them?",
    "Photos from Melbourne, Australia! <a href=australia.html>Click Here</a>.",
	"New Photos from Perth, Australia! <a href=australia.html>Click Here</a>."];

  HTMLCodeNo=Math.random() * (HTMLCodes.length - 1);
  HTMLCodeNo=Math.round(HTMLCodeNo);
  document.write("<span class='s4'>" + HTMLCodes[HTMLCodeNo] + "<\/span>");
}
