Pictures of the shark statues displayed around San Jose in 2001.


Source code for The Sharks Nook


<%@ Language="VBScript" EnableSessionState="False" %>
<%
' PURPOSE: 
' Show pictures in a gallery.
' USAGE: 
' Drop ".jpgs" into the Sharks directory and they will be found upon next user hit or refresh.
' The Table of Contents (TOC) also changes dynamically, as do the prev. and next buttons.
' NOTES: 
' The Thumbnails page picture will look better if you add a properly shrunken ".gif" file sized to TWidth and THeight.
' An added ".txt " file can be included, and will be displayed as is, so embedded html is allowed, for captions or links.
' The filename for the ".jpg", ".gif", and ".txt" files may need to match case exactly, depending on the host OS.

Option Explicit
Response.Buffer = True

' imode values
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const cdoSendUsingPort = 2

' Allow proxy server caching
Response.CacheControl = "Public"

' Internals redacted
' Code Redacted
' Code Redacted
' Code Redacted
' Code Redacted

' Some variables used throughout the page
Dim SiteName, Webmaster, TrackHits, SkipMail
SiteName = "The Sharks Nook"
Webmaster = "webmaster@sitenook.com"
TrackHits = False ' Tracks users in a text file
SkipMail = True ' Skip emails when viewer reads source code

Const TWidth = 200  ' Thumbnails width
Const THeight = 200 ' Thumbnails height

' get path to this file for correct linking if name changes
Dim PageName, UserIP, Browser, SvrDomain, HTTPname
PageName=Request.ServerVariables("SCRIPT_NAME")             ' This file
UserIP = Request.ServerVariables ("REMOTE_ADDR")
Browser = Request.ServerVariables ("HTTP_USER_AGENT")
SvrDomain = Request.ServerVariables("SERVER_NAME")
HTTPname = "http://" & SvrDomain & "/"

' Init a generic file system object
Dim FileSys
Set FileSys = CreateObject ("Scripting.FileSystemObject")

' Get last revision date of this file, and current year
Dim FileName, ThisFile, Revised, CurrYear, Copyr
FileName = Request.ServerVariables ("PATH_TRANSLATED")      ' This file's real filespec
Set ThisFile = FileSys.GetFile (FileName)
Revised = Int (ThisFile.DateLastModified)
CurrYear = Year (Now)
Copyr = "Copyright (c) 2001-" & CurrYear & " " & SvrDomain & ". All Rights Reserved."

' save info to hits file
If TrackHits = True Then
  Dim FilePath, HitFileName, HitFile, HitStr

  FilePath = Request.ServerVariables ("APPL_PHYSICAL_PATH")
  HitFileName = FilePath & "contrib\sharks_hits.txt"
  Set HitFile = FileSys.OpenTextFile (HitFileName, ForAppending, true)
  HitStr = Now
  HitStr = HitStr & ", " & UserIP                                       ' user IP
  HitStr = HitStr & ", " & Request.ServerVariables ("QUERY_STRING")     ' user request
  HitStr = HitStr & ", " & Request.ServerVariables ("HTTP_REFERER")     ' how user got here
  HitStr = HitStr & ", " & Browser                                      ' user browser
  HitFile.WriteLine HitStr
  HitFile.Close
  Set HitFile = Nothing
End If

' Get querystring variables
Dim ToC, ShowToC, Cols
ToC=Request.QueryString("ToC")
ShowToC=Request.QueryString("ShowToC")
Cols=Request.QueryString("Cols") ' Number of cols per row in the thumbnail display
If Cols = "" Then Cols = 3

' Omit email notification about MSN robot hits on View Source page
If ToC = "ViewSource" Then
  If Left (Browser, 6) = "msnbot" Then SkipMail=True
End If

' Get list of Sharks
Dim ImgDir, ImgFiles, ImgFile
Dim Dot
Set ImgDir = FileSys.GetFolder(ThisFile.ParentFolder & "\sharks")
Set ImgFiles = ImgDir.Files
Dim ImgArray(), ExtArray(), RankArray()
Redim ImgArray (ImgFiles.Count)
Redim ExtArray (ImgFiles.Count)
Redim RankArray (ImgFiles.Count)

