var linkbase = "http://sww1.pdo.shell.om/dept/cd/csm/";
var url = document.URL;
var slen = url.length;
var s1 = url.lastIndexOf("/");
var strPage = url.substr(s1+1,slen-s1);
var strDef = "Default.htm"

// menu items...
var menui = new Array();

// menu links...
var menul = new Array();

// menu items which are new
var menun = new Array();

menui[0] = "Looking for"
menui[1] = "Safety Statistics"
menui[2] = "Drive to Survive"
menui[3] = "Hearts & Minds"
menui[4] = "Tripod-BETA"
menui[5] = "Scaffolding"
menui[6] = "Procedures & Guidelines"
menui[7] = "Safety Alerts"
menui[8] = "How it happened?"
menui[9] = "Pharos WHIMS"
//menui[10] = "HSE Cases"
menui[10] = "Permit to Work System"

menul[0] = "0";
menul[1] = "../blocks/statistics/docs/safety_perf_graph.ppt";
menul[2] = "../dts/";
menul[3] = "../hearts_minds/";
menul[4] = "tripod.html";
menul[5] = "scaf.html";
menul[6] = "../blocks/documentation/hsedocs.htm";
menul[7] = "../online_library/safetyalertindex.asp";
menul[8] = "swhome.html";
menul[9] = "whims.html";
menul[10] = "hsecase/main.htm";
menul[11] = "ptw.html";

//New or update button depending on dates (Format: yyyy-mm-dd-n(for new) or u(for update)
menun[0] = "2005-01-01-n";
menun[1] = "2005-01-01-n";
menun[2] = "2005-01-01-u";
menun[3] = "2005-01-01-n";
menun[4] = "2005-01-01-n";
menun[5] = "2005-01-01-n";
menun[6] = "2005-01-01-n";
menun[7] = "2005-01-01-n";
menun[8] = "2005-01-01-n";
menun[9] = "2005-01-01-n";
menun[10] = "2005-01-01-n";
menun[11] = "2005-01-01-n";

strPage = strPage.toUpperCase();
strDef = strDef.toUpperCase();

document.write('<table width="200" border="0" cellpadding="0" cellspacing="0" align="center" cols="2">');
if (strPage != strDef && strPage!="")
{
	document.write('<tr>');
	document.write('<td valign="center" colspan="2" bgcolor="#B4B0A4" height="20"><a href="./" style="text-decoration:none"><h5>');
	document.write('<img border="0" src="../images/home.gif" align="center" width="14" height="14">&nbsp;Safety Home</h5></a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td colspan="2" valign="top"><img border="0" src="../images/line2.gif" width="100%" height="3"></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td colspan="2" valign="top"><img border="0" src="../images/bluedot.gif" height="2"></td>');
	document.write('</tr>');
}

for (i=0;i<=menui.length-1;i++)
{
	if (menul[i]=="0")
	{
		document.write('<tr>');
		document.write('<td align="left" colspan="2" bgcolor="#B4B0A4" height="20"><h5>' + menui[i] + '</h5></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td colspan="2" valign="top"><img border="0" src="../images/line2.gif" width="100%" height="3"></td>');
		document.write('</tr>');
	}
	else
	{
		document.write('<tr>');
		document.write('<td width="12" valign="middle"  align="center"><p><img border="0" align="absmiddle" src="../images/bullet.gif" height="7" width="7"></td>');
		document.write('<td width="188" valign="middle" height="21"><p><a style="text-decoration: none" href=' + menul[i] + '>' + menui[i] + '</a>');
		if(checkstatus(menun[i])=="n")
			document.write('<img border="0" src="../images/newtxt.gif" align="absmiddle"');
		else if(checkstatus(menun[i])=="u")
			document.write('<img border="0" src="../images/updatedtxt.gif" align="absmiddle"');
		document.write('</td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td colspan="2" valign="top"><img border="0" src="../images/line2.gif" width="100%" height="3"></td>');
		document.write('</tr>');
	}
}
document.write('</table>');

function checkstatus(s)
{
   var dt = s.split("-");
   var today = new Date();
   var one_day = 1000*60*60*24;

   var passeddate = new Date(dt[0],dt[1],dt[2]);
   if((Math.ceil((today.getTime()-passeddate.getTime())/(one_day)))<=5)
     return(dt[3]);
   else
     return("o");
}

