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] = "Environment Quiz";
menui[2] = "Global Env. Standards";
menui[3] = "Environmental Compliance";
menui[4] = "Environmental Performance";
menui[5] = "Greening the Desert";
menui[6] = "Environmental Permits";
menui[7] = "Environment Regulations";
menui[8] = "NORM";
menui[9] = "Biodiversity";
menui[10] = "ISO 14001";
menui[11] = "Environmental Specifications";
menui[12] = "Posters and Stickers";
menui[13] = "EIA Reports";
menui[14] = "P W M P";
menui[15] = "Environmental Links";
menui[16] = "Archieves";
menui[17] = "Forms and Checklists";
menui[18] = "Permits Application Forms";
menui[19] = "Non Compliance Form";
menui[20] = "Step Out Request";
menui[21] = "Inspection Checklists";

menul[0] = "0";
menul[1] = "envquiz.htm";
menul[2] = "envstandards.htm";
menul[3] = "docs/legal_env_compliance.ppt";
menul[4] = "../blocks/statistics/docs/envr_perf_graph.ppt";
menul[5] = "greeningthedesert.htm";
menul[6] = "envpermits.htm";
menul[7] = "../blocks/documentation/HSEDOCS.htm#omanlaw";
menul[8] = "norm.htm";
menul[9] = "iso14001/biodiversity.htm";
menul[10] = "iso14001/Default.htm";
menul[11] = "../blocks/documentation/HSEDOCS.htm#EnvironmentSpec";
menul[12] = "../online_library/itemindex.asp?c=8&cat=4&t=0";
menul[13] = "eiareports.htm";
menul[14] = "pwmp.htm";
menul[15] = "links.htm";
menul[16] = "archieves.htm";
menul[17] = "0";
menul[18] = "envapplications.htm";
menul[19] = "../blocks/documentation/docs/forms/NONCOMP.doc";
menul[20] = "../blocks/documentation/docs/forms/STEPOUT1.DOT";
menul[21] = "docs/checklist.doc";

//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";
menun[12] = "2005-01-01-n";
menun[13] = "2005-01-01-n";
menun[14] = "2005-01-01-n";
menun[15] = "2005-01-01-n";
menun[16] = "2005-01-01-n";
menun[17] = "2005-01-01-n";
menun[18] = "2005-01-01-n";
menun[19] = "2005-01-01-n";
menun[20] = "2005-01-01-n";
menun[21] = "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;Environmental 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");
}