' Fill array with image filenames, assumes one period for the extension: image1.jpeg
Dim ImgFileName, ImgFileExt, ImgRank, ImgPrevRank, ImgPrevFile, ImgCnt
ImgCnt = 0
ImgPrevFile = ""
ImgPrevRank = 0
For Each ImgFile in ImgFiles
    
    ' Split off the extension
    Dot = Instr(1, ImgFile.Name, ".")
    ImgFileName = Left (ImgFile.Name, Dot-1)
    ImgFileExt = LCase (Right (ImgFile.Name, Len (ImgFile.Name) - Dot))
    
    ' Rank the ext, in case more than one is found; highest wins
    ImgRank = 0
    Select Case ImgFileExt
        Case "png"
            ImgRank = 40
        Case "jpg"
            ImgRank = 30
        Case "jpeg"
            ImgRank = 20
        Case "gif"
            ImgRank = 10
        Case Else   ' redundant
            ImgRank = 0
    End Select
    
    ' Add image to the array
    Dim ImgAdd, DupImg
    ImgAdd = False
    If ImgRank > 0 Then                         ' Must be a recognized image extension
        ImgAdd = True
        
        ' Check if Filename has already been found, with another image extension
        If ImgPrevFile = ImgFileName Then       
            ImgAdd = False
            DupImg = ImgCnt-1 
            If DupImg < 1 Then DupImg = 0 End if
            
            ' Update extension and rank, if better
            If ImgPrevRank < ImgRank Then
                ExtArray(DupImg) = ImgFileExt
                RankArray(DupImg) = ImgRank
            End If  
        End If  
    End If  

    ' New image type found, add to array
    If ImgAdd = True Then
        ImgArray(ImgCnt) = ImgFileName
        ExtArray(ImgCnt) = ImgFileExt
        RankArray(ImgCnt) = ImgRank
        ImgCnt = ImgCnt + 1
        ImgPrevRank = ImgRank
        ImgPrevFile = ImgFileName
    End If  
    
Next
Set ImgFiles = Nothing

' Begin output of the HTML
Response.Write "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN"" ""http://www.w3.org/TR/html4/strict.dtd"">" & vbCrLf & _
               "<HTML LANG=""en"">" & vbCrLf & _
               "<HEAD>" & vbCrLf & _
               "<LINK REL=""schema.DC"" HREF=""http://purl.org/dc/elements/1.1/"">" & vbCrLf & _
               "<LINK REL=""stylesheet"" HREF=""sharks.css"" TYPE=""text/css"">" & vbCrLf & vbCrLf & _
               "<!-- common metatags -->" & vbCrLf & _
               "<META HTTP-EQUIV=""Content-Type"" CONTENT=""text/html; charset=ISO-8859-1"">" & vbCrLf
               
' Common metatags
If ToC = "ViewSource" Then
Response.Write "<META NAME=""robots"" CONTENT=""noindex, nofollow"">" & vbCrLf
Else               
Response.Write "<META NAME=""robots"" CONTENT=""index, follow"">" & vbCrLf
End If
Response.Write "<META NAME=""description"" CONTENT=""Pictures of shark statues in San Jose, California during September 2001."">" & vbCrLf & _
               "<META NAME=""keywords"" CONTENT=""shark, sharks, statue, statues, art, street art, charity, pictures, jpg, san jose, sitenook"">" & vbCrLf & _
               "<META NAME=""rating"" CONTENT=""general"">" & vbCrLf & _
               "<META NAME=""homepage"" CONTENT=" & Chr (34) & HTTPname & Chr (34) & ">" & vbCrLf & _
               "<META NAME=""author"" CONTENT=""Paul A. Ryan"">" & vbCrLf & _
               "<META NAME=""copyright"" CONTENT=" & Chr (34) & Copyr & Chr (34) & ">" & vbCrLf & _
               "<META NAME=""generator"" CONTENT=""hand-coded"">" & vbCrLf
               
