
// Version 1 [ 13 June 2003 - 14:54]


var imageDir="images/";			// path to background image and 'red-square'
var myName="online.js";			// name of this file for nesting purposes
var good;

var ePost="auth" + "or@cyber" + "pictures.net";

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

// Remember to addd mouse click

var message="WEB Site © Copyright 2005\nDavid Bradley Online\n----------------------------------\n\nWebmaster may be contacted on       \n01252 706933";

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 meLink( text, subject) {
   nn="";
   nn+='<a href="mailto:' + ePost;
   if (subject!="" && subject!=null) { nn+='?Subject=' + subject }
   nn+='">' + text + '</a>';
   return nn;
}

function vLink(subject) {
   nn="";
   nn+='<a href="mailto:' + ePost;
   if (subject!="" && subject!=null) { nn+='?Subject=' + subject }
   nn+='"><img src="images/mail.gif" width=32 height=32 border=0 vspace=0></a>';
   return nn;
}

function captionStyle(txt) {
   while (txt.indexOf("{#")>0) {		// replace custom format commands {#?} with <p class="CF?>
      txtP=txt.indexOf("{#");
      txtL=txt.substring(0, txtP);
      txtS=txt.charAt(txtP+2);
      txtR=txt.substring(txtP+4);
      txt=txtL + '<p class="CF' + txtS + '">' + txtR;
   }
   while (txt.indexOf("{/#}")>0) {		// replace custom format end commands {/#} with </p>
      txtP=txt.indexOf("{/#}");
      txtL=txt.substring(0, txtP);
      txtR=txt.substring(txtP+4);
      txt=txtL + '</p>' + txtR;
   }
   return txt;
}

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>Blackpool Tramways Image Library - Picture ' + winname + '</title>';
   nn+='<meta http-equiv="imagetoolbar" content="no">';
   nn+='<meta name="MSSmartTagsPreventParsing" content="TRUE">';
   nn+='<style type="text/css">';
   nn+=' BODY { background-image: url(' + imageDir + '75.gif); margin: 5px; }';
   nn+=' .descriptive { font-family: "Trebuchet MS", sans-serif; font-size: 24px; font-weight: bold; text-align: center; color: #804000; }';
   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 LINK="#000000" ALINK="#000000" VLINK="#000000"><center>';
   nn+='<table border=0 cellpadding=0 cellspacing=0 align="center" width="100%">';
   nn+=' <tr>';
   nn+='  <td align="center"><a href="javascript:window.close()"><img src="' + filename + '" width=' + imageW + ' height=' + imageH + ' border=1 alt=" 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()
}

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 || (screen.availWidth>=imageW && screen.availHeight>=imageH)) { 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
   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
   }
   nn="";
   nn+='<html><head><title>Blackpool Tramways Image Library - Picture ' + winname + '</title>';
   nn+='<meta http-equiv="imagetoolbar" content="no">';
   nn+='<meta name="MSSmartTagsPreventParsing" content="TRUE">';
   nn+='<style type="text/css">';
   nn+=' BODY { background-image: url(' + imageDir + '75.gif); margin: 5px; }';
   nn+=' .descriptive { font-family: "Trebuchet MS", sans-serif; font-size: 24px; font-weight: bold; text-align: center; color: #804000; }';
   nn+=' .click { font-family: Arial, sans-serif; font-size: 11px; font-weight: normal; text-align: left; color: #000000; }';
   nn+='</style></head><body><center>';
   nn+='<script language="JavaScript" type="text/javascript" src="' + myName + '"></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()"><img src="' + filename + '" width=' + imgW + ' height=' + imgH + ' border=0 alt=" Picture ' + winname + ' "></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<br><a href="javascript:' + bigURL + '"><img src="' + imageDir + 'redsq.gif" width=9 height=9 border=0 alt=""></a> &nbsp; See image at maximum resolution</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 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 +  ' David Bradley';
  return towrite;
}

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

function popUpold(filename, winname, description, width) {
   nn="";
   nn+='<html><head><title>Blackpool Tramways Image Library - Picture '+ winname + '</title>';
   nn+='<meta http-equiv="imagetoolbar" content="no">';
   nn+='<meta name="MSSmartTagsPreventParsing" content="TRUE">';
   nn+='</head>';
   nn+='<body background="' + imageDir + '75.gif" topmargin=5 leftmargin=2 rightmargin=2 marginheight=5 marginwidth=2>';
   nn+='<a href="javascript:window.close()"><img src="' + filename + '" border=0 alt=" Click to close window "></a>';
   nn+='<center><font color="#804000" size=5 face="Trebuchet MS">';
   nn+='<p><b>' + description + '</b></p><p>&nbsp;</p></font></center>';
   nn+='</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="+ width);
   window2.document.open();
   window2.document.write(nn);
   window2.document.close();
   window2.focus()
}

function pagebase() {
   nn="";
   nn+='<center>';
   nn+='<p class="mailme">';
   nn+=document.title;
   nn+='<br>If you wish to provide further background information please <a href="mailto:' + ePost + '?Subject=' + document.title + '">email me</a>';
   nn+='<br>Site visitors input is always appreciated<br>';
   nn+='<br>URL: ' + location.toString();
   nn+=lastMod();
   nn+='</center><br>';
   nn+='</p>';
   return nn;
}

function emailPage(){
zxcv = document.title .substring (25 ,99)
document.location = 'mailto:?subject=' + zxcv + '&bcc=xmas&#064;cyberpictures.net&body=Hello, %0D%0DOn the Blackpool Trams [1962] web site, I found the ' + zxcv + ' page and thought it would be of interest to you: ' + document.location+ ' %0D%0DThe Blackpool Picture Gallery is a collection of historical colour slides of trams operating in Blackpool in 1962. The home page can be found at http://www.cyberpictures.net/blackpool/ %0D%0DBye for now.';
   }

function foot() {
asdf = document.title .substring (25 ,99)
   nn="";
   nn+='<p class="mailme" style="margin: 10px 0 10px">';
   nn+='<br>If you wish to provide further background information please <a href="mailto:' + ePost + '?Subject=' + document.title + '">email me</a>';
   nn+='<br>Site visitors input is always appreciated<br><br>';
   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><br>Title: &nbsp; ' + asdf;
   nn+='<br>URL: &nbsp; ' + location.toString();
   nn+=lastMod();
   nn+='</p><p>&nbsp;</p>';
   return nn;
}
