%@ Language=VBScript %>
<% OPTION EXPLICIT %>
<%
'Get section HTML - Description, images and subsection titles for links
Dim rsSection
Dim intItem, strSection, strTitle, strHeading, strDesc1, strImage1, strAlt1, strDesc2, strImage2, strAlt2, strDesc3, strImage3, strAlt3, strImage4, strAlt4, strImage5, strAlt5, strImage6, strAlt6, strSectionImage
Dim strDescHTML1, strDescHTML2, strDescHTML3, strImgHTML
Dim noCount
'Get the text
set rsSection = Server.CreateObject("ADODB.Recordset")
strSQL = "select iitemID, ssecSection, ssecHeading, iitemDesc1, iitemDesc2, iitemDesc3, ssecImage from tvSectionItem where ssecID ='" & intSectionID & "'"
'Response.Write strSQL
rsSection.Open strSQL, cnnConn, 1, 4
rsSection.MoveFirst
strSection = rsSection("ssecSection")
strTitle = strSection
strHeading = rsSection("ssecHeading")
If strHeading <> "" then
strHeading = "
" & rsSection("ssecHeading") & "
"
Else
strHeading = ""
End If
strDesc1 = rsSection("iitemDesc1")
strDesc2 = rsSection("iitemDesc2")
strDesc3 = rsSection("iitemDesc3")
strSectionImage = rsSection("ssecImage")
intItem = rsSection("iitemID")
'Close recordset
rsSection.Close
'Get the images using rsSection
strSQL = "select iImageFile, iImageAlt, ximgOrder from tvItemImages where iitemID='" & intItem & "' order by ximgOrder"
rsSection.Open strSQL, cnnConn, 1, 4
'Count how many images we have
rsSection.MoveFirst
noCount = 0
While not rsSection.EOF
noCount = noCount + 1
rsSection.MoveNext
Wend
rsSection.MoveFirst
'Now write out the HTML
'We will always have para 1 and image
strDescHTML1 = "
" & strDesc1 & "
"
strDescHTML1 = Replace(strDescHTML1, chr(10), " ")
'Do we have second paragraph and image?
if strDesc2 <> "" then
if noCount < 2 then
strDescHTML2 = "
" & strDesc2 & "
"
Else
rsSection.MoveNext
strDescHTML2 = "
" & strDesc2 & "
"
End If
strDescHTML2 = Replace(strDescHTML2, chr(10), " ")
Else
strDescHTML2 = ""
End If
'Do we have third paragraph and image?
if strDesc3 <> "" then
if noCount < 3 then
strDescHTML3 = "
" & strDesc3 & "
"
Else
rsSection.MoveNext
strDescHTML3 = "
" & strDesc3 & "
"
End If
strDescHTML3 = Replace(strDescHTML3, chr(10), " ")
Else
strDescHTML3 = ""
End If
If noCount < 4 then
strImgHTML = ""
Else
strImgHTML = strImgHTML & "
"
rsSection.MoveNext
While not rsSection.EOF
strImgHTML = strImgHTML & " "
WEnd
End If
'Close rsSection
rsSection.Close
'Write out subsection links and info request link
Dim strSubSectionLinks
strSQL = "select ssubsecID, ssubsecSubsection from tvAllSecSub where ssecID='" & intSectionID & "' order by xorder"
rsSection.Open strSQL, cnnConn, 1, 4
if rsSection.EOF and rsSection.BOF then
'If there are no links
strSubSectionLinks = "
"
Else
'Count the records
Dim intRecCount
intRecCount = 2
'intRecCount = 4 ' Used to account for initial rows
rsSection.MoveFirst
While not rsSection.EOF
intRecCount = intRecCount + 1
rsSection.MoveNext
WEND
'Write the op of the 'In this section' box
strSubSectionLinks = "
"
rsSection.MoveFirst
If rsSection("ssubsecID") <> "" then
strSubSectionLinks = strSubSectionLinks & "