' Dublin Core metatags
Response.Write vbCrLf & "<!-- Dublin Core metatags -->" & vbCrLf & _
               "<META NAME=""DC.title"" CONTENT=" & Chr (34) & SiteName & Chr (34) & ">" & vbCrLf & _
               "<META NAME=""DC.creator"" CONTENT=""Paul A. Ryan"">" & vbCrLf & _
               "<META NAME=""DC.subject"" CONTENT=""Shark statues in San Jose, CA. Home of the San Jose Sharks hockey team."">" & vbCrLf & _
               "<META NAME=""DC.description"" CONTENT=""Pictures of shark statues in San Jose, California during September 2001."">" & vbCrLf & _
               "<META NAME=""DC.publisher"" CONTENT=""SiteNook.com"">" & vbCrLf & _
               "<META NAME=""DC.date"" CONTENT=""2001-09"">" & vbCrLf & _
               "<META NAME=""DC.type"" CONTENT=""Image"">" & vbCrLf & _
               "<META NAME=""DC.format"" CONTENT=""image/jpeg"">" & vbCrLf & _
               "<META NAME=""DC.identifier"" CONTENT=" & Chr (34) & HTTPname & Chr (34) & ">" & vbCrLf & _
               "<META NAME=""DC.source"" CONTENT=""Statues placed around San Jose, CA."">" & vbCrLf & _
               "<META NAME=""DC.language"" CONTENT=""en"">" & vbCrLf & _
               "<META NAME=""DC.coverage"" CONTENT=""7014457"" SCHEME=""TGN"">" & vbCrLf & _
               "<META NAME=""DC.rights"" CONTENT=" & Chr (34) & Copyr & Chr (34) & ">" & vbCrLf & _
               "<META NAME=""DC.version"" CONTENT=""1.0"">" & vbCrLf

If Debug > 0 Then 
    Response.Write vbCrLf & "<!-- Debug metatags -->" & vbCrLf & _
                "<META NAME=""debug"" CONTENT=" & Chr (34) & Debug & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""reason"" CONTENT=""somebody set up us the bomb"">" & vbCrLf & _
                "<META NAME=""SCRIPT_NAME"" CONTENT=" & Chr (34) & Request.ServerVariables ("SCRIPT_NAME") & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""QUERY_STRING"" CONTENT=" & Chr (34) & Request.ServerVariables ("QUERY_STRING") & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""REMOTE_USER"" CONTENT=" & Chr (34) & Request.ServerVariables ("REMOTE_USER") & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""REMOTE_HOST"" CONTENT=" & Chr (34) & Request.ServerVariables ("REMOTE_HOST") & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""LOCAL_ADDR"" CONTENT=" & Chr (34) & Request.ServerVariables ("LOCAL_ADDR") & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""LOGON_USER"" CONTENT=" & Chr (34) & Request.ServerVariables ("LOGON_USER") & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""FilePath"" CONTENT=" & Chr (34) & FilePath & Chr (34) & ">" & vbCrLf  &_
                "<META NAME=""HitFileName"" CONTENT=" & Chr (34) & HitFileName & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""ImgDir"" CONTENT=" & Chr (34) & ImgDir & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""ImgFileName"" CONTENT=" & Chr (34) & ImgFileName & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""ImgFileExt"" CONTENT=" & Chr (34) & ImgFileExt & Chr (34) & ">" & vbCrLf & _
                "<META NAME=""ImgAdd"" CONTENT=" & Chr (34) & ImgAdd & Chr (34) & ">" & vbCrLf 
End If

' Page title
Response.Write vbCrLf & "<TITLE>" & SiteName & "</TITLE>" & vbCrLf & _
               "</HEAD>" & vbCrLf & _
               "<BODY>" & vbCrLf

' Page header, and "logo"
Response.Write "  <table border=""0"" cellspacing=""0"" cellpadding=""0"" width=""100%"" summary=" & Chr (34) & SiteName & " logo"">" & vbCrLf & _
               "    <tr>" & vbCrLf & _
               "      <td class=""logo"">" & vbCrLf & _
               "        <a href=" & Chr (34) & PageName & "?Cols=" & Cols & Chr (34) & "> " & SiteName & "</a>" & vbCrLf & _
               "      </td>" & vbCrLf & _
               "      <td class=""logo"">&nbsp;</td>    <!-- spacer -->" & vbCrLf & _
               "      <td class=""logo_text"">" & vbCrLf & _
               "        Pictures of the shark statues displayed around San Jose in 2001." & vbCrLf & _
               "      </td>" & vbCrLf & _
               "    </tr>" & vbCrLf & _
               "    <tr><td class=""solidbar"" colspan=""3""></td></tr>" & vbCrLf & _
               "  </table>" & vbCrLf

