// photos.js
// This file contains the common JavaScript functons used on the home sites of
// RAZ.CO.UK and RAZZIE.PLUS.COM
// This file is stored on RAZ.CO.UK for convienience
// Written by Darrell Edgley, 21st May 1999
// Copyright (C) 1999-2007, Raz Associates Limited, http://www.raz.co.uk
// This file may be used as long as the above copyright notice appears in the file.

var i         = 0 ;
var totalPics = 0 ;
var title     = ' ' ;
var footnote  = ' ' ;
var pictures  = ' ' ;
images = new Array

function makeArray(n) {
  this.length = n ;
  return this ;
}

var dayNames   = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var dayNumber  = new Array("1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");

function lastChange() {
  update = new Date(document.lastModified) ;

  var theDay   = dayNames[update.getDay()] ;
  var theMonth = monthNames[update.getMonth()] ;
  var theDayNo = dayNumber[update.getDate() -1] ;
  var theYear  = update.getYear() ;

  if (theYear <= 900) {
    // Handle 20th century years if there are any .... ;
    // This is for browsers that have a year of 99, 100, 101 etc
    theYear = theYear + 1900 ;
  }
  
  if (theYear <= 1980) {
    // Handle 20th century years if there are any .... ;
    // This is for browsers that have a year of 99, 00, 01 etc
    theYear = theYear + 100 ;
  }

  document.writeln(theDay + ' ' + theMonth + ' ' + theDayNo + ' ' + theYear) ;
}

function pageFoot(lm,author,url) {
  // Format the month number ....
//  var month = lm.substring(0,2) ;
           
  if (Date.parse(lm) != 0) {
    document.write('<br>This page was last updated on ') ;
    lastChange(lm) ;
    
    if (author == null || author == "") {
  //  author = "Darrell Edgley" ;
    }
    else {  
      document.write(' by ') ;
      
      if (url == null || url == "") {
      }
      else {
        if (url == "default_URL") {
          url = "http://www.raz.co.uk" ;
        }

        document.write('<A HREF="' + url + '" TARGET="photolib">') ;
      }
      
      document.write(author) ;

      if (url == null || url == "" || url == undefined) {
      }
      else {
        document.write('</A>') ;
      }
    }
  }
}

