
// Version 1 [ 17 Feb 2004 - 21:50 ]

var imageDir="images/";			// path to background image'
var myName="bt.js";			// name of this file for nesting purposes

var sPost="in" + "fo@bettert" + "ransit.ab.ca";

var sbNarrative="Better Transit";             // default status bar narrative for IE XP SP2
function sbYear() { sbDate = new Date(); return (sbDate.getYear()<1900) ? 1900+sbDate.getYear() : sbDate.getYear()} 
sbNarrative="(C) " + sbYear() + " Better Transit.  Image not to be published elsewhere without authority";

var altTitle="";                                                 // default 'alt' narrative
var altClose=" Click to close window ";
var altBig=" Click on Image to close window&#13; Click red square to view image at maximum resolution ";

// -------------------------------

// Remember to addd mouse click

var message="WEB Site © Copyright 2004\nBetter Transit for Edmonton\n----------------------------------\n\nSite owner may be contacted at:\n       \nSociety of Citizens for Better Transit       \nBox 47163       \n62 Edmonton Centre RPO       \nEdmonton, AB, Canada       \nT5J 4N1";

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

// -------------------------------

function gifLink(subject) {
   nn="";
   nn+='<center><a href="mailto:' + sPost;
   if (subject!="" && subject!=null) { nn+='?Subject=' + subject }
   nn+='"><img src="images/mail.gif" width="32" height="32" border="0" vspace="0"></a><span class="normwhite"> Site visitors input is always appreciated</span>';
   return nn;
}

function datebox() {
	var Today=new Date();
	var ThisDay=Today.getDay();
	var ThisDate=Today.getDate();
	var ThisMonth=Today.getMonth()+1;
	var ThisYear=Today.getFullYear();  //included if you wish to insert the year
	function DayTxt (DayNumber) {
	var Day=new Array();
	Day[0]="Sunday";
	Day[1]="Monday";
	Day[2]="Tuesday";
	Day[3]="Wednesday";
	Day[4]="Thursday";
	Day[5]="Friday";
	Day[6]="Saturday";
	return Day[DayNumber];
	}
	var DayName=DayTxt(ThisDay);
	function MonthTxt (MonthNumber) {
	var Month=new Array();
	Month[1]="January";
	Month[2]="February";
	Month[3]="March";
	Month[4]="April";
	Month[5]="May";
	Month[6]="June";
	Month[7]="July";
	Month[8]="August";
	Month[9]="September";
	Month[10]="October";
	Month[11]="November";
	Month[12]="December";
	return Month[MonthNumber];
	}
	var MonthName=MonthTxt(ThisMonth);
	var d = new Date();
	var h = d.getHours();
	document.write("<table align='left' border='1' bgcolor='#F8F8F8' width='75' height='85'>"+"<td align='center'>"+"<font size='-2' >"+DayName+"<br>"+"<font color='red' size='+3' >"+ThisDate+"</font>"+"<br>"+MonthName+"<br>"+"</b>"+"</font>"+"</td>"+"</tr>"+"</table>");
}

function lastMod() {
  var x = new Date (document.lastModified);
  Modif = new Date(x.toGMTString());
  Year = takeYear(Modif);
  Month = Modif.getMonth();
  Day = Modif.getDate();
  Mod = (Date.UTC(Year,Month,Day,0,0,0))/86400000;
  x = new Date();
  today = new Date(x.toGMTString());
  Year2 = takeYear(today);
  Month2 = today.getMonth();
  Day2 = today.getDate();
  now = (Date.UTC(Year2,Month2,Day2,0,0,0))/86400000;
  daysago = now - Mod;
  if (daysago < 0) return '';
  unit = 'days';
  if (daysago > 730)
  {
  daysago = Math.round(daysago/365);
  unit = 'years';
  }
  else if (daysago > 60)
  {
  daysago = Math.round(daysago/30);
  unit = 'months';
  }
  else if (daysago > 14)
  {
  daysago = Math.round(daysago/7);
  unit = 'weeks'
  }
  towrite = '<br> Last updated ';
  if (daysago == 0) towrite += 'today';
  else if (daysago == 1) towrite += 'yesterday';
  else towrite += daysago + ' ' + unit + ' ago';
  towrite += '. &nbsp; &copy; ' + Year + '&nbsp;  Better Transit';
  return towrite;
}

