<!--
function TSHeader() {
//
//	TSHeader(Datetime, ThisPage, ThisTitle)
//      Version 00.00
//
//	Input: Datetime last modified
//             Name of current page
//             Title
//
//	Output: Standard header box, includes;
//                Title
//                Mail button
//                Date last modified
//
    var strOut1     = "";
    var strHdr      = "";
    var istrDate    = "";
    var istrPage    = "";
    var istrTitle   = "";
    var strQ        = '"';
    var strFill4    = "&nbsp;&nbsp;&nbsp;&nbsp;";
    var strFill8    = strFill4 + strFill4;
    var strUpdLabel = ""; 
    var argv = TSHeader.arguments;
    var argc = TSHeader.arguments.length;

    //
    // Get and process input parameters
    //
    istrDate     = (argc > 0) ? argv[0] : null;
    istrPage     = (argc > 1) ? argv[1] : null;
    istrTitle    = (argc > 2) ? argv[2] : null;

    //  Set last update label
    if (istrPage == "home")
       {strUpdLabel = "Site Last Updated: "}
    else
       {strUpdLabel = "Page Last Updated: "}

    //  HEADING TABLE
    document.write("<TABLE BORDER=0 BGCOLOR='#2060A0' WIDTH='100%' CELLPADDING=0 CELLSPACING=0><TR>");
    document.write("<TD WIDTH=170 BGCOLOR='#004080' ROWSPAN=2 VALIGN='center'><FONT COLOR='white' SIZE=4 FACE='Comic Sans MS'><CENTER>Riverside Yard</CENTER></FONT></TD>");
    document.write("<TD><CENTER><FONT COLOR='yellow' SIZE=5><B>" + istrTitle + "</B></FONT></CENTER></TD>");
    document.write("<TD WIDTH=50 ROWSPAN=2 VALIGN='top' ALIGN='left'><BR><A HREF='MailTo:riversi" + "deyard@y" + "ahoo.co.uk?" + "subject=Riverside-Yard'><IMG SRC='nemail.gif' BORDER=0 WIDTH=40 HEIGHT=20 VSPACE=0 HSPACE=0 ALT='Click here to mail me about Riverside Yard'></A></TD>");
    document.write("</TR><TR>");
    document.write("<TD ALIGN='right'><FONT SIZE=1 COLOR='white'>" + strUpdLabel + DisplayLastModified(istrDate) + strFill4 + "</FONT></TD>");
    document.write("</TR></TABLE>");

   }