function advert(country) {
  mod = new Date() ;
  var min = mod.getSeconds() ;
  
  caseVal   = min % 8 ;
   
  document.write('<TABLE WIDTH="100%"><TR><TD VALIGN="middle" ALIGN="center">') ;

  if (country == "US") {
    expatsVal = min % 2 ;
    if (expatsVal == 0) {
      document.writeln('<a href="http://www.qksrv.net/click-1164311-6947620" target="_blank" onmouseover="window.status=\'http://www.expatshopping.com\';return true;" onmouseout="window.status=\' \';return true;"><img src="http://www.qksrv.net/image-1164311-6947620" width="234" height="60" alt="www.expatshopping.com" border="0"></a>') ;
      document.writeln('</TD><TD VALIGN="middle" ALIGN="center">') ;
    }
    else {
      document.writeln('<a href="http://www.qksrv.net/click-1164311-6671019" target="_blank" onmouseover="window.status=\'http://www.expatshopping.com\';return true;" onmouseout="window.status=\' \';return true;"><img src="http://www.qksrv.net/image-1164311-6671019" width="125" height="125" alt="British Food" border="0"></a>') ;
      document.writeln('</TD><TD VALIGN="middle" ALIGN="center">') ;
    }

    document.writeln('<a href="http://www.amazon.com/exec/obidos/ASIN/0297646044/raz-20" target="_top">' +
                     'Buy the latest cricket code<BR>from Amazon.com</a>') ;
//  document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0297646044/raz-20" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/amazon-w-logo.gif" width=126 height=32 align="middle" alt="Amazon"></a>') ;
                       
    document.writeln('<BR><SPAN CLASS="small">or check out</SPAN>') ;
//  document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html">Hot DVDs</A>') ;

    if (caseVal == 0) {
      document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/dvd_80x80.gif" width=80 height=80 align="middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 1) {
      document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/dvd_shophere_120x60.gif" width=120 height=60 align="middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 2) {
      document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/dvd_80x80.gif" width=80 height=80 align="middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 3) {
      document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/dvd_shophere_120x60.gif" width=120 height=60 align="middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 4) {
      document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/dvd_80x80.gif" width=80 height=80 align="middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 5) {
      document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/dvd_shophere_120x60.gif" width=120 height=60 align="middle" alt="Amazon"></a>') ;
    }
    else {
      document.writeln('<BR><A HREF="http://www.amazon.com/exec/obidos/redirect?tag=raz-20&path=subst/video/sellers/amazon-top-100-dvd.html" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/dvused120x60.gif" width=120 height=60 align="middle" alt="Amazon"></a>') ;
    }

  }
  else if (country == "ENERGY") {
    expatsVal = min % 2 ;


    if (caseVal == 0) {
      document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_d613cfc0-8be6-4af0-b68a-14a101002970"  WIDTH="160px" HEIGHT="400px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fraz-20%2F8009%2Fd613cfc0-8be6-4af0-b68a-14a101002970&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fraz-20%2F8009%2Fd613cfc0-8be6-4af0-b68a-14a101002970&Operation=GetDisplayTemplate" id="Player_d613cfc0-8be6-4af0-b68a-14a101002970" quality="high" bgcolor="#ffffff" name="Player_d613cfc0-8be6-4af0-b68a-14a101002970" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="400px" width="160px"/> </OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fraz-20%2F8009%2Fd613cfc0-8be6-4af0-b68a-14a101002970&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>>') ;
    }
    else if (caseVal == 1) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/B000ICL3KG?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=B000ICL3KG" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/inconvenient_truth.jpg" align="middle" alt="Saving Earth"></a>') ;
    }
    else if (caseVal == 2) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/B000BTH4K4?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=B000BTH4K4" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/walmart.jpg" align="middle" alt="Saving Earth"></a>') ;
    }
    else if (caseVal == 3) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/1592576435?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=1592576435" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/solar_power.jpg" align="middle" alt="Saving Earth"></a>') ;
    }
    else if (caseVal == 4) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/0061544515?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=0061544515" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/saving_earth.jpg" align="middle" alt="Saving Earth"></a>') ;
    }
    else if (caseVal == 5) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/B000I5Y8FU?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=B000I5Y8FU" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/electric_car.jpg" align="middle" alt="Who Killed the Electric Car"></a>') ;
    }
    else if (caseVal == 6) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/0865715203?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=0865715203" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/pv.jpg" align="middle" alt="PV"></a>') ;
    }
    else if (caseVal == 7) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/0963738321?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=0963738321" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/solar_house.jpg" align="middle" alt="Solar House"></a>') ;
    }
    else if (caseVal == 8) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/0965809870?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=0965809870" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/go_solar.jpg" align="middle" alt="Go Solar"></a>') ;
    }
    else if (caseVal == 9) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/086571536X?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=086571536X" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/renew.jpg" align="middle" alt="Go Solar"></a>') ;
    }
    else if (caseVal == 10) {
      document.writeln('<BR><A HREF="http://www.amazon.com/gp/product/1931498148?ie=UTF8&tag=raz-20&linkCode=xm2&camp=1789&creativeASIN=1931498148" target="_top"><img border=0 ' + 'src="http://www.raz.co.uk/images/wind_power.jpg" align="middle" alt="Go Solar"></a>') ;
    }
    else {
      document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_d613cfc0-8be6-4af0-b68a-14a101002970"  WIDTH="160px" HEIGHT="400px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fraz-20%2F8009%2Fd613cfc0-8be6-4af0-b68a-14a101002970&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fraz-20%2F8009%2Fd613cfc0-8be6-4af0-b68a-14a101002970&Operation=GetDisplayTemplate" id="Player_d613cfc0-8be6-4af0-b68a-14a101002970" quality="high" bgcolor="#ffffff" name="Player_d613cfc0-8be6-4af0-b68a-14a101002970" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="400px" width="160px"/> </OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fraz-20%2F8009%2Fd613cfc0-8be6-4af0-b68a-14a101002970&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>') ;
    }

  }
  else {
    if (caseVal == 0) {
      document.writeln('<a href="http://www.scoot.co.uk" target="_top"><img border=0 ' +
                       'src="http://www.raz.co.uk/images/scoot9.gif" width=88 height=31 align = "middle" alt="Scoot"></a>') ;
    }
    else if (caseVal == 1) {
      document.writeln('Buy books and CDs online from <a href="http://www.amazon.co.uk/exec/obidos/redirect-home/darrelledgley" target="_top"><img border=0 ' +
                       'src="http://www.raz.co.uk/images/uk_w_blkborder_logo.gif" width=94 height=32 align = "middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 2) {
      document.writeln('<a href="http://www.amazon.co.uk/exec/obidos/redirect-home/darrelledgley" target="_top"><img border=0 ' +
                       'src="http://www.raz.co.uk/images/etcstory40.gif" width=158 height=37 align="middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 3) {
      document.writeln('<a href="http://www.amazon.co.uk/exec/obidos/redirect-home/darrelledgley" target="_top"><img border=0 ' +
                       'src="http://www.raz.co.uk/images/etfront40.gif" align = "middle" alt="Amazon"></a>') ;
    }
    else if (caseVal == 4) {
      document.writeln('<a href="http://www.scoot.co.uk" target="_top"><img border=0 ' +
                       'src="http://www.raz.co.uk/images/scoot8.gif" width=88 height=31 alt="Scoot"></a>') ;
    }
    else {
      document.writeln('<a href="http://www.amazon.co.uk/exec/obidos/redirect-home/darrelledgley" target="_top"><img border=0 ' +
                       'src="http://www.raz.co.uk/images/newshapemagenta120x30a8.gif" width=120 height=30 align = "middle" alt="Amazon"></a>') ;
    }
  }
  
  document.writeln('</TD></TR></TABLE>') ;
}

function toDay() {
  var now = new Date();
  document.write(dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate());
}

function writeHeader(d,title) {
  // Write the initial tags for the sub-pages ....

  d.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"') ;
  d.document.writeln('                      "http://www.w3.org/TR/REC-html40/loose.dtd">') ;
  d.document.writeln('<!--') ;
  d.document.writeln('This code is Copyright (c) 1999-2007 by Darrell A. Edgley.') ;
  d.document.writeln('The code contained herein is created and maintained by a series') ;
  d.document.writeln('of routines to be found at http://www.raz.co.uk/') ;
  d.document.writeln('There is no restriction on the use of these routines as long') ;
  d.document.writeln('as this notice in not deleted or modified.') ;
    
  d.document.writeln('') ;
  d.document.writeln('No warranty, expressed or implied is available for these routines.') ;
  d.document.writeln('They have all been tested in a variety of test situations under') ;
  d.document.writeln('different web browsers and should be reliable.') ;
  d.document.writeln('') ;
  d.document.writeln('HOWEVER, THE USE OF THESE ROUTINES IS ENTIRELY AT YOUR OWN RISK.') ;
  d.document.writeln('================================================================') ;
  d.document.writeln('') ;
  d.document.writeln('For further information please contact the author at darrell_edgley@iname.com') ;
  d.document.writeln('\-\->') ;
    
  d.document.writeln('<HEAD>') ;
  d.document.writeln('<LINK REL=stylesheet HREF="http://www.raz.co.uk/photo.css" TYPE="text/css">') ;
  d.document.writeln('<TITLE>' + title + '</TITLE>') ;
  d.document.writeln('<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.1">') ;
  d.document.writeln('window.focus() ;') ;
  d.document.writeln('<\/SCRIPT>') ;
  d.document.writeln('</HEAD>') ;
}

function panView (title,footnote,pictures,width,height) {
  alert('Title is :' + title + '\nFootnote is  :' + footnote + '\nPictures is :' + pictures + '\nWidth :' + width + '\nHeight :' + height) ;

  if (footnote == "" || footnote == null) {
    footnote = ' ' ;
  }

  var pv = null ;
  pv = window.open("","PanView","status=yes,toolbar=yes,scrollbars=yes,menubar=yes") ;

  writeHeader(pv,"Pan View for " + title) ;

  pv.document.writeln('<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.1">') ;

  pv.document.writeln('images = new Array ;') ;
  pv.document.writeln('var totalPics = 0 ;') ;

  pv.document.writeln('function header() {') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.open() ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<head>\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<LINK REL=stylesheet HREF=\"http:\/\/www.raz.co.uk\/photo.css\" TYPE=\"text/css\">\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<\/head>\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<body>\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<H2>Boo Click on small image to view enlargement</H2>\') ;') ;

  pv.document.writeln('  parent.frames[\'thumbnail\'].document.open() ;') ;
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<head>\') ;') ;
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<LINK REL=stylesheet HREF=\"http:\/\/www.raz.co.uk\/photo.css\" TYPE=\"text/css\">\') ;') ;
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<\/head>\') ;') ;
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<body>\') ;') ;

  pv.document.writeln('}') ;

  pv.document.writeln('function footer () {') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<BR><A HREF=".\/index.html" TARGET="rixmas">Alternate Flip View<\/A>\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<BR><STRONG>\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'Any problems please report them using my <a href=\"http:\/\/www.raz.co.uk\/feedback.htm\">Feedback<\/a> form.\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<\/STRONG>\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<\/body>\') ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.close() ;') ;

  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<\/body>\') ;') ;
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.close() ;') ;
  pv.document.writeln('}') ;

  pv.document.writeln('function startPage() {');
  pv.document.writeln('  header() ;') ;
  
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'' + pictures + '\') ;') ;
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<BR>\') ;') ;
  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'' + totalPics + '\') ;') ;