' Body of page
Response.Write "  <table border=""0"" cellspacing=""0"" cellpadding=""0"" width=""100%"" summary=""Body of page"">" & vbCrLf & _
               "    <tr valign=""top"">" & vbCrLf & _
               "      <td>" & vbCrLf

' Menu begin
If ToC <> "ViewSource" Then
  Response.Write "        <table border=""0"" summary=""Table of Contents"">" & vbCrLf & _
                 "          <tr>" & vbCrLf & _
                 "            <td class=""toc_title"">" & vbCrLf
  If ShowToC = "" Then
    Response.Write "              Table of Contents" & vbCrLf
    ' Show short Menu button
    Response.Write "              <br><span class=""subtext""><a href=" & Chr (34) & PageName & "?ToC=" & ToC & "&amp;ShowToC=no&amp;Cols=" & Cols & Chr (34) & ">[use short menu]</a></span><br>" & vbCrLf
  Else  
    ' Show full Menu button
    Response.Write "              <br><span class=""subtext""><a href=" & Chr (34) & PageName & "?ToC=" & ToC & "&amp;Cols=" & Cols & Chr (34) & ">[use full menu]</a></span><br>" & vbCrLf
  End If
  Response.Write "            </td>" & vbCrLf & _
                 "          </tr>" & vbCrLf

  ' Thumbnail menu item
  Response.Write "          <tr>" & vbCrLf
  If ToC="" Then
    Response.Write "            <td class=""toc_select"">" & vbCrLf
  Else
    Response.Write "            <td class=""toc_text"">" & vbCrLf
  End If
  Response.Write "              <br><a href=" & Chr (34) & PageName & "?Cols=" & Cols
  If ShowToC <> "" Then
    Response.Write "&amp;ShowToC=" & ShowToC
  End If  
  Response.Write Chr (34) & ">Thumbnails</a>" & vbCrLf & _
                 "            </td>" & vbCrLf & _
                 "          </tr>" & vbCrLf

  ' Image name menu item
  Dim i, SelFlag, PrevFlag, SelectedImg, NextImg, PrevImg
  SelFlag = False   ' Init the "selected" flag
  PrevFlag = False  ' Init "previous image" flag
  SelectedImg = 0

  For i = 0 To ImgCnt-1
    If ShowToC = "" Then
      Response.Write "          <tr>" & vbCrLf
    End If
      
    ' Check for "selected" image
    If ToC=ImgArray(i) Then
      SelectedImg = i
      SelFlag = True
      If ShowToC = "" Then
        Response.Write "            <td class=""toc_select"">" & vbCrLf
      End If
    Else
      ' Check if last image was the "selected" one, that makes this the "Next" image
      If SelFlag = True  Then
        SelFlag = False
        NextImg = ImgArray(i)    ' Save the "next" image name

        ' If short menus are being used, we're done
        If ShowToC <> "" Then
          Exit For
        End If
      End If
      If ShowToC = "" Then
        Response.Write "            <td class=""toc_text"">" & vbCrLf
      End If
    End If
    If ShowToC = "" Then
      Response.Write "              <a href=" & Chr (34) & PageName & "?ToC=" & ImgArray(i) & "&amp;Cols=" & Cols & Chr (34) & ">" & ImgArray(i) & "</a>" & vbCrLf & _
                     "            </td>" & vbCrLf & _
                     "          </tr>" & vbCrLf
    End If
      
    ' Keep track of previous image name until we find a "selected" image
    If PrevFlag=False Then
      If SelFlag = True Then
        PrevFlag = True
      Else  
        PrevImg = ImgArray(i)    ' Save the "previous" image name
      End If  
    End If  
  Next

  ' Other links menu item
  Response.Write "          <tr>" & vbCrLf & _
                 "            <td class=""toc_text"">" & vbCrLf & _
                 "              <a href=" & Chr (34) & PageName & "?ToC=Other"
  If ShowToC <> "" Then
    Response.Write "&amp;ShowToC=" & ShowToC
  End If  
  Response.Write "&amp;Cols=" & Cols & Chr (34) & ">Other links</a>" & vbCrLf & _
                 "            </td>" & vbCrLf & _
                 "          </tr>" & vbCrLf

  ' Menu end
  Response.Write "        </table>" & vbCrLf & _
                 "      </td>" & vbCrLf & _ 
                 "      <td>&nbsp;</td>    <!-- spacer -->" & vbCrLf