function TSLinks() {
//
//	TSLinks(ThisPage)
//      Version 00.00
//
//      Create a navigation bar. All links will beactive except for the current page,
//      which will be marked with a pointer.
//
//	Input: Name of current page
//             
//	Output: Navigation bar as a 1 cell table
//
    var strOut1     = "";
    var strHdr      = "";
    var istrPage    = "";
    var strL1       = "";
    var strL2       = "";
    var strL3       = "";
    var strQ        = '"';
    var strFill4    = "&nbsp;&nbsp;&nbsp;&nbsp;";
    var strFill8    = strFill4 + strFill4;
    var strUpdLabel = ""; 
    var argv = TSLinks.arguments;
    var argc = TSLinks.arguments.length;

    //
    // Get and process input parameters
    //
    istrPage     = (argc > 0) ? argv[0] : null;

    //  Set level indicators
    if (istrPage == "home")
       {strL1 = "1";
        strL2 = "10";
        strL4 = "10  ";
       }
    else
       {strL1 = istrPage.substring(5, 6);
        strL2 = istrPage.substring(5, 7);
        strL4 = istrPage.substring(5, 9);
       }

    //  NAV BAR TABLE START
    document.write("<TABLE BORDER=1 BGCOLOR='#C0C0C0' WIDTH=170 BORDERCOLOR='#333355' CELLPADDING=0 CELLSPACING=0 VALIGN='top'><TR><TD>");
    document.write("<TABLE BORDER=0 WIDTH='100%' CELLPADDING=3 CELLSPACING=0>");

    //  NAV BAR LINKS
                          LinksBar0001(istrPage, "home",     1, "Homepage");
    if (strL2 == "11")   {LinksBar0001(istrPage, "jpage110", 2, "Progress")}
    if (strL4 == "110x") {LinksBar0001(istrPage, "jpage110x", 3, "Image Viewer")}
//
                          LinksBar0001(istrPage, "jpage200", 1, "Layouts");
    if (strL1 == "2")    {LinksBar0001(istrPage, "jpage230", 2, "Lakewood <FONT SIZE='-2'>HOn30</FONT>")}
    if (strL4 == "230x") {LinksBar0001(istrPage, "jpage230x", 4, "Image Viewer")}
    if (strL2 == "23")   {LinksBar0001(istrPage, "jpage231", 3, "Planning")}
    if (strL4 == "231x") {LinksBar0001(istrPage, "jpage231x", 4, "Image Viewer")}
    if (strL2 == "23")   {LinksBar0001(istrPage, "jpage234", 3, "Structures")}
    if (strL2 == "23")   {LinksBar0001(istrPage, "jpage235", 3, "Motive Power")}
    if (strL2 == "23")   {LinksBar0001(istrPage, "jpage236", 3, "Rolling Stock")}
    if (strL1 == "2")    {LinksBar0001(istrPage, "jpage240", 2, "Airedale <FONT SIZE='-2'>009</FONT>")}
    if (strL2 == "24")   {LinksBar0001(istrPage, "jpage241", 3, "009")}
    if (strL2 == "24")   {LinksBar0001(istrPage, "jpage242", 3, "Planning")}
    if (strL2 == "24")   {LinksBar0001(istrPage, "jpage243", 3, "Layout")}
    if (strL2 == "24")   {LinksBar0001(istrPage, "jpage244", 3, "Structures")}
    if (strL2 == "24")   {LinksBar0001(istrPage, "jpage245", 3, "Motive Power")}
    if (strL2 == "24")   {LinksBar0001(istrPage, "jpage246", 3, "Passenger Stock")}
    if (strL4 == "246x") {LinksBar0001(istrPage, "jpage246x", 4, "Image Viewer")}
    if (strL2 == "24")   {LinksBar0001(istrPage, "jpage247", 3, "Goods Stock")}
    if (strL4 == "247x") {LinksBar0001(istrPage, "jpage247x", 4, "Image Viewer")}
    if (strL1 == "2")    {LinksBar0001(istrPage, "jpage210", 2, "S&ARR <FONT SIZE='-2'>HOn30</FONT>")}
    if (strL2 == "21")   {LinksBar0001(istrPage, "jpage211", 3, "HOn30")}
    if (strL2 == "21")   {LinksBar0001(istrPage, "jpage212", 3, "SARR / WQRR")}
    if (strL2 == "21")   {LinksBar0001(istrPage, "jpage213", 3, "Planning")}
    if (strL2 == "21")   {LinksBar0001(istrPage, "jpage214", 3, "Layout")}
    if (strL2 == "21")   {LinksBar0001(istrPage, "jpage215", 3, "Rolling Stock 1")}
    if (strL4 == "215x") {LinksBar0001(istrPage, "jpage215x", 4, "Image Viewer")}
    if (strL2 == "21")   {LinksBar0001(istrPage, "jpage216", 3, "Rolling Stock 2")}
    if (strL4 == "216x") {LinksBar0001(istrPage, "jpage216x", 4, "Image Viewer")}
    if (strL2 == "21")   {LinksBar0001(istrPage, "jpage217", 3, "Rolling Stock 3")}
    if (strL1 == "2")    {LinksBar0001(istrPage, "jpage220", 2, "Riverside Yard <FONT SIZE='-2'>On30</FONT>")} 
    if (strL2 == "22")   {LinksBar0001(istrPage, "jpage225", 3, "Rolling Stock 1")}
    if (strL2 == "22")   {LinksBar0001(istrPage, "jpage226", 3, "Rolling Stock 2")}
    if (strL2 == "22")   {LinksBar0001(istrPage, "jpage227", 3, "Rolling Stock 3")}
//----
                          LinksBar0001(istrPage, "jpage300", 1, "Operate");
    if (strL1 == "3")    {LinksBar0001(istrPage, "jpage310", 2, "Instructions")}
    if (strL1 == "3")    {LinksBar0001(istrPage, "jpage320", 2, "S&ARR")}
    if (strL1 == "3")    {LinksBar0001(istrPage, "jpage330", 2, "Riverside Yard")}
//----
                          LinksBar0001(istrPage, "jpage400", 1, "Hints & Tips");
    if (strL1 == "4")    {LinksBar0001(istrPage, "jpage410", 2, "N Scale Couplers")}
    if (strL1 == "4")    {LinksBar0001(istrPage, "jpage420", 2, "Rust")}
    if (strL1 == "4")    {LinksBar0001(istrPage, "jpage430", 2, "Boxcar Interior")}
//----
                          LinksBar0001(istrPage, "jpage500", 1, "Links");
//----
                          LinksBar0001(istrPage, "jpage600", 1, "Updates");
//----
                          LinksBar0001(istrPage, "jpage700", 1, "Site Map");
//----
//                          LinksBar0001(istrPage, "jpageA00", 1, "Narrow Gauge");
//----
                          LinksBar0001(istrPage, "jpageB00", 1, "Rolling Stock");
    if (strL1 == "B")    {LinksBar0001(istrPage, "jpageB10", 2, "009")}
//    if (strL2 == "B1")   {LinksBar0001(istrPage, "jpageB11", 3, "Locomotives")}
//    if (strL2 == "B1")   {LinksBar0001(istrPage, "jpageB12", 3, "Railcars")}
//    if (strL2 == "B1")   {LinksBar0001(istrPage, "jpageB13", 3, "Goods")}
    if (strL2 == "B1")   {LinksBar0001(istrPage, "jpageB14", 3, "Passenger")}
    if (strL4 == "B14x") {LinksBar0001(istrPage, "jpageB14x", 4, "Image Viewer")}
//    if (strL1 == "B")    {LinksBar0001(istrPage, "jpageB20", 2, "HOn30")}
//    if (strL2 == "B2")   {LinksBar0001(istrPage, "jpageB21", 3, "Locomotives")}

    //  NAV BAR TABLE END
    document.write("<BR><BR></TABLE></TR></TD></TABLE>");
   }