//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<SCRIPT>\') ;') ;

//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'var pvPictures=' + pictures + '***;\') ;') ;
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'images = pvPictures.split(\",\")\') ;') ;
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'var pvTotalPics = images.length - 1\') ;') ;
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'document.writeln(pvTotalPics) ; \') ;') ;
  
  
  
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<\/SCRIPT>\') ;') ;

//  pv.document.writeln('images = pictures.split(",") ;') ;
//  pv.document.writeln('totalPics = images.length -1 ;') ;
  
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<BR>\') ;') ;

//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'' + totalPics + '\') ;') ;
//  pv.document.writeln('for (var count = 0 ; count < totalPics -1 ; count++) {') ; 
//  pv.document.writeln('<BR>' + count) ;
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<IMG SRC=\"\'' + images[count] + '\'\">) ;') ;
//  pv.document.writeln('preLoadArray[i] = new Image;') ;
//  pv.document.write;n('preLoadArray[i++].src = images[count];') ;
//  pv.document.writeln('}') ;


//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<A HREF=\".\" onClick=\"changePicture(\' + img0000 + \'); return false;\"><IMG SRC=\".\/S_img0000.jpg\" WIDTH=\"64\" HEIGHT=\"48\"><\/A>\') ;') ;
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<A HREF=\".\" onClick=\"changePicture(' + img0001 + '); return false;\"><IMG SRC=\".\/S_img0001.jpg\" WIDTH=\"64\" HEIGHT=\"48\"><\/A>') ;
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<A HREF=\".\" onClick=\"changePicture(' + img0002 + '); return false;\"><IMG SRC=\".\/S_img0002.jpg\" WIDTH=\"64\" HEIGHT=\"48\"><\/A>') ;
//  pv.document.writeln('  parent.frames[\'thumbnail\'].document.writeln(\'<A HREF=\".\" onClick=\"changePicture(' + img0003 + '); return false;\"><IMG SRC=\".\/S_img0003.jpg\" WIDTH=\"64\" HEIGHT=\"48\"><\/A>') ;

  pv.document.writeln('  footer() ;') ;
  pv.document.writeln('}') ;
  
  pv.document.writeln('function changePicture(imgName) {') ;
  pv.document.writeln('  header() ;') ;
  pv.document.writeln('  parent.frames[\'pictures\'].document.writeln(\'<IMG SRC=\".\/\' + imgName + \'.jpg\">\') ;') ;
  pv.document.writeln('  footer() ;') ;
  pv.document.writeln('}') ;
  pv.document.writeln('<\/SCRIPT>') ;

  pv.document.writeln('<FRAMESET COLS="50,50" FRAMEBORDER="2" BORDER="false" FRAMESPACING="1" onLoad=startPage()>') ;
  pv.document.writeln('<FRAME NAME="thumbnail" TARGET="main" SRC="#" NORESIZE FRAMEBORDER="1">') ;
  pv.document.writeln('<FRAME NAME="pictures"  TARGET="main" SRC="../loading.html" NORESIZE FRAMEBORDER="1">') ;
  pv.document.writeln('</FRAMESET>') ;
  pv.document.writeln('</HTML>') ;
  pv.document.close() ;
}

