<%@ language="vbscript" %> <% Dim sImage,sCaption,sPreviousVisibiliy,sNextVisibiliy,nNextPosition,nPreviousPosition Dim aPictures(3) 'An array containing the images to be used aPictures(0) = "" aPictures(1) = "" aPictures(2) = "" Dim aCaptions(3) aCaptions(0) = "Our rooms feature comfortable beds, fans, cool tiled floors, warm showers, and many windows that let in gentle breezes and melodic sounds from the jungle as you fall asleep and awaken." aCaptions(1) = "Turtle Beach Lodge currently offers thirty guest rooms. Our plan is to grow slowly, respecting nature, tending our ecological gardens and conserving our 175 acres of wild coastal jungle, estuarine canals and pristine beach environment." aCaptions(2) = "Each room has a combination of different colors. The rooms have a place to hang clothes and shelves for storage. Each room features at least two windows for coolness, good ventilation and to enjoy the fresh air and natural environment." ' SetDefaults(): Sets the default image and caption. ' This function is called the first time the page is loaded ' if an invalid request is made. Sub SetDefaults() sImage = aPictures(0) sCaption = aCaptions(0) sPreviousVisibiliy = "hidden" sNextVisibiliy = "visible" nPreviousPosition = 0 nNextPosition = 1 End Sub ' MoveNext(IntPosition): Moves the image and corresponding caption forward or backward Function MoveNext(IntPosition) nNextPosition = IntPosition+1 nPreviousPosition = IntPosition-1 If (CInt(IntPosition)+1 = UBound(aCaptions)) Then sNextVisibiliy = "hidden" Else sNextVisibiliy = "visible" End If If (CInt(IntPosition) = 0) Then sPreviousVisibiliy = "hidden" Else sPreviousVisibiliy = "visible" End If sImage = aPictures(CInt(IntPosition)) sCaption = aCaptions(CStr(IntPosition)) End Function ' GetCommand(): Returns the name of the image button ("previous" or "next") clicked on by the user Function GetCommand() If (Request.Form.Count = 0) Then GetCommand = "" Else GetCommand = Left(Request.Form.Key(3),Instr(Request.Form.Key(3), ".")-1) End If End Function Select Case GetCommand() Case "Next" MoveNext(Request("NextPosition")) Case "Previous" MoveNext(Request("PreviousPosition")) Case Else SetDefaults() End Select %> Our Rooms
 Our Rooms
<%= sImage %>
<%= sCaption %>