End If

' Fill in Display area
Response.Write "      <td>" & vbCrLf & _
               "        <table width=""100%"" border=""0"" cellspacing=""5"" cellpadding=""0"" "

If ToC = "" Then
  Response.Write "summary=""Thumbnails of pictures"">" & vbCrLf
Else
  Response.Write "summary=""Selected picture detail"">" & vbCrLf
End if


' If home page, show thumbnails
If ToC = "" Then
  Response.Flush
  Response.Write "          <tr>" & vbCrLf & _
                 "            <td class=""thumb"" colspan=" & Chr (34) & Cols & Chr (34) & ">" & vbCrLf & _
                 "              <span class=""heading"">Thumbnails</span><br>" & vbCrLf & _
                 "              <span class=""subtext"">Number of columns" & vbCrLf & _
                 "              <a href=" & Chr (34) & PageName & "?ToC=" & ToC & "&amp;ShowToC=" & ShowToC & "&amp;Cols=1"">&nbsp;[1]&nbsp;</a>" & vbCrLf & _
                 "              <a href=" & Chr (34) & PageName & "?ToC=" & ToC & "&amp;ShowToC=" & ShowToC & "&amp;Cols=2"">&nbsp;[2]&nbsp;</a>" & vbCrLf & _
                 "              <a href=" & Chr (34) & PageName & "?ToC=" & ToC & "&amp;ShowToC=" & ShowToC & "&amp;Cols=3"">&nbsp;[3]&nbsp;</a>" & vbCrLf & _
                 "              <a href=" & Chr (34) & PageName & "?ToC=" & ToC & "&amp;ShowToC=" & ShowToC & "&amp;Cols=4"">&nbsp;[4]&nbsp;</a>" & vbCrLf & _
                 "              </span>" & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "              Click on the thumbnail for a bigger image." & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "            </td>" & vbCrLf & _
                 "          </tr>" & vbCrLf
  For i = 0 To ImgCnt-1
    ' Check column and start next row, if neccessary
    If i mod Cols = 0 Then
      Response.Write "          <tr><td class=""line"" colspan=" & Cols & ">&nbsp</td></tr>" & vbCrLf
      Response.Write "          <tr>" & vbCrLf
   End If
    
    ' Display the thumbnail
    Response.Write "            <td class=""thumb"">" & vbCrLf & _
                   "              <a href=" & Chr (34) & PageName & "?ToC=" & ImgArray(i)
    If ShowToC <> "" Then
      Response.Write "&amp;ShowToC=" & ShowToC
    End If  
    Response.Write "&amp;Cols=" & Cols & Chr (34) & ">" & ImgArray(i) & "<br>" & vbCrLf & _
                   "              <img width=""" & TWidth & """ height=""" & THeight & """ src=""sharks/"
                   
    ' Check for .GIF, if not there use large pic for thumbnail
    If FileSys.FileExists (ImgDir.Path & "\" & ImgArray(i) & ".gif") = True Then
      Response.Write ImgArray(i) & ".gif" & Chr (34)
    Else                    
      Response.Write ImgArray(i) & "." & ExtArray(i) & Chr (34)
    End If
    Response.Write " alt=" & Chr (34) & "The Shark statue called " & ImgArray(i) & Chr (34) & "></a>" & vbCrLf & _
                   "            </td>" & vbCrLf
                   
    ' Check column and end this row, if neccessary
    If i mod Cols = Cols - 1 Then
      Response.Write "          </tr>" & vbCrLf
      Response.Flush
    End If
  Next
  If ImgCnt mod Cols <> Cols - 1 Then Response.Write "          </tr>" & vbCrLf
  
' If Other, show Other Links
ElseIf ToC = "Other" Then
  Response.Write "          <tr>" & vbCrLf & _
                 "            <td>" & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "              <span class=""heading"">Other Links</span>" & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "              <span class=""links"">" & vbCrLf & _
                 "                <a href=""http://www.oravec.com/sharkbyte_art.htm""> SharkByte Art </a><br>" & vbCrLf & _
                 "                <a href=""http://www.jr.co.il/hotsites/pictures.htm""> Jacob Richman's Hot Sites - Pictures/Art</a><br>" & vbCrLf & _
                 "                <a href=""http://www.sfgate.com/cgi-bin/article.cgi?f=/chronicle/archive/2001/08/23/MNSHARK.DTL""> ""Sharks without bite"" </a><br>" & vbCrLf & _
                 "              </span>" & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "              <span class=""heading"">Sitenook Links</span>" & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "              <a href=""http://Quotes.Sitenook.com"">The Quotes Page</a><br>" & vbCrLf & _
                 "              <a href=" & Chr (34) & PageName & "?ToC=ViewSource" & Chr (34) & ">View the source code for this site</a><br>" & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "              <!-- Validation links -->" & vbCrLf & _
                 "              <a href=""http://validator.w3.org/check/referer"">" & vbCrLf & _
                 "                <img width=""88"" height=""31"" src=""images/valid-html401.png"" alt=""Valid HTML 4.01!"">" & vbCrLf & _
                 "              </a>&nbsp;&nbsp;&nbsp;" & vbCrLf & _
                 "              <a href=""http://jigsaw.w3.org/css-validator/"">" & vbCrLf & _
                 "                <img width=""88"" height=""31"" src=""images/valid-css2.gif"" alt=""Valid CSS!"">" & vbCrLf & _
                 "              </a>" & vbCrLf & _
                 "            </td>" & vbCrLf & _
                 "          </tr>" & vbCrLf

' If ViewSource, do it.
ElseIf ToC = "ViewSource" Then
  Response.Write "          <tr>" & vbCrLf & _
                 "            <td>" & vbCrLf & _
                 "              <br><br>" & vbCrLf & _
                 "              <span class=""heading"">Source code for " & SiteName & "</span>" & vbCrLf & _
                 "              <br><br>" & vbCrLf
  ' output this file
  Dim TxtStream, TxtLine, fHide
  Set TxtStream = FileSys.OpenTextFile(ThisFile, 1)
  Do While Not TxtStream.AtEndOfStream
    TxtLine = TxtStream.ReadLine
    fHide = InStr ( TxtLine, UCase("hidden")) ' Redact some code
    if fHide > 0 Then TxtLine = "' Code Redacted" End if
    Response.Write "              <br>" & Replace (Server.HTMLEncode (TxtLine), " ", "&nbsp;") & vbCrLf
  Loop

  Response.Write "              <br><br>" & vbCrLf & _
                 "            </td>" & vbCrLf & _
                 "          </tr>" & vbCrLf

  ' ViewSource notification via email
    If SkipMail = False Then
        Dim Infoline, TheMail, cdoConfig
        Infoline = vbCrLf & "Source code for Sharks.Sitenook.com was accessed at " & Now & vbCrLf
        Infoline = Infoline & "on server " & Request.ServerVariables ("SERVER_NAME") & "." & vbCrLf
        Infoline = Infoline & vbCrLf & "User's IP: " & UserIP & vbCrLf
        Infoline = Infoline & "Browser: " & Browser & vbCrLf
        Infoline = Infoline & vbCrLf & "-Dude" & vbCrLf
        
        Set cdoConfig = CreateObject("CDO.Configuration")  
        With cdoConfig.Fields  
            .Item(cdoSendUsingMethod) = cdoSendUsingPort  
            .Item(cdoSMTPServer) = SMTPhost
            .Update  
        End With 
        
        Set TheMail = Server.CreateObject("CDO.Message")
        With TheMail
            Set .Configuration = cdoConfig 
            .Subject = "You've been sourced!"
            .From = Webmaster
            .To = SourceMan
            .TextBody = Infoline
            .Send
        End With
        
        Set cdoConfig = Nothing
        Set TheMail = Nothing
    End If
  
' If not already handled, show full size graphic
Else
  Dim NumCols, TxtFile
  
  ' Show Previous and Next links
  NumCols = 0
  Response.Write vbCrLf & "          <!-- navigation buttons -->" & vbCrLf
  Response.Write "          <tr>" & vbCrLf
  If PrevImg <> "" Then 
    Response.Write "            <td align=""center"">" & vbCrLf
    Response.Write "              <span class=""arrows"">" & vbCrLf
    Response.Write "                <a href=" & Chr (34) & PageName & "?ToC=" & PrevImg
    If ShowToC <> "" Then
      Response.Write "&amp;ShowToC=" & ShowToC
    End If  
    Response.Write "&amp;Cols=" & Cols & Chr (34) & ">" & vbCrLf
    Response.Write "                <img width=""100"" height=""39"" src=""images/shark_left.gif"" alt=""Previous Shark: "  & PrevImg & """><br>" & vbCrLf
    Response.Write "                Previous</a>" & vbCrLf
    Response.Write "              </span>" & vbCrLf
    Response.Write "            </td>" & vbCrLf
    NumCols = NumCols + 1
  End If  
  If NextImg <> "" Then 
    Response.Write "            <td align=""center"">" & vbCrLf
    Response.Write "              <span class=""arrows"">" & vbCrLf
    Response.Write "                <a href=" & Chr (34) & PageName & "?ToC=" & NextImg
    If ShowToC <> "" Then
      Response.Write "&amp;ShowToC=" & ShowToC
    End If  
    Response.Write "&amp;Cols=" & Cols & Chr (34) & ">" & vbCrLf
    Response.Write "                <img width=""100"" height=""39"" src=""images/shark_right.gif"" alt=""Next Shark: " & NextImg & """><br>" & vbCrLf
    Response.Write "                Next</a>" & vbCrLf
    Response.Write "              </span>" & vbCrLf
    Response.Write "            </td>" & vbCrLf
    NumCols = NumCols + 1
  End If  
  Response.Write "          </tr>" & vbCrLf

  ' ToC i.e. the image name
  Response.Write vbCrLf & "          <!-- Selected picture detail -->" & vbCrLf
  Response.Write "          <tr>" & vbCrLf
  If NumCols > 1 Then
    Response.Write "            <td colspan=""" & NumCols & """ align=""center"">" & vbCrLf
  Else  
    Response.Write "            <td align=""center"">" & vbCrLf
  End If  
  Response.Write "              <br><br>" & vbCrLf
  Response.Write "              " & ToC & "<br>" & vbCrLf
  Response.Write "              <img src=""sharks/" & ImgArray(SelectedImg) & "." & ExtArray(SelectedImg) & Chr (34) & " alt=" & Chr (34) & "The Shark statue called " & ToC & Chr (34) & "><br>" & vbCrLf
  ' Add any text from associated text file
  TxtFile = ImgDir.Path & "\" & ToC & ".txt"
  If FileSys.FileExists (TxtFile) = True Then
    Set TxtStream = FileSys.OpenTextFile(TxtFile, ForReading)
    Do While Not TxtStream.AtEndOfStream
      Response.Write "              <br>" & TxtStream.ReadLine & vbCrLf
    Loop
  End If
  Response.Write "            </td>" & vbCrLf
  Response.Write "          </tr>" & vbCrLf

End If

' Release resources
Set ThisFile = Nothing
Set ImgDir = Nothing
Set TxtStream = Nothing
Set FileSys = Nothing

' Finish the HTML
Response.Write "        </table>" & vbCrLf & _
               "      </td>" & vbCrLf & _
               "    </tr>" & vbCrLf & _
               "  </table>" & vbCrLf & _
               "  <address>" & vbCrLf & _
               "    <br>" & vbCrLf & _
               "    <span class=""copyr"">" & vbCrLf & _
               "      Email comments and suggestions to <a href=""mailto:" & Webmaster & """>" & Webmaster & "</a><br>" & vbCrLf & _
               "      " & Copyr & "<br>" & vbCrLf & _
               "      Revised: " & Revised & vbCrLf & _
               "    </span>" & vbCrLf & _
               "  </address>" & vbCrLf & _
               "</BODY>" & vbCrLf
%>



Email comments and suggestions to webmaster@sitenook.com
Copyright (c) 2001-2024 sharks.sitenook.com. All Rights Reserved.
Revised: 3/1/2018