function imageNameError(d,pictures) {
  // The imagename parameters contain unexpected values ....

  d.document.write("<H2>Invalid IMAGE parameters passes to 'showPictures' function</H2>") ;
  d.document.write("<SMALL>The <B>showPictures</B> function will accept the image file") ;
  d.document.write("names in the following forms:") ;

  d.document.write("<TABLE>") ;
  d.document.write("<TR>") ;
  d.document.write("<TD VALIGN='top'>") ;
  d.document.write("<UL>") ;
  d.document.write("<LI><B>(1)</B>&nbsp;&nbsp;image_01.jpg, image_02.jpg, ... image_nn.jpg</LI>") ;
  d.document.write("<LI><B>(2)</B>&nbsp;&nbsp;image_01.jpg--image_nn.jpg</LI>") ;
  d.document.write("</UL>") ;
  d.document.write("</TD>&nbsp;&nbsp&nbsp<TD>") ;
  d.document.write("</TD><TD VALIGN='top'>") ;
  d.document.write("<EM>i.e. a comma separated list</EM>") ;
  d.document.write("<BR><EM>i.e. a (numeric) range of image file name</EM>") ;
  d.document.write("<TD>") ;
  d.document.write("</TD>") ;
  d.document.write("</TR>") ;
  d.document.write("</TABLE>") ;
  d.document.write("For both forms the image name can either consist of:") ;
  d.document.write("<UL>") ;
  d.document.write("<LI><B>Full location</B>, e.g.  http://www.raz.co.uk/pictures/image01.jpg</LI>") ;
  d.document.write("<LI><B>Relative location</B>,e.g.  ../graphics/image01.jpg</LI>") ;
  d.document.write("<LI><B>No location</B>,e.g.  image01.jpg</LI>") ;
  d.document.write("</UL>") ;
  d.document.write("You have supplied the image parameter value of:") ;
  d.document.write("<DIV ALIGN='center'><B>" + pictures + "</B></DIV>") ;
}

