//
// Javascript code for the page layout
//


// Standard layout
function firstPart(thisTopic,headName,headText)
{    
	startTable();
	showHeader(headName,headText,125); //standard indent from left of page = 125
	showLeftBorder();
}

//backward compatibility
function showNavigation(thisTopic,headName,headText)
{    
	firstPart(thisTopic,headName,headText)
}

function lastPart(lastmod, author)
{    
	showFooter(lastmod, author);
	showRightBorder();
	endTable();
}

//just in case it is needed in the future to pre-load images, etc.
function init()
{}	

// Create the standard table format consistent on all pages
function startTable()
{
  document.write("  <table cellSpacing='0' cellPadding='0' width=100% border='0'>");
}

// Display the KPS logo and page header specified by headName parameter
function showHeader(headName,headText,indent)
{    
  document.write("	  <tr>" +
                 "     <td valign='top' align = 'center' colspan = '4' valign='top'>" +
                 "    	 <table width=100% border='0' cellSpacing='0' cellPadding ='0'>" +
                 "    	  <tr>" +
                 "    	    <td width='" + indent + "' valign='top'>" +
                 "		  	  <img border='0' src='../images/pixel.gif' width='" + indent + "' height='1'>" +
                 "		    </td>" +
                 "		  	<td width = '300'>" +
                 "			  <a target='_top' href='../index.htm'>" +
                 "			  <img SRC='../images/head_kps.jpg' border='0' width='250' height='55' align='center' alt='Kennington Primary School'>" +
                 "			  </a>" +
                 "			</td>" +
                 "    		<td width = 100%>" +
                 "			  <IMG SRC='../images/head_mid.jpg' border='0' width=100% height='55' align='center'>" +
                 "			</td>" +
                 "    		<td width = '200'>" +
                 "			  <IMG SRC='../images/"+headName+"' border='0' width='220' height='55' align='center' alt='"+headText+"'>" +
                 "			</td>" +
                 "		  </tr>" +
                 "		</table>" +
                 "    </td>" +
                 "	</tr>");
}

function showLeftBorder()
{    
  document.write(" <tr height='1'>" +
                 "   <td width='135' valign='top'>" +
                 "		<img border='0' src='../images/pixel.gif' width='135' height='1'>" +
                 "	  </td>" +
                 "    <td width=15%>" +
                 "		<img border='0' src='../images/pixel.gif' width='10' height='1'>" +
                 "	  </td>" +
                 "    <td width='70%'>" +
                 "		<img border='0' src='../images/pixel.gif' width='500' height='1'>");
}

function endInfo()
{    
}

function showFooter(lastmod, author)
{
  document.write("<hr><p class='authorship'>");

  // Was an author specified? - don't know how to test!!
  if(author == undefined)                // unknown date (or January 1, 1970 GMT)
  {
    document.write("");
  } else 
  {
    document.write("Author: " + author + "<br>");
  } 

  // checks that the date last modified date string is provided by the server.
  ModDate = new Date(lastmod);
  lastmoddate = Date.parse(lastmod);  // convert modified string to date

  document.write("Last update:");

  if(lastmoddate == 0)                // unknown date (or January 1, 1970 GMT)
  {
    document.write("Unknown<br>");
  } else 
  {
    document.write((ModDate.getDate()) + "/" + (ModDate.getMonth()+1) + "/" + ModDate.getFullYear()+ "<br>");
  } 
	
  document.write("Queries and Comments: <a href='mailto:kpswebmaster@yahoo.com.au'>webmaster</a>") 
  document.write(" | View the <a href='../au_privacy.htm'>Privacy Statement</a>") 
}
 
function showRightBorder()
{
  document.write("    </td>" +
                 "    <td width=15%>" +
                 "	    <img border='0' src='../images/pixel.gif' width='10' height='1'>" +
                 "    </td>" +
                 "  </tr>");
}

function endTable()
{
  document.write("</table>");
}
