// Picture array for JDP Favourites pages...

    var sPath = "favourites/";    // path from website root to pics folder
    var arrPic = new Array();     // array for picture filenames
    var arrCap = new Array();     // array for picture captions
    
// filenames go into the arrPic array - excluding the ".jpg" bit
// captions go into arrCap array - empty string("") if no caption
// expand array if required, eg arrPic[30], arrCap[30], arrPic[31] etc etc.
// thumbnails MUST have the same filename as the larger pic but with
// "_thm" on the end. Eg. arrPic[] = "bride" then pic file is bride.jpg
// and thumbnail = "bride_thm.jpg" - both must be in folder indicated above.
    
    arrPic[0] = "fav_farm";
    arrCap[0] = "Down on the farm";
    arrPic[1] = "whirlow";
    arrCap[1] = "Whirlow";
    arrPic[2] = "tabitha";
    arrCap[2] = "Doing it in style";
    arrPic[3] = "fav_stairsclr";
    arrCap[3] = "Wedding at Hogwarts?";
    arrPic[4] = "fav_hair";
    arrCap[4] = "Hair do, hair don't!";
    arrPic[5] = "fav_doorway";
    arrCap[5] = "Don't look back";
    arrPic[6] = "fav_light";
    arrCap[6] = "A moment to relax";
    arrPic[7] = "fav_orange";
    arrCap[7] = "Bucks fizz at Storrs Hall";
    arrPic[8] = "fav_wedding";
    arrCap[8] = "Pure romance";
    arrPic[9] = "fav_blokes";
    arrCap[9] = "Kidnap attempt at Gibbon Bridge";
    arrPic[10] = "fav_incar";
    arrCap[10] = "En route to Gibbon Bridge";
    arrPic[11] = "fav_dream";
    arrCap[11] = "Dreaming at Eaves Hall";
    arrPic[12] = "bas161f";
    arrCap[12] = "";
    arrPic[13] = "bas198c";
    arrCap[13] = "";
    arrPic[14] = "forb059";
    arrCap[14] = "";
    arrPic[15] = "gor074";
    arrCap[15] = "";
    arrPic[16] = "gor160b";
    arrCap[16] = "";
    arrPic[17] = "gor197";
    arrCap[17] = "";
    arrPic[18] = "gor273";
    arrCap[18] = "";
    arrPic[19] = "gre102";
    arrCap[19] = "";
    arrPic[20] = "mizd096";
    arrCap[20] = "Handbag Moment";
    arrPic[21] = "angels";
    arrCap[21] = "Roweena's angels";
    arrPic[22] = "fav_bridesmaid";
    arrCap[22] = "sugar and spice...";
    arrPic[23] = "tri118";
    arrCap[23] = "";
    arrPic[24] = "tri222";
    arrCap[24] = "";
    arrPic[25] = "wad031";
    arrCap[25] = "";
    arrPic[26] = "snookered";
    arrCap[26] = "Snookered";
    arrPic[27] = "wad071";
    arrCap[27] = "Double trouble";
    arrPic[28] = "wad413b";
    arrCap[28] = "";
    //arrPic[29] = "wad413b";
    //arrCap[29] = "";
    
    // end of pic and caption arrays - don't change anything after here.

    var iCur = 0;     // the current picture number
    
///////////////////////////////////////////////////////
//
// showNextPic():  handle next/previous arrows selectedpic.htm
//
    function showNextPic(dir)
      {
      // determine which pic is needed next...
      if (dir == 1)
        {
        iCur++;
        if (iCur >= arrPic.length)
          iCur = 0;
        }
      else
        {
        iCur--;
        if (iCur < 0)
          iCur = arrPic.length - 1;
        }
      // then show the required pic...
      var elem = document.getElementById("favPic");
      elem.src = getCurrentPic();
      elem.title = getCurrentCap();
      // and its caption...
      elem = document.getElementById("favCaption");
      elem.innerHTML = getCurrentCap();
      return true;
      }
      
//
///////////////////////////////////////////////////////
//
// setCurrentPic(): set the current picture number
//
function setCurrentPic(iNdx)
  {
  iCur = iNdx;
  }
  
//
///////////////////////////////////////////////////////
//
// getCurrentPic(): get the current picture filename
//
function getCurrentPic()
  {
  return sPath + arrPic[iCur] + ".jpg";
  }
    
//
///////////////////////////////////////////////////////
//
// getCurrentPic(): get the current picture's thumbnail filename
//
function getCurrentThumb()
  {
  return sPath + arrPic[iCur] + "_thm.jpg";
  }
    
//
///////////////////////////////////////////////////////
//
// getCurrentCap(): get the current picture's caption
//
function getCurrentCap()
  {
  return arrCap[iCur];
  }
  
//
///////////////////////////////////////////////////////
//
// showSelectedPic(): open the fave pic window with the 
//                    selected picture showing...
//
    var winPic;   // window for selected picture
    
    function showSelectedPic(iNdx)
      {
      // check if the selected pic window is already present and
      // close it if so (otherwise FF won't bring it back to top!)...
      if (winPic)
        winPic.close();
      // create a new window for the selected pic...
      winPic = window.open("selectedpic.htm?" + iNdx, "winPic", "toolbar=0,scrollbars=0,directories=0,menubar=1,top=20,left=50,width=550,height=570,resizable=1");
      return false;
      }

    function closeSelectedPic()
      {
      if (winPic)
        winPic.close();
      }
  
//
///////////////////////////////////////////////////////
//
// writeThumbnailArray(): display array of thumbnail pix....
//
function writeThumbnailArray()
  {
  iColsPerRow = 6;
  iPicWidth = 98;
  
  for (iRow = 0; iRow <= (arrPic.length - 1) / iColsPerRow; iRow++)
    {
    for (iCol = 0; iCol < iColsPerRow; iCol++)
      {
      iNdx = iRow * iColsPerRow + iCol;
      if (iNdx < arrPic.length)
        {
        setCurrentPic(iNdx);
        document.write("<a class='thumb' onclick='return showSelectedPic(" + iNdx + ")'><img class='thumb' width='" + iPicWidth + "' src='" + getCurrentThumb() + "' title='" + getCurrentCap() + "'></a>");
        }
      }
    document.write("<br />");
    }
  }

//
/////////////////////////////////////////////////////
  