/* Wellington Caving Group Copyright 2004 */
/* Last Updated */
// 2004 Sep 12 display improvements
// 2003 Apr 08 date, time, links
// 2002 Aug 16 Initial version
function writeDate (outDate)
{
var daylit = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
// can't make correct day display for IE4!
var mnlit = new Array("Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec");
//document.writeln ('writeDate ',outDate);
if (outDate>0) {
  var yr=outDate.getYear();
  var mn=outDate.getMonth();
  var dy=outDate.getDate();
  var day=outDate.getDay();
// cater for variations in the way browsers handle dates!
    if (yr>=100 && yr<=999) yr-=100;
    if (yr<1000) yr+=2000;
// partially tested for Netscape and Explorer
  document.write (' ', yr,' ',mnlit[mn],' ',dy);
  }
}
//
function writeTime (outTime)
{
if (outTime>0) {
  var hr=outTime.getHours();
  var minute=outTime.getMinutes();
  document.write (' ', hr,':',minute);
  }
}
//
function nextMeeting ()
{
var meetday = new Date("february 12, 2003");
// writeDate (meetday);
var thisday = new Date();
// writeDate (thisday);
var milsec = 14*24*60*60*1000; // 14 days, 24 hours, 60 minutes, 60 seconds, 1000 milliseconds 
var diff = thisday.getTime()-meetday.getTime();
diff = Math.floor(diff/milsec);
// document.writeln (' diff ', diff);
var next = ((diff+1)*milsec) + meetday.getTime() + (60*60*1000); // additional period plus day
if (meetday > next) { next=meetday };
var temp = new Date();
    temp.setTime(next);
writeDate (temp);
}
//
function lastUpdated ()
{
var lm=Date.parse(document.lastModified);
var dlm=new Date (lm);
document.writeln('<div class="modified" align="right">Updated ');
writeDate (dlm);
writeTime (dlm);
document.writeln('</div>');
}
//
function mailToAddress (emailAddress,emailName,subJect,linkName)
{
document.write ('<a href="mailto:', emailName, '&#64;', emailAddress);
if (subJect != '') {
  document.write ('?subject=', subJect);
  }
document.writeln ('">', linkName, '</a>');
}
//
function mailToWCG (emailName,subJect,linkToName)
{
  var linkName = '';
switch (arguments.length) {
  case 1 : subJect = '';
  case 2 : linkName = emailName;
           break;
  default: linkName = linkToName;
  }
mailToAddress ('caving&#46;wellington&#46;net&#46;nz',emailName,subJect,linkName);
}
//
function mailToYHG (emailName,subJect,linkToName)
{
  var linkName = '';
switch (arguments.length) {
  case 1 : subJect = '';
  case 2 : linkName = emailName;
           break;
  default: linkName = linkToName;
  }
mailToAddress ('yahoogroups&#46;com',emailName,subJect,linkName);
}
//
function linkLine (topBot)
// provide header and footing for page
// set content style
{
if ((topBot == 'bot') || (topBot == 'fbot')) { // close off content style
  document.writeln ('</div>') 
  }
if (topBot == 'bot') {
  document.writeln ('<hr class="show">')
  document.writeln ('<div align="center" class="xmas"><img src="/img/xmasline1.gif" border=0 align="center" alt="Merry Christmas" width=600 height=36></div>')
  }
if (topBot == 'fbot') {
  document.writeln ('<hr class="noprint">')
  }
if ((topBot == 'ftop') || (topBot == 'fbot')) { // set class for menu line
    document.writeln ('<div class="flinkLineCentre">');
  }
if ((topBot == 'top') || (topBot == 'bot')) { // set class for menu line
    document.writeln ('<div class="linkLineCentre">');
  }
if (topBot == 'top') { // display WCN attribution at top only
  document.writeln ('<a href="http://wcn.net.nz" target="notwcg"><img src="/img/wcnhorizstatic.gif" width=238 height=20 border=0 align="center" alt="Wellington Community Net Link" vspace=4></a>');
  document.writeln ('<br />')
  }
// always index back to home page
document.writeln ('<a href="/index.html" target="_parent"><img src="/img/home.gif" ALT="Home" border=0 width=40 height=40 valign=middle>Home</a> |') 
// note all links need target
if (topBot == 'bot') {
  document.writeln ('<div align=center class=xmas><img src="/img/xmasline2.gif" border=0 alt="Merry Christmas" align=center width=600 height=36></div>')
  }
if ((topBot != 'ftop') && (topBot != 'fbot')) {
  document.writeln ('<b><a href="/calendar/eventlist.html" target="_parent">Events</a></b> |')
  document.writeln ('<a href="/sumpthink.html" target="_parent">SumpThink</a> |')
  document.writeln ('<a href="/join.html" target="_parent">Membership</a> |')
  document.writeln ('<a href="/docs.html" target="_parent">Information</a> |')
  document.writeln ('<a href="/photos.html" target="_parent">Photos</a> |')
  document.writeln ('<a href="/nzcaving.html" target="_parent">NZ&nbsp;Caving</a> |')
  document.writeln ('<a href="/wcglinks.html" target="_parent">Links</a> |')
//  document.writeln ('<a href="/wcglinks+.html" target="_parent">More&nbsp;Links</a> |')
//  document.writeln ('<a href="/previous.html" target="_parent">Recent&nbsp;Events</a> |')
  }
document.writeln ('<span style="white-space: nowrap;">&lt;&nbsp;<a href="/contribution.html" target="_parent">Contact&nbsp;WCG</a>&nbsp;&gt;</span>') 
if (topBot == 'bot') {
  document.writeln ('<span style="white-space: nowrap;">{&nbsp;<a href="/about.html" target="_parent">About</a>&nbsp;}</span> |')
  document.writeln ('<a href="/constitution.html" target="_parent">Constitution</a> |')
  document.write ('<span class="webmaster">')
  mailToWCG('Webmaster', 'WCG pages')
  document.writeln ('</span>')
  lastUpdated()
  }
if (topBot == 'top') {
    document.writeln ('<hr class="show">')
    document.writeln ('<div align="center" class="xmas"><img src="/img/xmasline1.gif" border=0 alt="Merry Christmas" width=600 height=36></div>')
  }
document.writeln ('</div>') // close off header or footer
if (topBot == 'top') {
  document.writeln ('<div class="content">')
  }
if (topBot == 'ftop') {
  document.writeln ('<hr class="noprint"><div class="fcontent">')
  }
}