// Data and instructions for display of a Teresa Layman design

function stopErr() {
  var msg = ""
  msg += "JavaScript error has occurred!" + "\n"
  msg += "Cannot display the desired information." + "\n\n"
  msg += "Your browser is: " + navigator.appName + " " + navigator.appVersion
  alert(msg)
  return true
}

function ShowPicture(bookRef) {
  window.onerror = stopErr
  var pictItem_  = new Array()
  var pictTitle  = new Array()
  var pictDimen  = new Array()
  var pictPrice  = new Array()
  var pictImage  = new Array()
  var pictWidth  = new Array()
  var pictHeight = new Array()
  var winWidth
  var winHeight
  var imageBase = ""
  // Define the pictures
  pictItem_[00] = "00000"
  pictTitle[00] = "Not Found!"
  pictDimen[00] = "size not available"
  pictPrice[00] = "0.00"
  pictImage[00] = "images/notavailable.gif"
  pictWidth[00] = 175; pictHeight[00] = 175

  pictItem_[01] = "33707"
  pictTitle[01] = "Outstanding In Their Field"
  pictDimen[01] = "3 1/2\" x 2 3/4\""
  pictPrice[01] = "18.00"
  pictImage[01] = "images/OutstandingInTheirField.jpg"
  pictWidth[01] = 500; pictHeight[01] = 408

  pictItem_[02] = "33708"
  pictTitle[02] = "Kitty Frolic"
  pictDimen[02] = "3 3/4\" x 2 1/2\""
  pictPrice[02] = "18.00"
  pictImage[02] = "images/KittyFrolic.jpg"
  pictWidth[02] = 500; pictHeight[02] = 334

  pictItem_[03] = "33709"
  pictTitle[03] = "Bees and Trees"
  pictDimen[03] = "3 1/8\" x 2 1/16\""
  pictPrice[03] = "18.00"
  pictImage[03] = "images/BeesAndTrees.jpg"
  pictWidth[03] = 500; pictHeight[03] = 362

  pictItem_[04] = "33710"
  pictTitle[04] = "Birds &amp; Berries"
  pictDimen[04] = "3 1/2\" x 2 3/4\""
  pictPrice[04] = "18.00"
  pictImage[04] = "images/BirdsAndBerries.jpg"
  pictWidth[04] = 500; pictHeight[04] = 395

  pictItem_[05] = "33711"
  pictTitle[05] = "This Old Heart Of Mine"
  pictDimen[05] = "3 3/8\" x 2 5/16\""
  pictPrice[05] = "18.00"
  pictImage[05] = "images/ThisOldHeartOfMine.jpg"
  pictWidth[05] = 500; pictHeight[05] = 362

  pictItem_[06] = "33712"
  pictTitle[06] = "A Fish Tale"
  pictDimen[06] = "3 1/8\" x 2 1/4\""
  pictPrice[06] = "18.00"
  pictImage[06] = "images/AFishTale.jpg"
  pictWidth[06] = 500; pictHeight[06] = 355

  pictItem_[07] = "33713"
  pictTitle[07] = "Tumbling Blocks"
  pictDimen[07] = "3 3/8\" x 2 1/8\""
  pictPrice[07] = "18.00"
  pictImage[07] = "images/TumblingBlocks.jpg"
  pictWidth[07] = 500; pictHeight[07] = 323

  pictItem_[08] = "33714"
  pictTitle[08] = "My Cottage By The Sea"
  pictDimen[08] = "3 1/8\" x 2 1/4\""
  pictPrice[08] = "18.00"
  pictImage[08] = "images/MyCottageByTheSea.jpg"
  pictWidth[08] = 500; pictHeight[08] = 355

  pictItem_[09] = "34353"
  pictTitle[09] = "The Bunny Run-Around"
  pictDimen[09] = "4 1/4\" diameter"
  pictPrice[09] = "18.00"
  pictImage[09] = "images/TheBunnyRunAround.jpg"
  pictWidth[09] = 424; pictHeight[09] = 400

  pictItem_[10] = "34354"
  pictTitle[10] = "Rose Wreath"
  pictDimen[10] = "4 5/16\" x 2 15/16\""
  pictPrice[10] = "18.00"
  pictImage[10] = "images/RoseWreath.jpg"
  pictWidth[10] = 500; pictHeight[10] = 355

  pictItem_[11] = "34355"
  pictTitle[11] = "Wild Salmon"
  pictDimen[11] = "2 7/8\" x 3 3/4\""
  pictPrice[11] = "18.00"
  pictImage[11] = "images/WildSalmon.jpg"
  pictWidth[11] = 300; pictHeight[11] = 400

  pictItem_[12] = "34445"
  pictTitle[12] = "Square Dance"
  pictDimen[12] = "3 1/2\" x 2 1/4\""
  pictPrice[12] = "18.00"
  pictImage[12] = "images/SquareDance.jpg"
  pictWidth[12] = 500; pictHeight[12] = 339

  pictItem_[13] = "34446"
  pictTitle[13] = "Snow White, Rose Red"
  pictDimen[13] = "3 1/2\" x 2 5/8\""
  pictPrice[13] = "18.00"
  pictImage[13] = "images/SnowWhiteRoseRed.jpg"
  pictWidth[13] = 500; pictHeight[13] = 380

  pictItem_[14] = "34447"
  pictTitle[14] = "Grape Baskets"
  pictDimen[14] = "4 3/8\" x 3 1/8\""
  pictPrice[14] = "18.00"
  pictImage[14] = "images/GrapeBaskets.jpg"
  pictWidth[14] = 500; pictHeight[14] = 359

  pictItem_[15] = "34768"
  pictTitle[15] = "Sweet Harmony"
  pictDimen[15] = ""
  pictPrice[15] = "24.00"
  pictImage[15] = "images/SweetHarmony.jpg"
  pictWidth[15] = 310; pictHeight[15] = 432

  pictItem_[16] = "34769"
  pictTitle[16] = "English Cottage"
  pictDimen[16] = "3 1/2\" x 2 1/4\""
  pictPrice[16] = "18.00"
  pictImage[16] = "images/EnglishCottage.jpg"
  pictWidth[16] = 500; pictHeight[16] = 348

  pictItem_[17] = "35016"
  pictTitle[17] = "Bumble Bee Ballet"
  pictDimen[17] = "2 1/4\" x 5 1/4\""
  pictPrice[17] = "18.00"
  pictImage[17] = "images/BumbleBeeBallet.jpg"
  pictWidth[17] = 348; pictHeight[17] = 842

  pictItem_[18] = "35017"
  pictTitle[18] = "Bluebirds &amp; Bluebells"
  pictDimen[18] = ""
  pictPrice[18] = "24.00"
  pictImage[18] = "images/BluebirdsAndBluebells.jpg"
  pictWidth[18] = 310; pictHeight[18] = 432

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

  pictItem_[19] = "39879"
  pictTitle[19] = "Anya - Egg"
  pictDimen[19] = "2 1/4\" x 3\""
  pictPrice[19] = "18.00"
  pictImage[19] = "images/Anya.jpg"
  pictWidth[19] = 309; pictHeight[19] = 400

  pictItem_[20] = "39880"
  pictTitle[20] = "Galina - Egg"
  pictDimen[20] = "2 1/4\" x 3\""
  pictPrice[20] = "18.00"
  pictImage[20] = "images/Galina.jpg"
  pictWidth[20] = 307; pictHeight[20] = 400

  pictItem_[21] = "39881"
  pictTitle[21] = "Karina - Egg"
  pictDimen[21] = "2 1/4\" x 3\""
  pictPrice[21] = "18.00"
  pictImage[21] = "images/Karina.jpg"
  pictWidth[21] = 304; pictHeight[21] = 400

  pictItem_[22] = "39882"
  pictTitle[22] = "Natalia - Egg"
  pictDimen[22] = "2 1/4\" x 3\""
  pictPrice[22] = "18.00"
  pictImage[22] = "images/Natalia.jpg"
  pictWidth[22] = 295; pictHeight[22] = 400

  pictItem_[23] = "39883"
  pictTitle[23] = "Sophia - Egg"
  pictDimen[23] = "2 1/4\" x 3\""
  pictPrice[23] = "18.00"
  pictImage[23] = "images/Sophia.jpg"
  pictWidth[23] = 310; pictHeight[23] = 400

  pictItem_[24] = "39884"
  pictTitle[24] = "Hogwash!"
  pictDimen[24] = "2\" x 3\""
  pictPrice[24] = "18.00"
  pictImage[24] = "images/Hogwash.jpg"
  pictWidth[24] = 279; pictHeight[24] = 400

  pictItem_[25] = "39885"
  pictTitle[25] = "Leave A Light On"
  pictDimen[25] = "3 3/4\" x 3 3/4\""
  pictPrice[25] = "18.00"
  pictImage[25] = "images/LeaveALightOn.jpg"
  pictWidth[25] = 395; pictHeight[25] = 400

  pictItem_[26] = "39886"
  pictTitle[26] = "Skipper's Rose"
  pictDimen[26] = "6\" x 4\""
  pictPrice[26] = "18.00"
  pictImage[26] = "images/SkippersRose.jpg"
  pictWidth[26] = 500; pictHeight[26] = 373

  pictItem_[27] = "39887"
  pictTitle[27] = "Sunny Flowers"
  pictDimen[27] = "4\" x 2 3/4\""
  pictPrice[27] = "18.00"
  pictImage[27] = "images/SunnyFlowers.jpg"
  pictWidth[27] = 500; pictHeight[27] = 340

  pictItem_[28] = "39888"
  pictTitle[28] = "The Merry Makers"
  pictDimen[28] = "5\" diameter"
  pictPrice[28] = "18.00"
  pictImage[28] = "images/TheMerryMakers.jpg"
  pictWidth[28] = 423; pictHeight[28] = 400

  pictItem_[29] = "39889"
  pictTitle[29] = "Polychrome Palooza!"
  pictDimen[29] = ""
  pictPrice[29] = "30.00"
  pictImage[29] = "images/PolychromePalooza.jpg"
  pictWidth[29] = 434; pictHeight[29] = 432

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

  pictItem_[30] = "40629"
  pictTitle[30] = "A Tall Ship"
  pictDimen[30] = "4 1/2\" diameter"
  pictPrice[30] = "18.00"
  pictImage[30] = "images/ATallShip.jpg"
  pictWidth[30] = 400; pictHeight[30] = 390

  pictItem_[31] = "40630"
  pictTitle[31] = "Everett Green"
  pictDimen[31] = "2 7/8\" diameter"
  pictPrice[31] = "18.00"
  pictImage[31] = "images/EverettGreen.jpg"
  pictWidth[31] = 340; pictHeight[31] = 322

  pictItem_[32] = "40631"
  pictTitle[32] = "Bud Light"
  pictDimen[32] = "2 7/8\" diameter"
  pictPrice[32] = "18.00"
  pictImage[32] = "images/BudLight.jpg"
  pictWidth[32] = 340; pictHeight[32] = 320

  pictItem_[33] = "40632"
  pictTitle[33] = "Candy Mae Kerr"
  pictDimen[33] = "2 7/8\" diameter"
  pictPrice[33] = "18.00"
  pictImage[33] = "images/CandyMaeKerr.jpg"
  pictWidth[33] = 340; pictHeight[33] = 325

  pictItem_[34] = "40633"
  pictTitle[34] = "Mia Fiddler"
  pictDimen[34] = "2 7/8\" diameter"
  pictPrice[34] = "18.00"
  pictImage[34] = "images/MiaFiddler.jpg"
  pictWidth[34] = 340; pictHeight[34] = 322

  pictItem_[35] = "40634"
  pictTitle[35] = "Phillip Stockings"
  pictDimen[35] = "2 7/8\" diameter"
  pictPrice[35] = "18.00"
  pictImage[35] = "images/PhillipStockings.jpg"
  pictWidth[35] = 340; pictHeight[35] = 322

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

  pictItem_[36] = "36237"
  pictTitle[36] = "Monogram Rose"
  pictDimen[36] = "1 1/4\" diameter<BR>pendant included"
  pictPrice[36] = "24.00"
  pictImage[36] = "images/MonogramRose.jpg"
  pictWidth[36] = 372; pictHeight[36] = 512

  pictItem_[37] = "36238"
  pictTitle[37] = "Bee &amp; Thistle"
  pictDimen[37] = "1 1/4\" diameter<BR>pendant included"
  pictPrice[37] = "24.00"
  pictImage[37] = "images/BeeAndThistle.jpg"
  pictWidth[37] = 372; pictHeight[37] = 512

  pictItem_[38] = "36239"
  pictTitle[38] = "Sheepish Grin"
  pictDimen[38] = "1 1/4\" diameter<BR>pendant included"
  pictPrice[38] = "24.00"
  pictImage[38] = "images/SheepishGrin.jpg"
  pictWidth[38] = 372; pictHeight[38] = 512

  pictItem_[39] = "36240"
  pictTitle[39] = "Nuts For You"
  pictDimen[39] = "1 1/4\" diameter<BR>pendant included"
  pictPrice[39] = "24.00"
  pictImage[39] = "images/NutsForYou.jpg"
  pictWidth[39] = 372; pictHeight[39] = 512

  pictItem_[40] = "36241"
  pictTitle[40] = "Daisies!"
  pictDimen[40] = "1 1/4\" diameter<BR>pendant included"
  pictPrice[40] = "24.00"
  pictImage[40] = "images/Daisies.jpg"
  pictWidth[40] = 372; pictHeight[40] = 512

  // Get the book number from the given book reference and check for not-available status
  var bookNum   = bookRef
  var strikeOn  = ""
  var strikeOff = ""
  var notAvail  = ""
  if (bookRef.indexOf("not available") >= 0) {
    if (bookRef.indexOf(" ") > 0) {
      bookNum = bookRef.substr(0,bookRef.indexOf(" "))
    }
    strikeOn  = "<STRIKE>"
    strikeOff = "</STRIKE>"
    notAvail  = " [not available]"
  }
  // Find the desired picture number from the book number
  var pictNum = 0
  for (var i=1; i < pictImage.length; i++) {
    if (pictItem_[i].indexOf(bookNum) >= 0) {
      pictNum = i; i = pictImage.length
      if (pictImage[pictNum].indexOf("/") < 0) {
        imageBase = "images/"
      }
      pictImage[pictNum]= imageBase + pictImage[pictNum]
    }
  }
  winWidth  = pictWidth[pictNum] + 260
  winHeight = pictHeight[pictNum] + 110
  if (pictWidth[pictNum] < 240) {
    winWidth += 240 - pictWidth[pictNum]
  }
  if (winWidth > 790) {
    winWidth += 790 - winWidth
  }
  // Define the window parameters
  var windowFeatures = "scrollbars,"
  if (navigator.appName == "Microsoft Internet Explorer") {
    if (winHeight > 545) winHeight = 545
    windowFeatures += "width=" + winWidth + ",height=" + winHeight + ",left=0,top=0"
  } else {
    windowFeatures += "width=" + winWidth + ",height=" + winHeight + ",screenX=0,screenY=0"
  }
  // Open the new window
  var repWindow = window.open("","",windowFeatures)
  if (repWindow != null) {
    // Create the new html text
    var repPage = ""
    repPage += "<HTML><HEAD><TITLE>"
    repPage += pictTitle[pictNum]
    repPage += "</TITLE>" + "\n"
    repPage += "</HEAD>" + "\n"
    repWindow.document.write(repPage); repPage = ""
    repPage += "<BODY BGCOLOR=\"#FCFFD0\">" + "\n"
    repPage += "<P ALIGN=CENTER>"
    repPage += "<FONT SIZE=6 COLOR=Fuchsia><B>Thistle Needleworks</B></FONT>" + "\n"
    repPage += "<P><CENTER><TABLE BGCOLOR=#FFFFFF CELLPADDING=6 ALIGN=Center><TR><TD>" + "\n"
    repPage += "<P ALIGN=CENTER><IMG SRC=\"" + pictImage[pictNum] + "\""
    repPage += " WIDTH=" + pictWidth[pictNum] + " HEIGHT=" + pictHeight[pictNum]
    repPage += " ALT=\"" + pictTitle[pictNum] + notAvail + "\">" + "\n"
    repWindow.document.write(repPage); repPage = ""
    repPage += "</TD>" + "\n"
    //begin the second column
    repPage += "<TD VALIGN=Top>" + "\n"
    repPage += "<P ALIGN=CENTER><B><BIG>Teresa Layman Designs</BIG></B>" + "\n"
    repPage += "<P ALIGN=CENTER><B>" + strikeOn
    if (pictTitle[pictNum].indexOf(" / ") < 0) {
    repPage += pictTitle[pictNum]
    } else {
    repPage += pictTitle[pictNum].substr(0,pictTitle[pictNum].indexOf(" / ") + 2) + "<BR>"
    repPage += pictTitle[pictNum].substr(pictTitle[pictNum].indexOf(" / ") + 3)
    }
    repPage += strikeOff + "</B>" + "\n"
    if (pictDimen[pictNum] != "") {
    repPage += "<BR>" + "<B>" + strikeOn + pictDimen[pictNum] + strikeOff + "</B>" + "\n"
    }
    repWindow.document.write(repPage); repPage = ""
    repPage += "<P ALIGN=CENTER><B>#" + strikeOn + pictItem_[pictNum] + strikeOff + "</B><BR>" + "\n"
    repPage += "<B>$ " + strikeOn + pictPrice[pictNum] + strikeOff + "</B>" + "\n"
    if (notAvail.length > 0) {
    repPage += "<P ALIGN=CENTER><B><I>This pattern is no longer available.</I></B>" + "\n"
    }
    repWindow.document.write(repPage); repPage = ""
    repPage += "<P ALIGN=CENTER><A HREF=javascript:window.close() "
    repPage += "ONMOUSEOVER=\"window.status='Close this window';return true\" "
    repPage += "ONMOUSEOUT=\"window.status='';return true\"><SMALL>Close this window</SMALL></A>" + "\n"
    repWindow.document.write(repPage); repPage = ""
    //end of second column
    repPage += "</TD></TR></TABLE></CENTER>" + "\n"
    repWindow.document.write(repPage); repPage = ""
    repPage += "</BODY></HTML>" + "\n"
    repWindow.document.write(repPage)
    repWindow.document.close()
  }
}