function showPictures(title,footnote,pictures,width,height,panview,author,url,adverttyp) {   
  var numErrors = 0, factor, smallWidth, smallHeight, scanForHashes, errorFile ;

  if (title == "" || title == null) {
    title = ' ' ;
  }

  if (footnote == "" || footnote == null) {
    footnote = ' ' ;
  }

  if (adverttyp == "" || adverttyp == null) {
    adverttyp = ' ' ;
  }
  
  if (navigator.appName.indexOf("Netscape") != -1) {
    // Running Netscape ....
    if (height == "0") {
      height = '254' ;
    }

    if (width == "0") {
      width = '384' ;
    }
  }

  if (width == "" || width == null) {
    width = '384' ;
  }

  if (height == "" || height == null) {
    height = '288' ;
  }

  factor = width / 64 ;
  smallWidth  = width  / factor ;
  smallHeight = height / factor ;
  
  // Scan the value of the "pictures" element for two hashes (--).  This represents
  // a continuous list of picture names....
  scanForHashes = pictures.search(/--/) ;

  if (scanForHashes >= 1) {
    // The parameter contains hashes .... assume this is a list of values ....

    errorFile = null ;

    var part1 = pictures.substr(0,scanForHashes) ;
    var part2 = pictures.substr(scanForHashes+2) ;
    
    var scanForFullStop1 = part1.lastIndexOf(".") ;
    var scanForFullStop2 = part2.lastIndexOf(".") ;
  
    var l1 = part1.length ;
    var l2 = part2.length ;
  
    var part1FileName = part1.substring(0,scanForFullStop1) ;
    var part2FileName = part2.substring(0,scanForFullStop2) ;
    var part1FileExt  = part1.substring(scanForFullStop1 + 1) ;
    var part2FileExt  = part2.substring(scanForFullStop2 + 1) ;
                                            
//  alert("The value of pictures contains --\n" + scanForHashes + "\nPart1 " + part1 + " Length " + l1 + "\nPart2 " + part2 + " Length " +l2 + "\n" + "Part 1 Full stop " + scanForFullStop1 + "\nPart 2 Full stop " + scanForFullStop2 +"\nPart 1 Filename: " + part1FileName + "  Ext " + part1FileExt + "\n" + "Part 2 Filename: " + part2FileName + "  Ext " + part2FileExt) ;

    if (part1.length != part2.length) {
      // The length of the two file names is NOT equal.  This is not valid

      numErrors == numErrors + 1 ;

      if (numErrors == 1) {      
        errorFile = window.open("","ErrorFile","status=yes,toolbar=yes,width=700,height=400,left=50,screenX=50,top=80,screenY=80,scrollbars=yes") ;
      }
      
      writeHeader(errorFile,"showPictures: Invalid length of image files") ;

      errorFile.document.write('<BODY>') ;

      imageNameError(errorFile,pictures) ;

      errorFile.document.write("i.e. in form (2).<BR><BR>") ;
      errorFile.document.write("This parameter is <B>not</B> valid because <U>the length of the ") ;
      errorFile.document.write("two names is not identical</U>.  The image file names used by this ") ;
      errorFile.document.write("routine are required to be equal in length.  Where necessary ") ;
      errorFile.document.write("you <B>must</B> zero pad your image names, some examples:") ;
      errorFile.document.write("<DIV ALIGN='center'>") ;
      errorFile.document.write("<TABLE BORDER='1' WIDTH='70%'>") ;
      errorFile.document.write("<TR>") ;
      errorFile.document.write("<TH WIDTH='50%'>Valid image names</TH>") ;
      errorFile.document.write("<TH WIDTH='50%'>Invalid image names</TH>") ;
      errorFile.document.write("</TR><TR>") ;
      errorFile.document.write("<TD STYLE='small'>image0001.jpg--image0056.jpg</TD>") ;
      errorFile.document.write("<TD STYLE='small'>image1.jpg--image56.jpg</TD>") ;
      errorFile.document.write("</TR><TR>") ;
      errorFile.document.write("<TD STYLE='small'>pic01.gif--pic10.gif</TD>") ;
      errorFile.document.write("<TD STYLE='small'>pic1.gif--pic10.gif") ;
      errorFile.document.write("</TR><TR>") ;
      errorFile.document.write("<TD STYLE='small'>&nbsp;</TD>") ;
      errorFile.document.write("<TD STYLE='small'>pic_<one>.jpg--pic_<ten>.jpg</TD>") ;
      errorFile.document.write("</TR>") ;
      errorFile.document.write("</TABLE>") ;
      errorFile.document.write("</DIV>") ;
 
      errorFile.document.write("<BR>") ;
      errorFile.document.write("<TABLE>") ;
      errorFile.document.write("<TR>") ;
      errorFile.document.write("<TD STYLE='small' VALIGN='top'>Notes</TD>") ;

      errorFile.document.write("<TD>") ;
      errorFile.document.write("<UL>") ;
      errorFile.document.write("<LI STYLE='small'><SPAN STYLE='small'>You can not mix image file types when using form (2). ") ;
      errorFile.document.write("This routine will not check that the images actually exist, if any ") ;
      errorFile.document.write("image files can not be located then broken links will be displayed.</SPAN>") ;
      errorFile.document.write("<LI STYLE='small'>The image file names must contain numeric values at the end of ") ;
      errorFile.document.write("the file name, e.g.&nbsp;&nbsp;&nbsp;<B>image0001.jpg</B>&nbsp;&nbsp;&nbsp;") ;
      errorFile.document.write("Filenames in the form <B>image0001a.jpg</B>&nbsp;&nbsp;are not valid") ;
      errorFile.document.write("<LI STYLE='small'>Filenames and File Extensions are <U>case sensitive</U>.  Please ") ;
      errorFile.document.write("ensure that they are supplied in the correct case.") ;
      errorFile.document.write("</UL>") ;
      errorFile.document.write("</TD>") ;
      errorFile.document.write("</TR>") ;
      errorFile.document.write("</TABLE>") ;
    }
    
    if (part1FileExt != part2FileExt) {
      // The file extensions of both file names MUST be the same.  They are not the same
      // so raise an error ....

      numErrors = numErrors + 1 ;

      if (numErrors == 1) {      
        errorFile = window.open("","ErrorFile","status=yes,toolbar=yes,width=700,height=400,left=50,screenX=50,top=80,screenY=80,scrollbars=yes") ;
      }
      else {
        errorFile.document.writeln("<HR>") ;
      }
          
      writeHeader(errorFile,"showPictures: File extensions do not match") ;

      errorFile.document.write('<BODY>') ;

      imageNameError(errorFile,pictures) ;

      errorFile.document.writeln("i.e. in form (2).<BR><BR>") ;
      errorFile.document.writeln("When using form (2) the extensions of the filenames must be ") ;
      errorFile.document.writeln("identical (<U>note that the file names and extensions are ") ;
      errorFile.document.writeln("case sensitive</U>).  You have supplied the values ") ;
      errorFile.document.writeln("<B>" + part1FileExt + "</B> and <B>" + part2FileExt + "</B> ") ;
      errorFile.document.writeln("which are not equal.  Please correct these file extensions.") ;
    }

    var x = part1FileName.length ;
    var characterPart1 = '' ;
    var numericPart1   = '' ;
    var characterPart2 = '' ;
    var numericPart2   = '' ;
    var foundCharacter = 0 ; // Flag: Character not found in filename

//  alert ('This far ' + x + "\nValue is: " + part1FileName) ;
    
    for (var j = 1 ; j <= x ; j++) {
      var character = part1FileName.substring((x - j + 1),(x - j)) ;

//    alert ('Character value ' + j + ' is ' + character) ;    
      var position = character.search(/\d/) ;

      if (character.search(/\d/) == -1) {
        foundCharacter = 1 ;
//      alert ('Character value ' + character + ' is NOT Numeric at position ' + position) ;    
      }
      else {
//      alert ('Character value ' + character + ' is Numeric at position ' + position) ;    
      }

      if (foundCharacter == 0) {
        // Append to the numeric part of the filename
        numericPart1 = character + numericPart1 ;
//      alert ('Numeric value so far is : ' + numericPart) ;
      }
      else {
        // Append to the character part of the filename
        characterPart1 = character + characterPart1 ;
//      alert ('Character value so far is : ' + characterPart) ;
      }
    }

    x = part2FileName.length ;
    foundCharacter = 0 ; // Flag: Character not found in filename

    for (var j = 1 ; j <= x ; j++) {
      var character = part2FileName.substring((x - j + 1),(x - j)) ;

      var position = character.search(/\d/) ;

      if (character.search(/\d/) == -1) {
        foundCharacter = 1 ;
      }

      if (foundCharacter == 0) {
        // Append to the numeric part of the filename
        numericPart2 = character + numericPart2 ;
      }
      else {
        // Append to the character part of the filename
        characterPart2 = character + characterPart2 ;
      }
    }
    
    if (characterPart1 != characterPart2) {
      // The file name root value (i.e. the bit without the numerics) are not equal over
      // both filenames.  This is not valid ....

      numErrors = numErrors + 1 ;

      if (numErrors == 1) {      
        errorFile = window.open("","ErrorFile","status=yes,toolbar=yes,width=700,height=400,left=50,screenX=50,top=80,screenY=80,scrollbars=yes") ;
      }
      else {
        errorFile.document.writeln("<HR>") ;
      }
          
      writeHeader(errorFile,"showPictures: File names do not match") ;

      errorFile.document.write('<BODY>') ;

      imageNameError(errorFile,pictures) ;

      errorFile.document.writeln("i.e. in form (2).<BR><BR>") ;
      errorFile.document.writeln("When using form (2) the character part of the filenames must ") ;
      errorFile.document.writeln("be identical.  You have supplied the values ") ;
      errorFile.document.writeln("<B>" + characterPart1 + "</B> and <B>" + characterPart2 + "</B> ") ;
      errorFile.document.writeln("which are not equal.  Please correct these file names.") ;
      
    }

    var fileNumber = 0 ;
    var lnp1 = 0 ;
    var lfn  = 0 ;
    var looped = 0 ;

    for (var j = numericPart1 ; j <= numericPart2 ; j++) {
      // Value may have leading zeros - this removes them and converts to character
      fileNumber = (j - 0) ;  
      fileNumber = fileNumber.toString() ;

      var filename = characterPart1 + numericPart1.substr(0,numericPart1.length - fileNumber.length) + fileNumber + '.' + part1FileExt;

      looped ++ ;
      
      if (looped == 1) {
        pictures = filename ;
      }
      else {
        pictures = pictures + ',' + filename ;
      }     
      
//    alert('Numeric value now is ' + j + '\nFileNumber is : ' + fileNumber + '\nFilename is : ' + filename + '\nNumericPart1 : ' + lnp1 + '\nFileNumber : ' + lfn) ;
//    alert('Value of pictures is : ' + pictures) ;
    }

    if (numErrors >= 1) {
      errorFile.document.write("</SMALL>") ;
      errorFile.document.close() ;
    }
  }
  else {
//  alert("The value of pictures does NOT contain --\n" + scanForHashes) ;
  }

  images = pictures.split(",") ;
  totalPics = images.length -1;
  
  if (numErrors <= 0) { 
    document.writeln('<DIV ALIGN="center">') ;
    document.writeln('<TABLE BORDER="0" WIDTH="100%">') ;
    document.writeln('<FORM name="main">') ;
    document.writeln('<TR>') ;

    document.writeln('<TD ALIGN="center" WIDTH="50%">') ;
    document.writeln('<IMG SRC="./img0000.jpg" ') ;

    if (height == "0") {
//    alert ('Height is zero') ;
    }
    else {
//    alert ('Height is ' + height) ;
      document.writeln('HEIGHT="' + height + '" ') ;
    }

    if (width == "0") {
//    alert ('Width is zero') ;
    }
    else {
//    alert ('Width is ' + width) ;
      document.writeln('WIDTH="' + width + '" ') ;
    }

    document.writeln('NAME="img">') ;

//  document.writeln('<IMG SRC="./img0000.jpg" WIDTH="' + width + '" HEIGHT="' + height + '" NAME="img">') ;

    document.writeln('<BR>') ;
    document.writeln('<INPUT TYPE=text value="                         " NAME="count">') ;
    document.writeln('</TD>') ;

    document.writeln('<TD VALIGN="top" ALIGN="center">') ;

    document.writeln('<TABLE BORDER="0">') ;
    document.writeln('<TR>') ;
    document.writeln('<TD VALIGN="top" COLSPAN ="2">') ;
    document.writeln('<H2>' + title + '</H2>') ;
    document.writeln('</TD>') ;
    document.writeln('</TR>') ;
    document.writeln('<TR>') ;
    
    var htmlTitle = '"' + title + '"' ;
    var htmlPictures = '"' + pictures + '"' ;
    
//    document.writeln('<STRONG><A HREF="" TARGET="panview" onClick=\"panView(\'' + title + '\',\'' + footnote + '\',\'' + pictures + '\',\'' + width + '\',\'' + height + '\') ; return false ;\">Alternate Pan View</A></STRONG><BR>') ;
//  document.writeln('<IMG SRC="./img0001.jpg" WIDTH="' + smallWidth + '" HEIGHT="' + smallHeight + '" name="nextpict" align="center">') ;


    document.writeln('<TD><IMG SRC="./img0001.jpg" ') ;

    if (width == "0") {
//    alert ('Width is set to 64') ;
     
      document.writeln('WIDTH="64" ') ;
    }
    else {
      document.writeln('WIDTH="' + smallWidth + '" ') ;
    }

    if (height == "0") {
    }
    else {
      document.writeln('HEIGHT="' + smallHeight + '" ') ;
    }

    document.writeln('name="nextpict" align="center"></TD>') ;

    if (scanForHashes >= 1) {
      document.writeln('<TD><INPUT TYPE=button VALUE="Next Picture " NAME="next" onClick="nextimg();"></TD>') ;
    }
    else {
      document.writeln('<TD><INPUT TYPE=button VALUE=" " NAME="next" onClick="nextimg();"></TD>') ;
    }
    
    document.writeln('</TR><TR>') ;
//  document.writeln('<IMG SRC="./img0000.jpg" WIDTH="' + smallWidth + '" HEIGHT="' + smallHeight + '" name="prevpict" align="center">') ;

    document.writeln('<TD><IMG SRC="./img0000.jpg" ') ;

    if (width == "0") {
      document.writeln('WIDTH="64" ') ;
    }
    else {
      document.writeln('WIDTH="' + smallWidth + '" ') ;
    }

    if (height == "0") {
    }
    else {
      document.writeln('HEIGHT="' + smallHeight + '" ') ;
    }

    document.writeln('name="prevpict" align="center"></TD>') ;

    if (scanForHashes >= 1) {
      document.writeln('<TD><INPUT TYPE=button VALUE="Previous     " NAME="previous" onClick="previmg();"></TD>') ;
    }
    else {
      document.writeln('<TD><INPUT TYPE=button VALUE=" " NAME="previous" onClick="previmg();"></TD>') ;
    }
    
    document.writeln('</TR><TR>') ;
    document.writeln('<TD COLSPAN="2" ALIGN="center">') ;
    if (scanForHashes >= 1) {
      document.writeln('<INPUT TYPE=button VALUE="First Picture" BANE="first" onClick="firstimg();">') ;
      document.writeln('<INPUT TYPE=button VALUE=" Last Picture" NAME="last"  onClick="lastimg();">') ;
      document.writeln('<BR>') ;
      document.writeln('<INPUT TYPE=button VALUE="   Random    " NAME="random" onClick="pickrand();">') ;
    }
    else {
      document.writeln('<INPUT TYPE=button VALUE=" " BANE="first"  onClick="firstimg();">') ;
      document.writeln('<INPUT TYPE=button VALUE=" " NAME="last"   onClick="lastimg();">') ;
      document.writeln('<INPUT TYPE=button VALUE=" " NAME="random" onClick="pickrand();">') ;
    }
    document.writeln('<BR><SMALL>' + footnote + '</SMALL>') ;
    document.writeln('</TD>') ;
    document.writeln('</TR>') ;
    document.writeln('</TABLE>') ;
    document.writeln('<SMALL>') ;
//  document.writeln('<BR>author = ' + author) ;
//  document.writeln('<BR>url = ' + url) ;

    pageFoot(document.lastModified,author,url) ;

    document.writeln('</SMALL>') ;

    document.writeln('<BR>') ;
  
    advert(adverttyp) ;

    document.writeln('</TD>') ;
    document.writeln('</TR>') ;
    document.writeln('</FORM>') ;
    document.writeln('</TABLE>') ;
  }
  else {
    document.writeln('Parameters contain errors.') ;
  }
  
//  document.writeln(images) ;

  loadInitial() ;
  
  var w = null ;
  w = window.open("","Picturecache","status=yes,toolbar=yes,width=400,height=250,left=50,screenX=50,top=80,screenY=80") ;

  writeHeader(w,"Image cache for " + title) ;
  w.document.write('<BODY>') ;

  w.document.write('<SMALL>') ;
    
  w.document.write("For viewing efficiency the pictures will be cached.<BR>") ;
  w.document.write("Please minimise or ignore this window&nbsp;&nbsp;") ;
  w.document.write("<STRONG>BUT DO NOT CLOSE IT</STRONG><BR>") ;
  w.document.write("<BR>For best results you should have a disk cache ") ;
  w.document.write("or browser Temporary Internet file area of at least&nbsp;<STRONG>6MB</STRONG>.<BR>") ;
  w.document.write("<BR>") ;
    
// Define the javascript code that will actually cache the images ....
  w.document.write('<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.1">') ;
  w.document.write('var pictures = "' + pictures + '" ;') ;
  w.document.write('images = new Array ;') ;
  w.document.write('preLoadArray = new Array ;') ;
  w.document.write('images = pictures.split(",") ;') ;
  w.document.write('totalPics = images.length -1 ;') ;

  w.document.write('function loadImages() {') ;
  w.document.write('window.blur() ;') ;
  w.document.write('for (count = 0 ; count < totalPics -1 ; count++) {') ; 
  w.document.write('var i = preLoadArray.length;') ;
  w.document.write('preLoadArray[i] = new Image;') ;
  w.document.write('preLoadArray[i++].src = images[count];') ;
  w.document.write('}') ;
  w.document.write('}') ;

  w.document.write('var total = totalPics + 1 ;') ;
  w.document.write('document.writeln("Loading " + total + " images.<BR>") ;') ;
  w.document.write('document.writeln("<P CLASS=\'vsmall\'>This window will automatically close after all the images have been cached.</P><BR>") ;') ;

  // Build in a delay so that the loading of the images for the cache does not conflict
  // with the loading of the first two images on the document which are loaded by the
  // loadInitial function call. 
  
  // Run the "loadImages" function after 2 seconds.
  w.document.write('window.setTimeout("loadImages()",2000) ;') ;

  // Close the window after waiting 6 seconds per image ....
  w.document.write('window.setTimeout("window.close()",totalPics * 6000) ;') ;
   
  w.document.write('document.writeln("<P CLASS=\'copyright\'>Copyright (c) 1998-2007 <A HREF=\'http:\/\/www.darrell.edgley.name\' TARGET=\'darrelledgley\'>Darrell Edgley<\/A>") ;') ;
  
  if (author != "Darrell Edgley") {
    w.document.write('document.writeln("<BR>In association with ' + author + '") ;') ;
  }

  w.document.write('document.writeln("<\/P>") ;') ;
  
  w.document.write('<\/SCRIPT>') ;
  w.document.write("</SMALL>") ;
  w.document.close() ;
}

