sync on
sync rate 40
randomize timer()
 
set text font "courier new",1
set text size 15
 
bitmode=1
maxbitmodes=8
 
gosub MakeStuff
 
dim backlist$(100)
dim forwardlist$(100)
 
backon=0
forwardon=0
 
directory$=get dir$()+"\"
set dir left$(directory$,len(directory$)-1)
 
gosub ScanSortFiles
 
pageon=1
file=1
pages=files-31
if pages<1 then pages=1
pages#=pages
temp#=(pages#-1)/100
if temp#>1 then temp#=1
temp#=sqrt(1-temp#)
slidersize#=temp#*450
if slidersize#<15 then slidersize#=15
slidersize=slidersize#
 
selected=1
decision=0
 
bitson=1
 
MainLoop:
 
do
 
   cls
 
   file=pageon+selected-1
 
   tslider=1
   bslider=1
 
   gosub HandleInput
   gosub HandleVariables
   gosub HandleDisplay
 
   gosub HandleDecision
 
   sync
 
loop
 
end
 
MakeStuff:
 
   plaspoints=10
   dim plaspoint#(plaspoints)    : rem position
   dim plaspointp#(plaspoints)   : rem movement
   dim plaspointa(plaspoints)    : rem active
   dim plaspointl(plaspoints)    : rem life
 
   plasspikes=10
   dim plasspikeo#(plasspikes)   : rem origin
   dim plasspikel(plasspikes)    : rem life
   dim plasspikem#(plasspikes)   : rem movement
   dim plasspikep(plasspikes)    : rem points joined to
   dim plasspikej(plasspikes,plaspoints)    : rem point joines
 
   for i=1 to plaspoints
      plaspoint#(i)=rnd(360)
      if rnd(1)=1
         plaspointp#(i)=rnd(0)+1
      else
         plaspointp#(i)=rnd(0)-1
      endif
      plaspointp#(i)=plaspointp#(i)/2
      plaspointl(i)=rnd(1)+2
   next i
 
   for i=1 to plasspikes
      plasspikeo#(i)=rnd(360)
      if rnd(1)=1
         plasspikem#(i)=rnd(0)+1
      else
         plasspikem#(i)=rnd(0)-1
      endif
      plasspikem#(i)=plasspikem#(i)/2
      plasspikel(i)=rnd(10)+2
   next i
 
   ink 16777215,0
 
   rem ************Image************
 
   rem Frame
   linebox(2,2,19,14)
   linebox(4,4,17,12)
 
   rem Eyes
   dot 8,6
   dot 13,6
 
   rem Nose
   dot 10,8
   dot 11,8
 
   rem Mouth
   dot 7,9
   dot 14,9
   line 8,10,13,10
 
   rem ************Music************
   my=16
 
   rem lines
   line 11,2+my,11,11+my
   line 11,2+my,15,6+my
 
   rem blob at the bottom
   box 9,9+my,10,12+my
   dot 8,10+my
   dot 8,11+my
 
   rem **********Animation*********
   ay=32
 
   rem A
   line 2,2+ay,2,14+ay
   line 4,2+ay,4,14+ay
   dot 3,2+ay
   dot 3,8+ay
 
   rem N
   line 6,2+ay,6,14+ay
   line 9,2+ay,9,14+ay
   line 6,2+ay,9,14+ay
 
   rem I
   line 11,2+ay,13,2+ay
   line 11,14+ay,13,14+ay
   line 12,3+ay,12,13+ay
 
   rem M
   line 15,2+ay,15,14+ay
   line 17,2+ay,17,14+ay
   line 19,2+ay,19,14+ay
   dot 16,2+ay
   dot 18,2+ay
 
   rem **********Object***********
   oy=48
 
   rem Front+Back Plane
   linebox(5,5+oy,14,14+oy)
   linebox(8,2+oy,17,11+oy)
 
   rem Sides
   dot 16,12+oy
   dot 15,13+oy
 
   dot 16,3+oy
   dot 15,4+oy
 
   dot 7,12+oy
   dot 6,13+oy
 
   dot 6,4+oy
   dot 7,3+oy
 
   rem ***********Text************
   ty=64
 
   rem A
   line 2,2+ty,2,14+ty
   line 6,2+ty,6,14+ty
   line 3,2+ty,5,2+ty
   line 3,8+ty,5,8+ty
 
   rem B
   line 8,2+ty,8,14+ty
   line 9,2+ty,11,2+ty
   line 9,8+ty,11,8+ty
   line 9,14+ty,11,14+ty
   line 12,3+ty,12,7+ty
   line 12,9+ty,12,13+ty
 
   rem C
   line 14,2+ty,14,14+ty
   line 15,2+ty,18,2+ty
   line 15,14+ty,18,14+ty
 
   rem **********Folder***********
   fy=80
 
   rem Sides
   line 19,7+fy,19,13+fy
   line 2,3+fy,2,13+fy
   line 8,3+fy,8,5+fy
 
   rem Bulk
   box 3,6+fy,18,14+fy
   box 3,2+fy,7,5+fy
 
   rem *******Not Supported*******
   ny=96
 
   rem X
   ink rgb(255,0,0),0
   line 3,2+ny,15,14+ny
   line 4,2+ny,16,14+ny
   line 5,2+ny,17,14+ny
 
   line 3,14+ny,15,2+ny
   line 4,14+ny,16,2+ny
   line 5,14+ny,17,2+ny
 
   rem Clip
   ink 0,0
   line 3,14+ny,5,14+ny
 
   get image 11,1,1,20,15
   get image 12,1,1+my,20,15+my
   get image 13,1,1+ay,20,15+ay
   get image 14,1,1+oy,20,15+oy
   get image 15,1,1+ty,20,15+ty
   get image 16,1,1+fy,20,15+fy
   get image 17,1,1+ny,20,15+ny
 
   dim Month$(12)
   Month$(1)="January"
   Month$(2)="Febuary"
   Month$(3)="March"
   Month$(4)="April"
   Month$(5)="May"
   Month$(6)="June"
   Month$(7)="July"
   Month$(8)="August"
   Month$(9)="September"
   Month$(10)="October"
   Month$(11)="November"
   Month$(12)="December"
 
   cls
 
   ink 16777215,0
   linebox(275,1,290,479)
   line 275,13,290,13
   line 275,467,290,467
 
   ink 51200,0
   box 277,3,288,11
   box 277,469,288,477
 
   ink 16777215,0
   linetriangle(279,9,282,5,286,9)
   linetriangle(279,471,282,475,286,471)
 
   ink rgb(0,150,0),0
   line 320,45,620,45
 
   ink 16777215,0
   text 300,77,"Clip Board:"
   ink 51200,0
   linebox(377,77,635,93)
 
   ink rgb(0,150,0),0
   line 487,101,487,117
 
   ink 51200,0
   linebox(495,100,635,118)
 
   ink 16777215,0
   text 515,101,"Mouse effects"
 
   ink rgb(0,100,0),0
   box 500,104,510,114
   ink rgb(0,155,0),0
   line 500,104,510,104
   line 500,104,500,114
   ink 51200,0
   line 500,114,510,114
   line 510,104,510,114
 
   ink rgb(0,200,0),0
   linebox(300,184,453,201)
   ink 16777215,0
 
   ink rgb(0,100,0),0
   box 300,205,453,223
   ink rgb(0,200,0),0
   linebox(300,205,453,223)
   ink 16777215,0
   text 303,206,"Mouse Effects Mode: "
 
   clockx=580
   clocky=410
   ink rgb(0,150,0),0
   for i=0 to 360 step 30
      i#=i
      cosi#=cos(i#)
      sini#=sin(i#)
      x1=cosi#*45
      y1=sini#*45
      x2=cosi#*51
      y2=sini#*51
      line x1+clockx,y1+clocky,x2+clockx,y2+clocky
   next i
 
   ink 51200,0
   circle clockx,clocky,50
   circle clockx+1,clocky,50
   circle clockx,clocky+1,50
   circle clockx-1,clocky,50
   circle clockx,clocky-1,50
 
   get image 20,0,0,640,480
 
   cls
   bcolour=0
   lpbcolour=51200
   dpbcolour=rgb(0,120,0)
   rem ***Buttons***
   rem Width=100
   button(1,1,101,19,2,0,bcolour,lpbcolour,dpbcolour)
   button(1,25,101,43,2,1,bcolour,lpbcolour,dpbcolour)
   get image 21,1,1,102,20
   get image 22,1,25,102,44
   rem Width=81
   button(105,1,186,19,2,0,bcolour,lpbcolour,dpbcolour)
   button(105,25,186,43,2,1,bcolour,lpbcolour,dpbcolour)
   get image 23,105,1,187,20
   get image 24,105,25,187,44
   rem Width=80
   button(190,1,270,19,2,0,bcolour,lpbcolour,dpbcolour)
   button(190,25,270,43,2,1,bcolour,lpbcolour,dpbcolour)
   get image 25,190,1,271,20
   get image 26,190,25,271,44
   rem Width=75
   button(275,1,350,19,2,0,bcolour,lpbcolour,dpbcolour)
   button(275,25,350,43,2,1,bcolour,lpbcolour,dpbcolour)
   get image 27,275,1,351,20
   get image 28,275,25,351,44
   rem Width=55
   button(355,1,410,19,2,0,bcolour,lpbcolour,dpbcolour)
   button(355,25,410,43,2,1,bcolour,lpbcolour,dpbcolour)
   get image 29,355,1,411,20
   get image 30,355,25,411,44
   rem Width=50
   button(415,1,465,19,2,0,bcolour,lpbcolour,dpbcolour)
   button(415,25,465,43,2,1,bcolour,lpbcolour,dpbcolour)
   get image 31,415,1,466,20
   get image 32,415,25,466,44
   rem Width=116
   button(470,1,586,19,2,0,bcolour,lpbcolour,dpbcolour)
   button(470,25,586,43,2,1,bcolour,lpbcolour,dpbcolour)
   get image 33,470,1,587,20
   get image 34,470,25,587,44
 
   rem *****Bit*****
   bits=500
   dim bit(bits)
   dim bitx#(bits)
   dim bity#(bits)
   dim bitang#(bits)
   dim bitspeed#(bits)
   dim bitgrav#(bits)
   biton=1
 
   cls
 
