// JavaScript Document
function date_ddmmmyy(date){
  var d = date.getDate();
  var m = date.getMonth() + 1;
  var y = date.getYear();
  // handle different year values returned by IE and NS in the year 2000.
  if(y >= 2000){
    y -= 2000;
  }
  if(y >= 100){
    y -= 100;
  }
  // could use splitString() here but the following method is more compatible
  var mmm = (1==m)?'Jan':(2==m)?'Feb':(3==m)?'Mar':(4==m)?'Apr':(5==m)?'May':(6==m)?'Jun':(7==m)?'Jul':(8==m)?'Aug':(9==m)?'Sep':(10==m)?'Oct':(11==m)?'Nov':'Dec';
  return "" +   (d<10?"0"+d:d) + "-" +   mmm + "-" +  (y<10?"0"+y:y);
}
// get last modified date of the current document.
//
function date_lastmodified(){
  var lmd = document.lastModified;
  var s   = "Unknown";
  var d1;
  // check if we have a valid date before proceeding
  if(0 != (d1=Date.parse(lmd)))  {
    s = "" + date_ddmmmyy(new Date(d1));
  }
  return s;
}
var hostAd = "http://webhosts.cr.usgs.gov"; 
var rootDir = hostAd + "/steward"; 
var dTime = "Test"; 
function writeMenu(){
	document.write('<li><a href="'+rootDir+'/index.html">Home</a></li>'); 
	document.write('<li><a href="'+rootDir+'/scripts/st2_software.pl">Download NHD Software</a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2queue.html">Data Load & Post Status</a></li>');
	document.write('<li><a href="'+rootDir+'/st2updates.html">Submit Updates </a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2process.html">Stewardship Process </a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2schedule.html">Training Schedule </a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2maintenance.html">Request Maintenance</a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2bugs.html">Report Bugs</a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2announcements.html">Announcements</a></li>'); 
	document.write('<li><a href="http://usgs-mrs.cr.usgs.gov/steward/st2maps.html">Maint/Revision Status</a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2glossary.html">Glossary</a></li>'); 
	document.write('<li><a href="'+rootDir+'/st2faq.html">FAQ</a></li>'); 
	document.write('<li><a href="'+rootDir+'/help_docs/NHD_Maintenance_Revision_Tracking_User_Guide.htm">User Guide</a></li>'); 
	if(dTime.length>5){
		document.write('<li><p style="color:red; font-weight:bold;">'+dTime+'</p></li>'); 
	}
}
function writeFooter(){
// BEGIN USGS Footer Template 
document.write('<div id="siteInfo"><div id="usgsfooter" style:"clear:both">');
document.write('<p id="usgsfooterbar">'); 
document.write('<a href="http://nhd.usgs.gov" title="NHD Home">NHD Home</a>'); 
document.write('<a href="http://www.usgs.gov/accessibility.html" title="Accessibility Policy (Section 508)">Accessibility</a>'); 
document.write('<a href="http://www.usgs.gov/foia/" title="Freedom of Information Act">FOIA</a>'); 
document.write('<a href="http://www.usgs.gov/privacy.html" title="Privacy policies of the U.S. Geological Survey.">Privacy</a>');
document.write('<a href="http://www.usgs.gov/policies_notices.html" title="Policies and notices that govern information posted on USGS Web sites.">Policies and Notices</a></p>'); 
document.write('<p id="usgsfootertext">'); 
document.write('<a href="http://www.takepride.gov/"><img src="http://www.usgs.gov/images/footer_graphic_takePride.jpg" alt="Take Pride in America logo" title="Take Pride in America Home Page" width="60" height="58" /></a>'); 
document.write('<a href="http://usa.gov/"><img src="http://www.usgs.gov/images/footer_graphic_usagov.jpg" alt="USA.gov logo" title="USAGov: Government Made Easy" width="90" height="26" /></a>'); 
document.write('<a href="http://www.doi.gov/">U.S. Department of the Interior</a> |'); 
document.write('<a href="http://www.usgs.gov/">U.S. Geological Survey</a><br />'); 
document.write('URL: '+location.href); 
document.write('<br />Page Contact Information: <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#102;&#97;&#108;&#101;&#120;&#64;&#117;&#115;&#103;&#115;&#46;&#103;&#111;&#118;">Florin Alexandrescu</a>'); 
document.write('<br />Page Last Modified: '+ date_lastmodified()); 
document.write('</p>'); 
document.write('</div></div>'); 
//add an iframe to the page that contains the counter.pl script. when this loads it records a hit for the page its running on. 
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPath == "/steward/"){
		//if there's no file name then record the hit for index.html
document.write('<iframe width="0px" height="0px" src="'+rootDir+'/scripts/st2_counter.pl?pn=index.html" frameborder="0"> </iframe>');
	}else if(sPath.indexOf('cpanel') == -1) {
	//don't record counters for files with the cpanel in the url 
document.write('<iframe width="0px" height="0px" src="'+rootDir+'/scripts/st2_counter.pl?pn=' + sPage + '" frameborder="0"> </iframe>') ; 
}
// END USGS Footer Template 
}

function writeHeader(){
// BEGIN USGS Header Template 
document.write('<div id="usgscolorband">'); 
document.write('<div id="usgsbanner">'); 
document.write('<div id="usgsidentifier"><a href="http://www.usgs.gov/"><img src="http://www.usgs.gov/images/header_graphic_usgsIdentifier_white.jpg" alt="USGS - science for a changing world" title="U.S. Geological Survey Home Page" width="178" height="72" /></a></div>'); 
document.write('<div id="usgsccsabox">'); 
document.write('<div id="usgsccsa">'); 
document.write('<br /><a href="http://www.usgs.gov/">USGS Home</a>'); 
document.write('<br /><a href="http://www.usgs.gov/ask/">Contact USGS</a>'); 
document.write('<br /><a href="http://www.usgs.gov/search/">Search USGS</a>'); 
document.write('</div></div></div></div>'); 
document.write('<div id="usgstitle">'); 
document.write('<p>NHD Stewardship</p></div>'); 
// END USGS Header Template 
}