function takeYear(theDate) {
  x = theDate.getYear();
  var y = x % 100;
  y += (y < 38) ? 2000 : 1900;
  return y;
}

function pagebase() {
   nn=""
   nn+=' URL: ' + location.toString();
   nn+=lastMod();
   return nn;
}

function emailPage(){
zxcv = document.title .substring (29 ,99)
document.location = 'mailto:?subject=[BTS] ' + zxcv + '&bcc=xmas@cyberpictures.net&body=On the Better Transit web site, I found this page and thought it would be of interest to you: ' + document.location;
   }

function neww3c() {
   nn="";
   nn+='<p class="menu">';
   nn+='<a href="http://validator.w3.org/check/referer" target="_w3c" onmouseover="self.status=\'This WEB page has been designed to work under all operating sytems and with all WEB Browsers\'; return true" onmouseout="self.status=\'\'; return true"><img src="' + imageDir + 'w3c-401.gif" alt=" An interoperable WEB page with valid HTML 4.01 " border="0" height="31" width="93" hspace="8"></a>';
   nn+='<a href="http://jigsaw.w3.org/css-validator/check/referer" target="_w3c" onmouseover="self.status=\'Valid CSS\'; return true" onmouseout="self.status=\'\'; return true"><img src="' + imageDir + 'w3c-css.gif" alt=" Valid CSS " border="0" height="31" width="93" hspace="8"></a>';
   nn+='<a href="http://www.anybrowser.org/campaign/index.html" target="_new" onmouseover="self.status=\'Viewable With Any Browser\'; return true" onmouseout="self.status=\'\'; return true"><img src="images/anybrowser.jpg" alt=" Viewable With Any Browser " border="0" height="32" width="96" hspace="10"></a>';
   nn+='<a href="javascript:emailPage()" onmouseover="self.status=\'Have a nice day\'; return true" onmouseout="self.status=\'\'; return true"><img src="images/tell-a-friend.gif" alt=" Feature sends an email to your friend " border="0" height="32" width="130" vspace="0" hspace="8"></a>';
   nn+='<br>Page URL: &nbsp; ' + location.toString();
   nn+=lastMod();
   nn+='</p>';
   return nn;
}