return
 
ScanSortFiles:
 
   dim filename1$(10000)
   dim fileext1$(10000)
   dim filedate1$(10000)
   files=1
 
   if directory$="My Computer"
 
      perform checklist for drives
      for i=1 to checklist quantity()
         filename1$(i)=checklist string$(i)
         fileext1$(i)="Folder"
      next i
      files=checklist quantity()
 
   else
 
      find first
 
      repeat
 
         if get file type()<>-1 and get file name$()<>"" and get file name$()<>"." and get file name$()<>".."
            name$=get file name$()
            if get file type()=0
               dotplace=0
               for i=len(name$) to 1 step -1
                  if mid$(name$,i)="."
                     dotplace=i
                     exit
                  endif
               next i
               if dotplace>1
                  filename1$(files)=left$(name$,dotplace-1)
                  fileext1$(files)=lower$(right$(name$,len(name$)-dotplace))
                  filedate1$(files)=get file date$()
                  files=files+1
               endif
            else
               filename1$(files)=name$
               fileext1$(files)="Folder"
               filedate1$(files)=get file date$()
               files=files+1
            endif
         endif
         find next
 
      until get file type()=-1
 
      files=files-1
 
   endif
 
   dim filename$(10000)
   dim fileext$(10000)
   dim filedate$(10000)
   dim filesize(10000)
 
   Alphabetically Sort(files)
 
   for i=1 to files
      name$=filename$(i)+"."+fileext$(i)
      filesize(i)=file size(name$)
   next i
 
return
 