function picCount() {
  var picno = i + 1 ;
  var total = totalPics + 1 ;
  document.main.count.value = "Image " + picno + " of " + total;
}

function nextpic() {
  var j = i+1;

  if (j > totalPics) {
    document.main.nextpict.src = images[i] ;
  }
  else {
    document.main.nextpict.src = images[j] ;
  }

  picCount() ;
}

function prevpic() {
  var k = i -1 ;

  if (k < 1) {
    image = images[i] ;
    document.main.prevpict.src = image ;
  }
  else {
    image = images[k] ;
    document.main.prevpict.src = image ;
  }

  picCount() ;
}

function previmg() {
  if (i != 0) {
    i -- ;
    document.main.img.src = images[i] ;
    document.main.next.value = "Next" ;
  }
  if (i == 0) {
    document.main.previous.value="        " ;
  }

  nextpic() ;
  prevpic() ;
}

function nextimg() {
  if (i != totalPics) {
    i ++ ;
    document.main.previous.value="Previous" ;
    image = images[i] ;
    document.main.img.src = image ;
  }

  if (i == totalPics) {
    document.main.next.value="    " ;
  }

  nextpic() ;
  prevpic() ;
}

function pickrand() {
  var imagenumber = totalPics ;
  var randomnumber = Math.random() ;
  var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;
  var randimage = images[rand1] ;

  document.main.img.src = randimage ;
  i = rand1 ;

  if (i == 0){
    document.main.previous.value="        " ;
  }
  else {
    document.main.previous.value="Previous" ;
  }

  if (i == totalPics){
    document.main.next.value="    " ;
  }
  else {
    document.main.next.value="Next" ;
  }

  nextpic() ;
  prevpic() ;
}

function firstimg(){
  i = 0;
  document.main.img.src = images[i];
  document.main.previous.value="        ";
  document.main.next.value="Next";

  nextpic();
  prevpic();
}

function lastimg(){
  i = totalPics;
  document.main.img.src = images[i];
  document.main.next.value="    ";
  document.main.previous.value="Previous";

  nextpic();
  prevpic();
}

function loadInitial() {
  if (i == 0) {
    document.main.previous.value="       ";
  }

  document.main.img.src = images[0];
  nextpic();
  prevpic();
}

