<%@ language=vbscript %> <%Option Explicit%> <%Response.Buffer = True%> <% dim varDocId dim strSource, strSubFolderPath, strFilename dim strImageType dim intPageNo, intPageCount, intDocId dim intButton dim intError dim dblDocId, dblDivisor dim intValue, strValue 'on error resume next intButton = request.querystring("Button") intPageNo = abs(session("PageNo")) intPageCount = abs(session("PageCount")) strImageType = session("ImageType") 'response.write " Button:" & intButton 'response.write intPageNo 'response.write "/" & intPageCount select case intButton case 1 'response.write " Case1 " intPageNo = 1 case 2 'response.write " Case2 " if intPageNo > 1 then 'response.write " Case2a " intPageNo = intPageNo - 1 end if case 3 'response.write " Case3 " if intPageNo < intPageCount then 'response.write " Case3a " intPageNo = intPageNo + 1 end if case 4 'response.write " Case4 " intPageNo = intPageCount end select session("PageNo") = abs(intPageNo) 'response.write " PageNo:" & intPageNo 'response.write " PageCount:" & intPageCount dblDivisor = 256 varDocId = abs(session("DocId")) if IsNumeric(varDocId) then dblDocId = varDocId + intPageNo - 1 else dblDocId = 0 intError = intError + 1 end if 'Calculate first SubFolder intValue = Int(dblDocId /(dblDivisor * dblDivisor)) strValue = right("000" & trim(intValue),3) strSubFolderPath = strValue & "/" 'Calculate second subfolder intValue = Int(dblDocId / dblDivisor) - intValue strValue = Right("000" & trim(intValue),3) strSubFolderPath = strSubFolderPath & strValue & "/" 'Calculate file name strFileName = right("00000000" & trim(dblDocId), 8) & strImageType If intError = 0 then strSource = strImageFolder & strSubFolderPath & strFileName else strSource = "../../images/Buttons/DocNotFound.jpg" end if %> Document Viewer

Page <% response.write " " & intPageNo & " of " & intPageCount 'response.write ": " & strSource %>