function TSFooter() {
//
//	TSFooter()                          Version 00.00
//
//	Input: none
//
//	Output: Footer graphics
//
    var strTrack    = "";
    var intWidth;
    var intImages;
    var intLoop;
    var strBrowser = navigator.appName;

    //  Screen width. Check if IE, else default
    if (strBrowser != "Microsoft Internet Explorer")
       {intImages = 12}
    else
       {intWidth = document.body.offsetWidth;
        intImages = (intWidth-40) / 56;
       }

    //  Build track graphic from short lengths
    for (intLoop=1 ; intLoop<intImages ; ++intLoop)
       {strTrack = strTrack + "<IMG SRC='aaIMGtrack.gif' BORDER=0 VSPACE=0 HSPACE=0 ALT='Footer'>"}

    //  TRACK GRAPHIC
    document.write("<BR><BR><BR><BR><CENTER>" + strTrack + "</CENTER>");

    //  BLANK LINES
    document.write("<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>");
   }




function LinksBar0001(ThisPage,ThisLink,ThisLevel,ThisLinkText)
   {var strText = "";
    var strQ = '"';
    var strNavFill;

    //
    // Build link or text only as applicable
    //
    strNavFill = "";
    if (ThisLevel == 2) {strNavFill = "&nbsp;&nbsp;&nbsp;&nbsp;"}
    if (ThisLevel == 3) {strNavFill = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}
    if (ThisLevel == 4) {strNavFill = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}

    strText = "<TR><TD BACKGROUND='jzkmenu" + ThisLevel + ".gif'><FONT SIZE='-1'>";
    if (ThisPage == ThisLink)
       {strText = strText + "<IMG SRC='aaLinkAct.gif'>" + strNavFill + "<FONT COLOR='green'><B>";}
    else
       {strText = strText + "<IMG SRC='aaLinkOth.gif'>" + strNavFill + "<B><A HREF='" + ThisLink + ".html'>";}

    strText = strText + ThisLinkText;

    if (ThisPage == ThisLink)
       {strText = strText + "</B></FONT>";}
    else
       {strText = strText + "</A></B>";}

    strText = strText + "</FONT></TD></TR>"

    document.write(strText);
   }