function popUp(filename, winname, description, imageW, imageH) {
   bigURL="popBig('" + filename + "', '" + winname + "', '" + description + "', " + imageW + ", " + imageH + ", ";
   if (description.indexOf("|")>0) { var describe = description.split("|"); description=describe[0] }
   if (navigator.appName=="Opera" || document.layers) { eval(bigURL+"false)"); return } else { bigURL+= "true)" }
   winH=screen.availHeight-28;			// set popup window height to max available
   winW=screen.availWidth-9;			// set popup window width to max available
   imgH=winH-52;					// calculate maximum image height
   imgH=winH-56;					// calculate maximum image height
   if(window.navigator.userAgent.indexOf("SV1") != -1) {imgH-=25}		// allow for mandatory status bar in IE on XP with SP2
   if(navigator.userAgent.toLowerCase().indexOf('firefox')!=-1) {imgH-=25} 	// depth allowance for Firefox status bar
   imgW=parseInt(imageW*(imgH/imageH));		// calculate proportional image width
   if (imgW>(winW-8)) {				// if resulting image is too wide
      imgW=winW-8;				// reduce image width
      imgH=parseInt(imageH*(imgW/imageW));		// calculate proportional image height
   }
   if (imgW>imageW || imgH>imageH) { imgW=imageW; imgH=imageH }
   if (imageW>imgW || imageH>imgH) { altTitle=altBig } else { altTitle=altClose }
   nn="";
   nn+='<html><head><title>Beter Transit Image Library - Image ' + winname + '</title>';
   nn+='<meta http-equiv="imagetoolbar" content="no">';
   nn+='<meta name="MSSmartTagsPreventParsing" content="TRUE">';
   nn+='<style type="text/css">';
   nn+=' body { background: #000000; font-family: Verdana, sans-serif; margin: 10px 0 10px; }';
   nn+=' .descriptive { font-family: Verdana, sans-serif; font-size: 24px; font-weight: bold; text-align: center; color: red; }';
   nn+=' .click { font-family: Arial, sans-serif; font-size: 11px; font-weight: normal; text-align: left; color: silver; }';
   nn+='</style></head><body><center>';
   nn+='<script language="JavaScript" type="text/javascript" src="' + myName + '"></script>';
   nn+='<script language="JavaScript" type="text/javascript">window.defaultStatus="' + sbNarrative + '"</script>'
   nn+='<table border="0" cellpadding=0 cellspacing=0 align="center" width=' + (winW-14) + '>';
   nn+=' <tr>';
   nn+='  <td height=' + imgH + ' colspan=2 align="center"><a href="javascript:window.close()" onMouseOver="self.status=\'' + sbNarrative + '\'; return true" onMouseOut="self.status=\'\'; return true"><img src="' + filename + '" width=' + imgW + ' height=' + imgH + ' border=0 alt="" title=" Image ' + winname + ' &#13;' + altTitle + '"></a></td>';
   nn+=' </tr>';
   nn+=' <tr valign="bottom">';
   nn+='  <td width=' + (winW-214) + ' height=40 class="descriptive">' + description + '</td>';
   nn+='  <td width=200 class="click">Click on the image to close this window';
   if (imageW>imgW || imageH>imgH) { nn+='<br><a href="javascript:' + bigURL + '"  onMouseOver="self.status=\'' + sbNarrative + '\'; return true" onMouseOut="self.status=\'\'; return true"><img src="' + imageDir + 'redsq.gif" width=9 height=9 border=0 alt=""></a> &nbsp; See image at maximum resolution' }
   nn+='</td>';
   nn+=' </tr>';
   nn+='</table></center></body></html>';
   window1=window.open('', '', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=0,top=0,width=" + winW + ",height=" + winH);
   window1.document.open();
   window1.document.write(nn);
   window1.document.close();
   window1.focus()
}

function popBig(filename, winname, description, imageW, imageH, closeParent) {
   if (description.indexOf("|")>0) { var describe = description.split("|"); description=describe[1] }
   description=captionStyle(description);
   nn="";
   nn+='<html><head><title>Beter Transit Image Library - Image ' + winname + '</title>';
   nn+='<meta http-equiv="imagetoolbar" content="no">';
   nn+='<meta name="MSSmartTagsPreventParsing" content="TRUE">';
   nn+='<style type="text/css">';
   nn+=' body { background: #72BC5C; font-family: Verdana, sans-serif; margin: 10px 0 10px; }';
   nn+=' .descriptive { font-family: Verdana, sans-serif; font-size: 24px; font-weight: bold; text-align: center; color: #0000C0; }';
   if (description.indexOf('<h6>')>0) { nn+=' h6 { font-family: Verdana, Arial, sans-serif; font-size: 12pt; font-weight: bold; text-align: justify; color: #804000; margin: 4px 30px 0; }'; }
   if (description.indexOf('class="CFj"')>0) { nn+=' .CFj { font-family: Verdana, Arial, sans-serif; font-size: 12pt; font-weight: bold; text-align: justify; color: #804000; margin: 4px 30px 0; }'; }
   if (description.indexOf('class="CFc"')>0) { nn+=' .CFc { font-family: Verdana, Arial, sans-serif; font-size: 12pt; font-weight: bold; text-align: center; color: #804000; margin: 0 0 0; }'; }
   nn+='</style></head><body>';
   nn+='<script language="JavaScript" type="text/javascript">window.defaultStatus="' + sbNarrative + '"</script>'
   nn+='<center><table border="0" cellpadding=0 cellspacing=0 align="center" width="100%">';
   nn+=' <tr>';
   nn+='  <td align="center"><a href="javascript:window.close()" onMouseOver="self.status=\'' + sbNarrative + '\'; return true" onMouseOut="self.status=\'\'; return true"><img src="' + filename + '" width=' + imageW + ' height=' + imageH + ' border=0 alt="" title=" Image ' + winname + '&#13; Click to close window "></a></td>';
   nn+=' </tr>';
   nn+=' <tr valign="middle">';
   nn+='  <td height="50" class="descriptive">' + description + '</td>';
   nn+=' </tr>';
   nn+='</table></center></body></html>';
   window2=window.open("", "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,left=0,top=0,width=" + (screen.availWidth-10) + ",height=" + (screen.availHeight-30));
   window2.document.open();
   window2.document.write(nn);
   window2.document.close();
   if (closeParent) { parent.window.close() };
   window2.focus()
}