HandleInput:
 
   if upkey()=1 and file>1 or keystate(201)=1 and file>1
      if upK=0
         upK=1
         file=file-1
         if selected=1 and pageon>1 then pageon=pageon-1
         if selected>1 then selected=selected-1
         Ucount=40
      endif
      Ucount=Ucount-1
      if Ucount<0
         file=file-1
         if selected=1 and pageon>1 then pageon=pageon-1
         if selected>1 then selected=selected-1
         Ucount=2
      endif
   else
      upK=0
   endif
 
   if downkey()=1 and file<files or keystate(209)=1 and file<files
      if dnK=0
         dnK=1
         file=file+1
         if selected=32 and pageon<files then pageon=pageon+1
         if selected<32 then selected=selected+1
         Dcount=40
      endif
      Dcount=Dcount-1
      if Dcount<0
         file=file+1
         if selected=32 and pageon<files then pageon=pageon+1
         if selected<32 then selected=selected+1
         Dcount=2
      endif
   else
      dnK=0
   endif
 
   if mousemovez()>oldmousemovez and pageon>1
      file=file-5
      pageon=pageon-5
      selected=selected+5
      if file<1 then file=1
      if pageon<1 then pageon=1
      if selected>32 then selected=32
      oldmousemovez=mousemovez()
   endif
 
   if mousemovez()<oldmousemovez and pageon<pages
      file=file+5
      pageon=pageon+5
      selected=selected-5
      if file>files then file=files
      if pageon>pages then pageon=pages
      if selected<1 then selected=1
      oldmousemovez=mousemovez()
   endif
 
   if returnkey()=1 and decisionmadetime<1 then decision=2
 
   if mouseclick()=1 and sliderhold=0
 
      if mouseclick=0
         y1=sliderpos#+15
         y2=sliderpos#+slidersize#+15
         if mousewithin(277,y1,288,y2)=1
            sliderhold=1
            slideryoff=mousey()-(sliderpos#+15)
         endif
      endif
 
      if mouseclick=0 or clickonfile=1
         for i=1 to 32
            if mousewithin(2,i*15-15,273,i*15)=1
               filetemp=pageon+i-1
               if filetemp<=files
                  file=filetemp
                  if doubleclickcounta<=0
                     doubleclickcounta=20
                     dcfile=file
                  endif
                  selected=i
                  if doubleclickcountb>0 and dcfile=file then decision=2
                  clickonfile=1
               endif
            endif
         next i
      endif
 
      if clickonfile=1 and mousey()<2 and file>1
         file=file-1
         if selected=1 and pageon>1 then pageon=pageon-1
         if selected>1 then selected=selected-1
      endif
      if clickonfile=1 and mousey()>478 and file<files
         file=file+1
         if selected=32 and pageon<files then pageon=pageon+1
         if selected<32 then selected=selected+1
      endif
 
      if mousewithin(277,3,288,11)=1 and pageon>1 and clickonfile=0
         file=file-1
         pageon=pageon-1
         selected=selected+1
         if selected>32 then selected=32
      endif
      if mousewithin(277,469,288,477)=1 and pageon<pages and clickonfile=0
         file=file+1
         pageon=pageon+1
         selected=selected-1
         if selected<1 then selected=1
      endif
 
      if mousewithin(275,15,290,465)=1 and clickonfile=0
         if oldtbslide=0
            oldtbslide=1
            if mousey()<15+sliderpos#
               if pageon>32
                  file=file-32
                  pageon=pageon-32
                  blankclick=32
               else
                  if pageon=1
                     selected=1
                  endif
                  pageon=1
                  file=1
                  blankclick=10
               endif
               tslider=0
               tbslidecount=40
            endif
            if mousey()>15+sliderpos#+slidersize#
               if pageon<pages
                  file=file+32
                  pageon=pageon+32
                  if pageon>pages then pageon=pages
                  if file>files then file=files
                  blankclick=32
               else
                  pageon=pages
                  file=files
                  selected=32
                  blankclick=10
               endif
               bslider=0
               tbslidecount=40
            endif
         endif
         tbslidecount=tbslidecount-1
         if tbslidecount<0
            if mousey()<13+sliderpos#
               if pageon>32
                  file=file-32
                  pageon=pageon-32
                  blankclick=32
               else
                  if pageon=1
                     selected=1
                  endif
                  pageon=1
                  file=1
               endif
               tslider=0
               tbslidecount=5
            endif
            if mousey()>17+sliderpos#+slidersize#
               if pageon<pages
                  file=file+32
                  pageon=pageon+32
                  if pageon>pages then pageon=pages
                  if file>files then file=files
                  blankclick=32
               else
                  pageon=pages
                  file=files
                  selected=32
                  blankclick=10
               endif
               bslider=0
               tbslidecount=5
            endif
         endif
      else
         oldtbslide=0
      endif
 
      if mousewithin(300,18,400,38)=1
         parentpress=1
      else
         parentpress=0
      endif
 
      if mousewithin(405,18,455,38)=1 and backon>0
         backpress=1
      else
         backpress=0
      endif
 
      if mousewithin(460,18,515,38)=1 and forwardon>0
         forwardpress=1
      else
         forwardpress=0
      endif
 
      if mousewithin(520,18,639,38)=1 and extsup>0
         loadpress=1
      else
         loadpress=0
      endif
 
      if mousewithin(300,53,380,72)=1 and extsup<>6 and directoryimportant(directory$)=0
         copypress=1
      else
         copypress=0
      endif
 
      if mousewithin(385,53,465,72)=1 and extsup<>6 and directoryimportant(directory$)=0
         cutpress=1
      else
         cutpress=0
      endif
 
      if mousewithin(470,53,550,72)=1 and directoryimportant(directory$)=0 and clipboardfile$<>""
         pastepress=1
      else
         pastepress=0
      endif
 
      if mousewithin(555,53,635,72)=1 and directoryimportant(directory$)=0
         deletepress=1
      else
         deletepress=0
      endif
 
      if mousewithin(300,100,400,118)=1 and directoryimportant(directory$)=0
         newpress=1
      else
         newpress=0
      endif
 
      if mousewithin(405,100,480,118)=1 and directoryimportant(directory$)=0
         renamepress=1
      else
         renamepress=0
      endif
 
      if mousewithin(300,205,453,223) and mouseclick=0 or mousewithin(300,205,453,223) and mouseclick=1 and bitmodepress=1
         bitmodepress=1
      else
         bitmodepress=0
      endif
 
      if mouseclick=0 and mousewithin(495,100,635,118)
         if bitson=1 then bitson=0 else bitson=1
      endif
 
      mouseclick=1
 
   endif
   blankclick=blankclick-1
   doubleclickcounta=doubleclickcounta-1
   doubleclickcountb=doubleclickcountb-1
   if doubleclickcounta>0 and mouseclick()=0 and doubleclickcountb<=0 then doubleclickcountb=10
 
   if mouseclick()=0
 
      if mousewithin(300,18,400,38)=1 and parentpress=1
         parentgo=1
      else
         parentgo=0
      endif
      if mousewithin(405,18,455,38)=1 and backpress=1
         backgo=1
      else
         backgo=0
      endif
      if mousewithin(460,18,515,38)=1 and forwardpress=1
         forwardgo=1
      else
         forwardgo=0
      endif
      if mousewithin(520,18,639,38)=1 and loadpress=1
         decision=2
      endif
 
      if mousewithin(300,53,380,72)=1 and copypress=1 and extsup<>6 and directoryimportant(directory$)=0
         copygo=1
      else
         copygo=0
      endif
 
      if mousewithin(385,53,465,72)=1 and cutpress=1 and extsup<>6 and directoryimportant(directory$)=0
         cutgo=1
      else
         cutgo=0
      endif
 
      if mousewithin(470,53,550,72)=1 and pastepress=1 and directoryimportant(directory$)=0 and clipboardfile$<>""
         pastego=1
      else
         pastego=0
      endif
 
      if mousewithin(555,53,635,72)=1 and deletepress=1 and directoryimportant(directory$)=0
         deletego=1
      else
         deletego=0
      endif
 
      if mousewithin(300,100,400,118)=1 and newpress=1 and directoryimportant(directory$)=0
         newgo=1
      else
         newgo=0
      endif
 
      if mousewithin(405,100,480,118)=1 and renamepress=1 and directoryimportant(directory$)=0
         renamego=1
      else
         renamego=0
      endif
 
      if mousewithin(300,205,453,223)=1 and bitmodepress=1
         bitmode=bitmode+1
         if bitmode>maxbitmodes then bitmode=1
      endif
 
      mouseclick=0
      movebarhold=0
      clickonfile=0
      oldtbslide=0
      parentpress=0
      backpress=0
      forwardpress=0
      loadpress=0
      copypress=0
      cutpress=0
      deletepress=0
      pastepress=0
      newpress=0
      renamepress=0
      bitmodepress=0
   endif
 
   if mouseclick()<>1 then sliderhold=0
   if sliderhold=1
      oldpageon=pageon
      mosy1#=mousey()-15+slideryoff
      avilspace#=(450-slidersize#)
      if avilspace#<1 then avilspace#=1
      temp#=mosy1#/avilspace#
      pageon#=temp#*pages#
      pageon=pageon#
      if pageon<1 then pageon=1
      if pageon>pages then pageon=pages
      pageondiff=pageon-oldpageon
      selected=selected+(0-pageondiff)
      if selected<1 then selected=1
      if selected>32 then selected=32
   endif
 
   oldmousemovez=mousemovez()
 
   rem *****Bit*****
   if bitson=1
      if mouseclick()=1
         for i=1 to 2
            bit=availbit(bits)
            if bit=0
               bit=biton
               biton=biton+1
               if biton>bits then biton=1
            endif
            bit(bit)=1
            bitx#(bit)=mousex()
            bity#(bit)=mousey()
            bitang#(bit)=rnd(360)
            if bitmode=1 or bitmode=6 or bitmode=7
               bitspeed#(bit)=1
               bitgrav#(bit)=1
            endif
            if bitmode=2
               bitspeed#(bit)=rnd(9)+10
               bitgrav#(bit)=0.1
            endif
            if bitmode=3
               bitspeed#(bit)=rnd(100)
               bitspeed#(bit)=bitspeed#(bit)/100
               bitgrav#(bit)=0.00001
            endif
            if bitmode=4
               bitspeed#(bit)=0
               bitgrav#(bit)=0.00001
            endif
            if bitmode=5
               bitspeed#(bit)=1
               bitgrav#(bit)=-1
            endif
            if bitmode=8
               bitspeed#(bit)=1
               bitgrav#(bit)=0.0001
            endif
         next i
      endif
   endif
 
return
 
HandleVariables:
 
   pageon#=pageon
   files#=files
   pagestemp#=(pages#-1)
   if pagestemp#<1 then pagestemp#=1
   sliderpos#=(pageon#-1)/pagestemp#
   sliderpos#=sliderpos#*(450-slidersize#)
   if sliderpos#>450-slidersize# then sliderpos#=450-slidersize#
 
   decisionmadetime=decisionmadetime-1
 
   if file>files then file=files
 
   ext$=fileext$(file)
   extsup=0
   if ext$="bmp" or ext$="png" or ext$="jpg" or ext$="jpeg" then extsup=1
   if ext$="mp3" or ext$="wma" or ext$="wav" or ext$="xm" or ext$="mid" then extsup=2
   if ext$="avi" or ext$="wmv" or ext$="mpg" or ext$="mpeg" then extsup=3
   if ext$="x" or ext$="3ds" then extsup=4
   if ext$="txt" then extsup=5
   if ext$="Folder" then extsup=6
 
   rem *****Bit*****
   if bitson=1
      for i=1 to bits
         if bit(i)=1
            ang#=bitang#(i)
            bitx#(i)=bitx#(i)+cos(ang#)*bitspeed#(i)
            bity#(i)=bity#(i)+sin(ang#)*bitspeed#(i)
            bity#(i)=bity#(i)+bitgrav#(i)
            bitspeed#(i)=bitspeed#(i)*0.95
            bitgrav#(i)=bitgrav#(i)*1.09
            if bitmode=6 then bity#(i)=bity#(i)-10
            if bitmode=7 or bitmode=8
               bitx#(i)=bitx#(i)+(rnd(10)-5)
               bity#(i)=bity#(i)+(rnd(10)-5)
            endif
            if bity#(i)>480 then bit(i)=0
            if bity#(i)<-200 then bit(i)=0
         endif
      next i
   endif
 
return
 
HandleDisplay:
 
   paste image 20,0,0
 
   if files>0
      ink rgb(100,205,100),0
      box 2,selected*15-14,273,selected*15-1
   endif
 
   rem start
   ypos=1
   if files<32 then forto=files else forto=pageon+31
   ink 16777215,0
   for i=pageon to forto
      name$=filename$(i)
      ext$=fileext$(i)
      iconimg=17
      if ext$="bmp" or ext$="png" or ext$="jpg" or ext$="jpeg" then iconimg=11
      if ext$="mp3" or ext$="wma" or ext$="wav" or ext$="xm" or ext$="mid" then iconimg=12
      if ext$="avi" or ext$="wmv" or ext$="mpg" or ext$="mpeg" then iconimg=13
      if ext$="x" or ext$="3ds" then iconimg=14
      if ext$="txt" then iconimg=15
      if ext$="Folder" then iconimg=16
      if ypos<>selected
         if iconimg<>17
            if ext$="Folder"
               ink rgb(70,70,0),0
            else
               ink rgb(0,85,0),0
            endif
         else
            ink rgb(0,75,0),0
         endif
         box 2,ypos*15-14,273,ypos*15-1
         ink 16777215,0
      endif
      paste image iconimg,1,ypos*15-14,1
      text 25,ypos*15-15,shorten$(name$,200)
      text 225,ypos*15-15,shorten$(ext$,50)
      ypos=ypos+1
   next i
   remend
 
   box 277,sliderpos#+15,288,sliderpos#+slidersize#+15
 
   ink 51200,0
   if tslider=1 then box 277,15,288,sliderpos#+13
   if bslider=1 then box 277,sliderpos#+slidersize#+17,288,465
 
   ink 16777215,0
   if directory$<>"My Computer"
      shortdir$=shortenleft$(left$(directory$,len(directory$)-1),300)
      if shortdir$<>left$(directory$,len(directory$)-1) then shortdir$=left$(directory$,3)+"..."+shortdir$
   else
      shortdir$="My Computer"
   endif
   text 300,1,shortdir$
 
   bcolour=0
   lpbcolour=51200
   dpbcolour=rgb(0,120,0)
 
   paste image 21+parentpress,300,18
   ink 16777215,0
   center text 350+parentpress,19+parentpress,"Parent"
 
   paste image 31+backpress,405,18
   if backon>0 then ink 16777215,0 else ink 10197915,0
   center text 430+backpress,19+backpress,"Back"
 
   paste image 29+forwardpress,460,18
   if forwardon>0 then ink 16777215,0 else ink 10197915,0
   center text 488+forwardpress,19+forwardpress,"Forward"
 
   paste image 33+loadpress,520,18
   if extsup>0 then ink 16777215,0 else ink 10197915,0
   if extsup=6 then center text 578+loadpress,19+loadpress,"Open" else center text 580+loadpress,19+loadpress,"Load"
 
   paste image 25+copypress,300,53
   if extsup<>6 and directoryimportant(directory$)=0 then ink 16777215,0 else ink 10197915,0
   center text 340+copypress,54+copypress,"Copy"
 
   paste image 25+Cutpress,385,53
   if extsup<>6 and directoryimportant(directory$)=0 then ink 16777215,0 else ink 10197915,0
   center text 425+Cutpress,54+Cutpress,"Cut"
 
   paste image 25+Pastepress,470,53
   if clipboardfile$<>"" and directoryimportant(directory$)=0 then ink 16777215,0 else ink 10197915,0
   center text 510+Pastepress,54+Pastepress,"Paste"
 
   paste image 23+Deletepress,555,53
   if directoryimportant(directory$)=0 then ink 16777215,0 else ink 10197915,0
   center text 595+Deletepress,54+Deletepress,"Delete"
 
   paste image 21+newpress,300,100
   if directoryimportant(directory$)=0 then ink 16777215,0 else ink 10197915,0
   center text 350+newpress,101+newpress,"New Folder"
 
   paste image 27+renamepress,405,100
   if directoryimportant(directory$)=0 then ink 16777215,0 else ink 10197915,0
   center text 442+renamepress,101+renamepress,"Rename"
 
   ink 16777215,0
   text 379,77,shorten$(clipboardfile$,269)
 
   if bitson=1
      ink rgb(0,250,0),0
      line 501,109,505,113
      line 505,113,510,105
   endif
 
   if files>0
      ink 51200,0
      linebox(300,125,635,180)
      ink 16777215,0
      set text to bold
      if extsup=0
         paste image 17,305,130
      else
         paste image extsup+10,305,130
      endif
      if extsup=6 then name$=filename$(file) else name$=filename$(file)+"."+fileext$(file)
      text 330,130,name$
      set text to normal
      text 305,145,"Date: "+filedate$(file)
      text 305,160,"Size: "+memconvert$(filesize(file))
   else
      ink 51200,0
      linebox(300,125,635,145)
      ink 16777215,0
      text 305,127,"No Files to Display"
   endif
 
   text 301,185,"Frames per Second: "+str$(screen fps())
 
   text 440,206,str$(bitmode)
 
   rem start
   time$=get time$()
   hour$=left$(time$,2)
   minute$=mid$(time$,4)+mid$(time$,5)
   second$=right$(time$,2)
 
   hour#=val(hour$)
 
   minute#=val(minute$)
   second#=val(second$)
   if hour#>12 then hour#=hour#-12
   hour#=hour#+minute#/60
 
   hourang#=wrapvalue(hour#/12*360+270)
   minuteang#=wrapvalue(minute#/60*360+270)
   secondang#=wrapvalue(second#/60*360+270)
   hourx#=cos(hourang#)*30
   minutex#=cos(minuteang#)*40
   secondx#=cos(secondang#)*45
   houry#=sin(hourang#)*25
   minutey#=sin(minuteang#)*40
   secondy#=sin(secondang#)*45
 
   clockx=580
   clocky=410
 
   ink 65280,0
   line clockx,clocky,clockx+hourx#,clocky+houry#
   line clockx,clocky,clockx+minutex#,clocky+minutey#
 
   ink rgb(0,225,0),0
   line clockx,clocky,clockx+secondx#,clocky+secondy#
 
   date$=get date$()
   month=val(left$(date$,2))
   day=val(mid$(date$,4)+mid$(date$,5))
   year$=right$(date$,2)
   year=val(year$)
 
   dayext$="th"
   if day=1 then dayext$="st"
   if day=2 then dayext$="nd"
   if day=3 then dayext$="rd"
   properdate$=DayofWeek(day,month,year)+", "+str$(day)+dayext$+" "+month$(month)+", 20"+year$
 
   text 640-text width(properdate$),463,properdate$
   remend
 
   rem *****Bit*****
   if bitson=1
      ink 65280,0
      for i=1 to bits
         if bit(i)=1
            dot bitx#(i),bity#(i)
         endif
      next i
   endif
 
   get image 3,0,0,640,480
 
return
 
HandleDecision:
 
   if decision=2 and file<=files and decisionmadetime<1
 
      if fileext$(file)="Folder"
         backon=backon+1
         backlist$(backon)=directory$
         for i=1 to forwardon
            forwardlist$(i)=""
         next i
         forwardon=0
         if directory$="My Computer"
            directory$=filename$(file)+"\"
         else
            directory$=directory$+filename$(file)+"\"
         endif
         if len(directory$)=3 then dirtogo$=directory$ else dirtogo$=left$(directory$,len(directory$)-1)
         set dir dirtogo$
         undim filename1$(1000)
         undim fileext1$(1000)
         undim filename$(files)
         undim fileext$(files)
         gosub ScanSortFiles
         pageon=1
         pages=files-31
         if pages<1 then pages=1
         pages#=pages
         slidersize#=450*sqrt(1/pages#)
         if slidersize#<15 then slidersize#=15
         slidersize=slidersize#
         selected=1
         mouseclick=1
         clickonfile=0
      endif
 
      _Image:
      if extsup=1
 
         sync
 
         blur bitmap 0,1
         ink 0,0
         box 20,20,620,460
         ink 16777215,0
         linebox(20,20,620,460)
         get image 2,0,0,640,480
 
         load image filename$(file)+"."+fileext$(file),1
         paste image 2,0,0
         sprite 1,320,480,1
         set sprite 1,1,0
         scale sprite 1,100
 
         width#=sprite width(1)
         height#=sprite height(1)
         if width#<1 then width#=1
         if height#<1 then height#=1
         if width#/height#>1.45
            if width#>580
               scale sprite 1,580/width#*100
            endif
         else
            if height#>400
               scale sprite 1,400/height#*100
            endif
         endif
 
         sprite 1,320-sprite width(1)/2,230-sprite height(1)/2,1
 
         bcolour=0
         lpbcolour=51200
         dpbcolour=rgb(0,120,0)
         closepressed=0
         closego=0
         repeat
            if mouseclick()=1
               if mousewithin(560,440,618,458)=1
                  closepressed=1
               else
                  closepressed=0
               endif
            else
               if mousewithin(560,440,618,458)=1 and closepressed=1
                  closego=1
               else
                  closego=0
               endif
               closepressed=0
            endif
            paste image 2,0,0
            sprite 1,320-sprite width(1)/2,230-sprite height(1)/2,1
            button(558,438,616,456,2,closepressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            center text 586+closepressed,440+closepressed,"X Close"
            sync
         until closego=1
 
         delete image 1
         delete sprite 1
 
      endif
 
      _Music:
      if extsup=2
 
         paste image 3,0,0
         sync
 
         blur bitmap 0,1
         ink 0,0
         box 20,20,620,460
         ink 16777215,0
         linebox(20,20,620,460)
         get image 2,0,0,640,480
 
         load music filename$(file)+"."+fileext$(file),1
         paste image 2,0,0
 
         play music 1
         musicplay=1
 
         bcolour=0
         lpbcolour=51200
         dpbcolour=rgb(0,120,0)
         closepressed=0
         musicSpressed=0
         musicPpressed=0
         closego=0
         repeat
 
            paste image 2,0,0
 
            if mouseclick()=1
               if mousewithin(560,440,618,458)=1
                  closepressed=1
               else
                  closepressed=0
               endif
               if mousewithin(23,438,73,456)=1
                  musicPpressed=1
               else
                  musicPpressed=0
               endif
               if mousewithin(78,438,128,456)=1
                  musicSpressed=1
               else
                  musicSpressed=0
               endif
            else
               if mousewithin(560,440,618,458)=1 and closepressed=1
                  closego=1
               else
                  closego=0
               endif
               if mousewithin(23,438,73,456)=1 and musicPpressed=1
                  if musicPlay=1
                     pause music 1
                     musicPlay=0
                  else
                     if music paused(1)=1
                        resume music 1
                     else
                        play music 1
                        for i=1 to plaspoints
                           plaspoint#(i)=rnd(360)
                           if rnd(1)=1
                              plaspointp#(i)=rnd(0)+1
                           else
                              plaspointp#(i)=rnd(0)-1
                           endif
                           plaspointp#(i)=plaspointp#(i)/2
                           plaspointl(i)=rnd(1)+2
                        next i
 
                        for i=1 to plasspikes
                           plasspikeo#(i)=rnd(360)
                           if rnd(1)=1
                              plasspikem#(i)=rnd(0)+1
                           else
                              plasspikem#(i)=rnd(0)-1
                           endif
                           plasspikem#(i)=plasspikem#(i)/2
                           plasspikel(i)=rnd(10)+2
                        next i
                     endif
                     musicPlay=1
                  endif
               endif
               if mousewithin(78,438,128,456)=1 and musicSpressed=1
                  if music playing(1)=1
                    stop music 1
                    musicPlay=0
                  endif
               endif
               closepressed=0
               musicPpressed=0
               musicSpressed=0
            endif
 
            if music playing(1)=0 then musicPlay=0 : stop music 1
 
            if musicPlay=1
               for i=1 to plaspoints
                  plaspoint#(i)=wrapvalue(plaspoint#(i)+plaspointp#(i))
                  plaspointl(i)=plaspointl(i)-1
                  plaspointa(i)=0
                  if plaspointl(i)<=0
                     plaspoint#(i)=rnd(360)
                     if rnd(1)=1
                        plaspointp#(i)=rnd(0)+1
                     else
                        plaspointp#(i)=rnd(0)-1
                     endif
                     plaspointp#(i)=plaspointp#(i)/2
                     plaspointl(i)=rnd(100)+50
                  endif
               next i
 
               for i=1 to plasspikes
                  plasspikeo#(i)=wrapvalue(plasspikeo#(i)+plasspikem#(i))
                  plasspikel(i)=plasspikel(i)-1
                  if plasspikel(i)<=0
                     plasspikeo#(i)=rnd(360)
                     if rnd(1)=1
                        plasspikem#(i)=rnd(0)+1
                     else
                        plasspikem#(i)=rnd(0)-1
                     endif
                     plasspikem#(i)=plasspikem#(i)/2
                     plasspikel(i)=rnd(50)+50
                  endif
                  plasspikep(i)=0
                  points=0
                  for j=1 to plaspoints
                     for k=-360 to 360 step 360
                        angle#=plaspoint#(j)+k
                        if angle#>plasspikeo#(i)-25 and angle#<plasspikeo#(i)+25
                           points=points+1
                           plasspikej(i,points)=j
                           plaspointa(j)=1
                        endif
                     next k
                     print
                  next j
                  plasspikep(i)=points
               next i
 
               ink rgb(0,155,0),0
               circle 320,230,200
 
               ink 65280,0
               circle 320,230,50
 
               ink 65280,0
               for i=1 to plasspikes
                  if plasspikep(i)>0
                     angle1#=plasspikeo#(i)
                     x1#=cos(angle1#)*50+320
                     y1#=sin(angle1#)*50+230
                     x2#=cos(angle1#)*150+320
                     y2#=sin(angle1#)*150+230
                     electricline(x1#,y1#,x2#,y2#)
                     for j=1 to plasspikep(i)
                        thepoint=plasspikej(i,j)
                        angle2#=plaspoint#(thepoint)
                        x3#=cos(angle2#)*200+320
                        y3#=sin(angle2#)*200+230
                        electricline(x2#,y2#,x3#,y3#)
                     next j
                  endif
               next i
            else
               if oldmusicplay=1
                  ink rgb(0,155,0),0
                  circle 320,230,200
 
                  ink 65280,0
                  circle 320,230,50
 
                  ink 65280,0
                  for i=1 to plasspikes
                     if plasspikep(i)>0
                        angle1#=plasspikeo#(i)
                        x1#=cos(angle1#)*50+320
                        y1#=sin(angle1#)*50+230
                        x2#=cos(angle1#)*150+320
                        y2#=sin(angle1#)*150+230
                        electricline(x1#,y1#,x2#,y2#)
                        for j=1 to plasspikep(i)
                           thepoint=plasspikej(i,j)
                           angle2#=plaspoint#(thepoint)
                           x3#=cos(angle2#)*200+320
                           y3#=sin(angle2#)*200+230
                           electricline(x2#,y2#,x3#,y3#)
                        next j
                     endif
                  next i
                  get image 4,115,25,525,435
               else
                  paste image 4,115,25
               endif
            endif
 
            button(558,438,616,456,2,closepressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            center text 586+closepressed,440+closepressed,"X Close"
 
            button(23,438,73,456,2,musicPpressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            if musicPlay=1 then center text 48+musicPpressed,439+musicPpressed,"Pause" else center text 48+musicPpressed,439+musicPpressed,"Play"
 
            button(78,438,128,456,2,musicSpressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            center text 103+musicspressed,439+musicSpressed,"Stop"
 
            ink 16777215,0
            set cursor 0,0
 
            oldmusicplay=musicplay
 
            sync
 
         until closego=1
 
         delete music 1
 
      endif
 
      _Animation:
      if extsup=3
 
         paste image 3,0,0
         sync
 
         blur bitmap 0,1
         ink 0,0
         box 20,20,620,460
         ink 16777215,0
         linebox(20,20,620,460)
         get image 2,0,0,640,480
 
         load animation filename$(file)+"."+fileext$(file),1
         paste image 2,0,0
 
         width#=animation width(1)
         height#=animation height(1)
         scale#=100
         if width#/height#>1.45
            if width#>580
               scale#=580/width#*100
            endif
         else
            if height#>400
               scale#=400/height#*100
            endif
         endif
 
         width#=width#*(scale#/100)
         height#=height#*(scale#/100)
 
         play animation 1,320-width#/2,230-height#/2,320+width#/2,230+height#/2
         animplay=1
 
         bcolour=0
         lpbcolour=51200
         dpbcolour=rgb(0,120,0)
         closepressed=0
         animSpressed=0
         animApressed=0
         closego=0
         repeat
 
            if mouseclick()=1
               if mousewithin(560,440,618,458)=1
                  closepressed=1
               else
                  closepressed=0
               endif
               if mousewithin(23,438,73,456)=1
                  animPpressed=1
               else
                  animPpressed=0
               endif
               if mousewithin(78,438,128,456)=1
                  animSpressed=1
               else
                  animSpressed=0
               endif
            else
               if mousewithin(560,440,618,458)=1 and closepressed=1
                  closego=1
               else
                  closego=0
               endif
               if mousewithin(23,438,73,456)=1 and animPpressed=1
                  if animplay=1
                     pause animation 1
                     animplay=0
                  else
                     if animation paused(1)=1
                        resume animation 1
                     else
                        play animation 1
                     endif
                     animplay=1
                  endif
               endif
               if mousewithin(78,438,128,456)=1 and animSpressed=1
                  if animation playing(1)=1
                    stop animation 1
                    animplay=0
                  endif
               endif
               closepressed=0
               animPpressed=0
               animSpressed=0
            endif
 
            if animation playing(1)=0 then animplay=0
 
            ink 0,0
            box 21,436,618,458
 
            button(558,438,616,456,2,closepressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            center text 586+closepressed,440+closepressed,"X Close"
 
            button(23,438,73,456,2,animPpressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            if animplay=1 then center text 48+animPpressed,439+animPpressed,"Pause" else center text 48+animPpressed,439+animPpressed,"Play"
 
            button(78,438,128,456,2,animSpressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            center text 103+animApressed,439+animSpressed,"Stop"
 
            sync
 
         until closego=1
 
         delete animation 1
 
      endif
 
      _Object:
      if extsup=4
 
         cls
 
         backdrop on
         color backdrop rgb(0,100,0)
 
         load object filename$(file)+"."+fileext$(file),1
 
         scale#=100
 
         position object 1,0,0-object size y(1)*1,0
 
         if total object frames(1)>0 then loop object 1 : objanimated=1 : objplay=1 else objanimated=0
 
         scaleslidepos#=scale#/2
 
         bcolour=0
         lpbcolour=51200
         dpbcolour=rgb(0,120,0)
         closepressed=0
         objPpressed=0
         objSpressed=0
         closego=0
         repeat
 
            if mouseclick()=1
               if mousewithin(560,440,618,458)=1 and scaleslidehold=0
                  closepressed=1
               else
                  closepressed=0
               endif
               if mousewithin(23,438,73,456)=1 and scaleslidehold=0 and objanimated=1 and objplay=0
                  objPpressed=1
               else
                  objPpressed=0
               endif
               if mousewithin(78,438,128,456)=1 and scaleslidehold=0 and objanimated=1 and objplay=1
                  objSpressed=1
               else
                  objSpressed=0
               endif
               if mousewithin(135,437,550,457)=1
                  scaleslidehold=1
               endif
               if scaleslidehold=1
                  scaleslidepos#=mousex()-135
                  if scaleslidepos#<1 then scaleslidepos#=1
                  if scaleslidepos#>415 then scaleslidepos#=415
               endif
            else
               if mousewithin(560,440,618,458)=1 and closepressed=1
                  closego=1
               else
                  closego=0
               endif
               if mousewithin(23,438,73,456)=1 and objPpressed=1 and objanimated=1
                  if objplay=0
                     loop object 1
                     objplay=1
                  endif
               endif
               if mousewithin(78,438,128,456)=1 and objSpressed=1 and objanimated=1
                  if objplay=1
                    stop object 1
                    objplay=0
                  endif
               endif
               closepressed=0
               objPpressed=0
               objSpressed=0
               scaleslidehold=0
            endif
 
            scale#=scaleslidepos#*2
 
            scale object 1,scale#,scale#,scale#
            position object 1,0,0-(object size y(1)*(scale#/100))/2,0
            yrotate object 1,wrapvalue(object angle y(1)+1)
 
            ink 16777215,0
            linebox(20,435,619,459)
 
            ink 0,0
            box 21,436,618,458
 
            button(558,438,616,456,2,closepressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            center text 586+closepressed,440+closepressed,"X Close"
 
            button(23,438,73,456,2,objPpressed,bcolour,lpbcolour,dpbcolour)
            if objplay=1 then ink 10197915,0 else ink 16777215,0
            if objanimated=0 then ink 10197915,0
            center text 48+objPpressed,439+objPpressed,"Play"
 
            button(78,438,128,456,2,objSpressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            if objplay=0 then ink 10197915,0 else ink 16777215,0
            if objanimated=0 then ink 10197915,0
            center text 103+objApressed,439+objSpressed,"Pause"
 
            ink 16777215,0
            linebox(135,443,550,450)
 
            ink 0,0
            box scaleslidepos#+133,437,scaleslidepos#+137,457
 
            ink 16777215,0
            x1=scaleslidepos#+133
            x2=scaleslidepos#+137
            linebox(x1,437,x2,457)
 
            sync
 
         until closego=1
 
         delete object 1
         backdrop off
 
      endif
 
      _Text:
      if extsup=5
 
         paste image 3,0,0
         sync
 
         blur bitmap 0,1
         ink 0,0
         box 20,20,620,460
         ink 16777215,0
         linebox(20,20,620,460)
         get image 2,0,0,640,480
 
         dim line$(100000)
         maxlinesize=79
         open to read 1,filename$(file)+"."+fileext$(file)
         totalbytes=file size(filename$(file)+"."+fileext$(file))
         word$=""
         linesize=0
         lineon=1
         bytesread=0
 
         repeat
 
            read byte 1,ascii
            bytesread=bytesread+1
            if chr$(ascii)<>" " and ascii<>13 and ascii<>10 and ascii<>9
               word$=word$+chr$(ascii)
               wordthisline=1
               linesize=linesize+1
               if linesize=maxlinesize
                  if len(word$)=thislinemaxsize
                     line$(lineon)=line$(lineon)+left$(word$,thislinemaxsize-len(line$(lineon)))
                     lineon=lineon+1
                     thislinemaxsize=maxlinesize
                     word$=""
                     linesize=0
                     wordthisline=0
                  else
                     lineon=lineon+1
                     thislinemaxsize=maxlinesize
                     linesize=len(word$)
                     wordthisline=1
                  endif
               endif
            else
               if ascii=13 then entera=1
               if ascii=10 and entera=1
                  if linesize>maxlinesize
                     lineon=lineon+1
                     linesize=0
                     wordthisline=0
                  endif
                  line$(lineon)=line$(lineon)+word$
                  lineon=lineon+1
                  thislinemaxsize=maxlinesize
                  word$=""
                  linesize=0
                  wordthisline=0
               else
                  if ascii=9
                     linesizetemp=linesize
                     if linesizetemp>7
                        repeat
                           linesizetemp=linesizetemp-8
                        until linesizetemp<=7
                     endif
                     toadd=8-linesizetemp
                     if wordthisline=0
                        thislinemaxsize=thislinemaxsize-8
                     endif
                     linesize=linesize+toadd
                     if linesize>maxlinesize
                        lineon=lineon+1
                        thislinemaxsize=maxlinesize
                        linesize=len(word$)
                     endif
                     toaddstr$=""
                     for i=1 to toadd
                        toaddstr$=toaddstr$+" "
                     next i
                     line$(lineon)=line$(lineon)+word$+toaddstr$
                     word$=""
                  else
                     linesize=linesize+1
                     if wordthisline=0
                        thislinemaxsize=thislinemaxsize-1
                     endif
                     if linesize>maxlinesize
                        lineon=lineon+1
                        thislinemaxsize=maxlinesize
                        linesize=len(word$)
                        wordthisline=1
                     endif
                     line$(lineon)=line$(lineon)+word$+" "
                     word$=""
                  endif
               endif
               if ascii<>13 then entera=0
            endif
 
            if bytesread=totalbytes
               linesize=linesize+1
               if linesize>maxlinesize
                  lineon=lineon+1
                  thislinemaxsize=maxlinesize
                  linesize=len(word$)
                  wordthisline=1
               endif
               line$(lineon)=line$(lineon)+word$+" "
               word$=""
            endif
 
         until bytesread>totalbytes
 
         close file 1
 
         bcolour=0
         lpbcolour=51200
         dpbcolour=rgb(0,120,0)
         closepressed=0
         closego=0
 
         totallines=lineon
         textpageon=1
         textpages=totallines-26
         if textpages<1 then textpages=1
 
         tpages#=textpages
         temp#=(tpages#-1)/100
         if temp#>1 then temp#=1
         temp#=sqrt(1-temp#)
         tslidersize#=temp#*377
         if tslidersize#<15 then tslidersize#=15
         tslidersize=tslidersize#
         tsliderpos#=0
 
         ttslider=1
         tbslider=1
 
         repeat
 
            paste image 2,0,0
 
            ttslider=1
            tbslider=1
 
            if upkey()=1 and textpageon>1 or keystate(201)=1 and textpageon>1
               if tupK=0
                  tupK=1
                  textpageon=textpageon-1
                  tUcount=40
               endif
               tUcount=tUcount-1
               if tUcount<0
                  textpageon=textpageon-1
                  tUcount=2
               endif
            else
               tupK=0
            endif
 
            if downkey()=1 and textpageon<textpages or keystate(209)=1 and textpageon<textpages
               if tdnK=0
                  tdnK=1
                  textpageon=textpageon+1
                  tDcount=40
               endif
               tDcount=tDcount-1
               if tDcount<0
                  textpageon=textpageon+1
                  tDcount=2
               endif
            else
               tdnK=0
            endif
 
            if mousemovez()>oldmousemovez and textpageon>1
               textpageon=textpageon-5
               if textpageon<1 then textpageon=1
               oldmousemovez=mousemovez()
            endif
 
            if mousemovez()<oldmousemovez and textpageon<textpages
               textpageon=textpageon+5
               if textpageon>textpages then textageon=textpages
               oldmousemovez=mousemovez()
            endif
 
            if mouseclick()=1
 
               if mouseclick=0
                  y1=tsliderpos#+44
                  y2=tsliderpos#+tslidersize#+44
                  if mousewithin(594,y1,605,y2)=1
                     tsliderhold=1
                     tslideryoff=mousey()-(tsliderpos#+44)
                  endif
               endif
 
               if mousewithin(594,32,605,40)=1 and textpageon>1 and tsliderhold=0
                  textpageon=textpageon-1
               endif
               if mousewithin(594,425,605,433)=1 and textpageon<textpages and tsliderhold=0
                  textpageon=textpageon+1
               endif
 
               if mousewithin(560,440,618,458)=1 and tsliderhold=0
                  closepressed=1
               else
                  closepressed=0
               endif
 
               if mousewithin(592,30,607,435)=1 and tsliderhold=0
                  if toldtbslide=0
                     toldtbslide=1
                     if mousey()<44+tsliderpos#
                        if textpageon>26
                           textpageon=textpageon-26
                           tblankclick=26
                        else
                           textpageon=1
                           tblankclick=10
                        endif
                        ttslider=0
                        ttbslidecount=40
                     endif
                     if mousey()>44+tsliderpos#+tslidersize#
                        if textpageon<textpages
                           textpageon=textpageon+32
                           if textpageon>textpages then textpageon=textpages
                           tblankclick=32
                        else
                           textpageon=textpages
                           tblankclick=10
                        endif
                        tbslider=0
                        ttbslidecount=40
                     endif
                  endif
                  ttbslidecount=ttbslidecount-1
                  if ttbslidecount<0
                     if mousey()<44+tsliderpos#
                        if textpageon>32
                           textpageon=textpageon-32
                           tblankclick=32
                        else
                           textpageon=1
                        endif
                        ttslider=0
                        ttbslidecount=5
                     endif
                     if mousey()>44+tsliderpos#+tslidersize#
                        if textpageon<textpages
                           textpageon=textpageon+32
                           if textpageon>textpages then textpageon=textpages
                           tblankclick=32
                        else
                           textpageon=textpages
                           tblankclick=10
                        endif
                        tbslider=0
                        ttbslidecount=5
                     endif
                  endif
               endif
 
               mouseclick=1
 
            else
 
               if mousewithin(560,440,618,458)=1 and closepressed=1
                  closego=1
               else
                  closego=0
               endif
 
               closepressed=0
               mouseclick=0
 
            endif
 
            if mouseclick()<>1 then tsliderhold=0
            if tsliderhold=1
               textpages#=textpages
               mosy1#=mousey()-44+tslideryoff
               avilspace#=(377-tslidersize#)
               if avilspace#<1 then avilspace#=1
               temp#=mosy1#/avilspace#
               textpageon#=temp#*textpages#
               textpageon=textpageon#
               if textpageon<1 then textpageon=1
               if textpageon>textpages then textpageon=textpages
            endif
 
            oldmousemovez=mousemovez()
 
            tpageon#=textpageon
            tpagestemp#=(tpages#-1)
            if tpagestemp#<1 then tpagestemp#=1
            tsliderpos#=(tpageon#-1)/tpagestemp#
            tsliderpos#=tsliderpos#*(377-tslidersize#)
            if tsliderpos#>377-tslidersize# then tsliderpos#=377-tslidersize#
 
            ink 16777215,0
            linebox(30,30,590,435)
 
            forto=textpageon+26
            if forto>totallines then forto=totallines
            ypos=1
            for i=textpageon to forto
               text 32,ypos*15+15,line$(i)
               ypos=ypos+1
            next i
            set cursor 0,0
 
            ink 16777215,0
            linebox(592,30,607,435)
            line 592,42,607,42
            line 592,423,607,423
 
            box 594,tsliderpos#+44,605,tsliderpos#+tslidersize#+44
 
            ink 51200,0
            if ttslider=1 then box 594,44,605,tsliderpos#+42
            if tbslider=1 then box 594,tsliderpos#+tslidersize#+46,605,421
 
            box 594,32,605,40
            box 594,425,605,433
 
            ink 16777215,0
            linetriangle(596,38,599,35,603,38)
            linetriangle(596,427,599,431,603,427)
 
            button(558,438,616,456,2,closepressed,bcolour,lpbcolour,dpbcolour)
            ink 16777215,0
            center text 586+closepressed,440+closepressed,"X Close"
 
            sync
 
         until closego=1
 
         undim line$(1000)
 
      endif
 
      decisionmadetime=10
 
   endif
   decision=0
 
   if parentgo=1 and decisionmadetime<1
      backon=backon+1
      backlist$(backon)=directory$
      for i=1 to forwardon
         forwardlist$(i)=""
      next i
      forwardon=0
      directory$=parentfolder$(directory$)
      if directory$=""
         directory$="My Computer"
      else
         if len(directory$)=3 then dirtogo$=directory$ else dirtogo$=left$(directory$,len(directory$)-1)
         set dir dirtogo$
      endif
      undim filename1$(1000)
      undim fileext1$(1000)
      undim filedate1$(1000)
      undim filename$(files)
      undim fileext$(files)
      undim filedate$(1000)
      undim filesize(10000)
      gosub ScanSortFiles
      pageon=1
      pages=files-31
      if pages<1 then pages=1
      pages#=pages
      slidersize#=450*sqrt(1/pages#)
      if slidersize#<15 then slidersize#=15
      slidersize=slidersize#
      selected=1
      decisionmadetime=10
      decision=0
      mouseclick=1
      clickonfile=0
   endif
 
   if backgo=1 and decisionmadetime<1 and backon>0
      forwardon=forwardon+1
      forwardlist$(forwardon)=directory$
      directory$=backlist$(backon)
      backon=backon-1
      if directory$<>"My Computer"
         if len(directory$)=3 then dirtogo$=directory$ else dirtogo$=left$(directory$,len(directory$)-1)
         set dir dirtogo$
      endif
      undim filename1$(1000)
      undim fileext1$(1000)
      undim filedate1$(1000)
      undim filename$(files)
      undim fileext$(files)
      undim filedate$(1000)
      undim filesize(10000)
      gosub ScanSortFiles
      pageon=1
      pages=files-31
      if pages<1 then pages=1
      pages#=pages
      slidersize#=450*sqrt(1/pages#)
      if slidersize#<15 then slidersize#=15
      slidersize=slidersize#
      selected=1
      decisionmadetime=10
      decision=0
      mouseclick=1
      clickonfile=0
   endif
 
   if forwardgo=1 and decisionmadetime<1 and forwardon>0
      backon=backon+1
      backlist$(backon)=directory$
      directory$=forwardlist$(forwardon)
      forwardon=forwardon-1
      if directory$<>"My Computer"
         if len(directory$)=3 then dirtogo$=directory$ else dirtogo$=left$(directory$,len(directory$)-1)
         set dir dirtogo$
      endif
      undim filename1$(1000)
      undim fileext1$(1000)
      undim filedate1$(1000)
      undim filename$(files)
      undim fileext$(files)
      undim filedate$(1000)
      undim filesize(10000)
      gosub ScanSortFiles
      pageon=1
      pages=files-31
      if pages<1 then pages=1
      pages#=pages
      slidersize#=450*sqrt(1/pages#)
      if slidersize#<15 then slidersize#=15
      slidersize=slidersize#
      selected=1
      decisionmadetime=10
      decision=0
      mouseclick=1
      clickonfile=0
   endif
 
   _CopyCutPaste:
 
   if copygo=1 and extsup<>6 and directoryimportant(directory$)=0
      clipboardfile$=filename$(file)+"."+fileext$(file)
      clipboarddir$=directory$+filename$(file)+"."+fileext$(file)
      clipboarddirec$=directory$
      clipboardext$=fileext$(file)
      clipboardname$=filename$(file)
      clipboarddate$=filedate$(file)
      clipboardsize=filesize(file)
      copycut=1
   endif
 
   if cutgo=1 and extsup<>6 and directoryimportant(directory$)=0
      clipboardfile$=filename$(file)+"."+fileext$(file)
      clipboarddir$=directory$+filename$(file)+"."+fileext$(file)
      clipboarddirec$=directory$
      clipboardext$=fileext$(file)
      clipboardname$=filename$(file)
      clipboarddate$=filedate$(file)
      clipboardsize=filesize(file)
      copycut=2
   endif
 
   if pastego=1 and directoryimportant(directory$)=0 and clipboardfile$<>""
      copycuted=0
      if directory$<>"My Computer" and clipboardfile$<>""
         if copycut=1
            newfilename$=""
            if file exist(directory$+clipboardfile$)=1
               exten$="."+clipboardext$
               if file exist(directory$+clipboardname$+" copy"+exten$)=1
                  for i=2 to 100
                     temp$=clipboardname$
                     temp$=temp$+" copy ("
                     temp$=temp$+str$(i)
                     temp$=temp$+")"
                     temp2$=temp$+exten$
                     temp2$=directory$+temp2$
                     if file exist(temp2$)=0
                        newfilename$=temp2$
                        filename$=temp$
                        exit
                     endif
                  next i
               else
                  newfilename$=directory$+clipboardname$+" copy"+exten$
                  filename$=clipboardname$+" copy"
               endif
            else
               newfilename$=directory$+clipboardfile$
               filename$=clipboardname$
            endif
            copy file clipboarddir$,newfilename$
            copycuted=1
         else
            if directory$<>clipboarddirec$
               if file exist(directory$+clipboardfile$)=0
                  move file clipboarddir$,directory$+clipboardfile$
                  clipboardfile$=""
                  copycuted=1
                  filename$=clipboardname$
               else
                  for i=1 to files
                     if filename$(i)=clipboardname$ then filenumber=i : exit
                  next i
                  blur bitmap 0,1
                  get image 2,0,0,640,480
                  replacex=150
                  replacey=140
                  yespressed=0
                  nopressed=0
                  mabyepressed=0
                  yesgo=0
                  nogo=0
                  mabyego=0
                  bcolour=0
                  lpbcolour=51200
                  dpbcolour=rgb(0,120,0)
                  repeat
 
                     paste image 2,0,0
 
                     if mouseclick()=1
                        if mousewithin(replacex+5,replacey+155,replacex+100,replacey+173)=1
                           yespressed=1
                        else
                           yespressed=0
                        endif
                        if mousewithin(replacex+105,replacey+155,replacex+200,replacey+173)=1
                           nopressed=1
                        else
                           nopressed=0
                        endif
                        if mousewithin(replacex+205,replacey+155,replacex+300,replacey+173)=1
                           mabyepressed=1
                        else
                           mabyepressed=0
                        endif
                     else
                        if mousewithin(replacex+5,replacey+155,replacex+100,replacey+173)=1 and yespressed=1
                           yesgo=1
                        else
                           yesgo=0
                        endif
                        if mousewithin(replacex+105,replacey+155,replacex+200,replacey+173)=1 and nopressed=1
                           nogo=1
                        else
                           nogo=0
                        endif
                        if mousewithin(replacex+205,replacey+155,replacex+300,replacey+173)=1 and mabyepressed=1
                           mabyego=1
                        else
                           mabyego=0
                        endif
                        yespressed=0
                        nopressed=0
                        mabyepressed=0
                     endif
 
                     messagebox(replacex,replacey,replacex+305,replacey+178,"Replace?")
 
                     text replacex+3,replacey+23,"Are you sure you want to replace"
                     text replacex+12,replacey+53,"Date: "+filedate$(filenumber)
                     text replacex+12,replacey+68,"Size: "+str$(filesize(filenumber))+" bytes"
                     text replacex+3,replacey+90,"With"
                     text replacex+12,replacey+120,"Date: "+clipboarddate$
                     text replacex+12,replacey+135,"Size: "+str$(clipboardsize)+" bytes"
                     set text to bold
                     text replacex+12,replacey+38,clipboardfile$
                     text replacex+12,replacey+105,clipboardfile$
                     set text to normal
 
                     button(replacex+5,replacey+155,replacex+100,replacey+173,2,yespressed,bcolour,lpbcolour,dpbcolour)
                     ink 16777215,0
                     center text replacex+52+yespressed,replacey+156+yespressed,"Yes"
                     button(replacex+105,replacey+155,replacex+200,replace