function DisplayLastModified() {
//
//	DisplayLastModified()     Version 00.05
//
//	Input: Mandatory string  Date in format 'DD MMMMM YYYY HH:MM:SS GMT' 
//             Optional  string  Output required
//
//	Output: string, dependant upon Param1 and the time last modified;
//        Param2 = 'DD'
//          Days since last modified, integer
//        Param2 = 'MM'
//          Minutes since last modified, integer
//	  Param2 not present
//	    < 1 day and days=	'Today'
//	    < 2 days		'Yesterday'
//	    < 15 days		days + ' days ago'
//	    >= 15 days		dd mmmmm yyyy
//
	var dtLastMod, dtCurrent;
	var intTimeDiff, intDayCurrent;
	var intDayLastMod, intMonthLastMod, intYearLastMod
	var strParam1, strParam2
	var strReturn;
	var strMonthName = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); 
	var argv = DisplayLastModified.arguments;
	var argc = DisplayLastModified.arguments.length;

	//
	// Get and process input parameter
	//
	strParam1 = (argc > 0) ? argv[0] : null;
	strParam2 = (argc > 1) ? argv[1] : null;

	//
	// Calculate age in days
	//
	dtLastMod = new Date(strParam1);
	dtCurrent = new Date();
	intTimeDiff = (dtCurrent - dtLastMod) / (1000*60*60*24);
	if (intTimeDiff > 36525) { intTimeDiff = intTimeDiff - 36525};

	//
	// Build return value
	//
	if (intTimeDiff < 1)
	   {intDayLastMod = dtLastMod.getDate();
	    intDayCurrent = dtCurrent.getDate();
	    if (intDayLastMod == intDayCurrent)
	       {strReturn = 'Today';
	       }
	    else
	       {strReturn = 'Yesterday';
	       } 
	   }
	else
	   {if (intTimeDiff < 2)
	       {strReturn = 'Yesterday';
	       }
	    else
	       {if (intTimeDiff < 15)
	           {strReturn = Math.round(intTimeDiff) + ' days ago';
	           }
	        else
	           {intDayLastMod = dtLastMod.getDate();
	            intMonthLastMod = dtLastMod.getMonth();
	            intYearLastMod = dtLastMod.getFullYear();
	            if (intYearLastMod < 1950) 
	               {intYearLastMod = intYearLastMod + 100
	               }
	            strReturn = intDayLastMod + " " + strMonthName[intMonthLastMod] + " " + intYearLastMod;
	           }  
	       }
	   }

	//
	// If Param1 passed then recalculate return value
	//
	if (strParam2=="DD")
	   {strReturn = Math.round(intTimeDiff - 0.5)
	   }
	if (strParam2=="MM")
	   {strReturn = Math.round((intTimeDiff * (24*60)) - 0.5)
	   }

	return strReturn;
}

// -->
