// JavaScript by Timothy Edwards, for Can2Can, copyright Can2Can, 1998, all rights reserved.
// A news ticker animation, Bajoran glyphs tick up.

// the semi-constants, named to avoid magic numbers inside code.
// one greater than the highest character image band number
var c2ConBajGlyphBands = 33
// the number of the last entry in ticktxt[]
var c2ConBajGlyphCharCount = 58
// the size of the display in bands
var c2ConBajGlyphRows = 20

// the pictures of character bands, four bands per character, added in order of use.
var c2BajGlyphBand = new Array()
for (var i = 0; i < c2ConBajGlyphBands; i++){
   c2BajGlyphBand[i] = new Image()
   c2BajGlyphBand[i].src = "tickt" + i + ".gif"
}

// the text to be ticked up the news ticker screen, as pointers into btick[]
// zero is a blank white space, each char is four slices.
var c2BajGlyphScrollText = new Array("1","2","3","4","0","5","6","7","8","0","9","10","11","12","0","13","14","15","16","0","17","18","19","20","0","0","0","21","22","23","24","0","5","6","7","8","0","25","26","27","28","0","29","30","31","32","0","17","18","19","20","0","13","14","15","16","0","0","0")

function c2subBajGlyphScrollUp(){
// certify a good pointer to the images
  var vBGTop = 0
  {c2cGlyphTickerPoint = vBGTop}
  for ( vLoopInt = 0; vLoopInt < document.images.length; vLoopInt++){
  if (document.images[vLoopInt].name == "c2BajGlyphNews") {c2cGlyphTickerPoint = vBGTop}
  vBGTop++ }
  if (c2cGlyphTickerPoint == 0) return 0

// then, barrel roll the pointer array
var vTempChar = c2BajGlyphScrollText[0]
for (var vLoopInt = 0; vLoopInt < c2ConBajGlyphCharCount; vLoopInt++){
   c2BajGlyphScrollText[vLoopInt] = c2BajGlyphScrollText[vLoopInt+1]
   }
c2BajGlyphScrollText[c2ConBajGlyphCharCount] = vTempChar


// then use the array to rewrite the display
for (var vLoopInt = 0; vLoopInt < c2ConBajGlyphRows; vLoopInt++){
    document.images[c2cGlyphTickerPoint+vLoopInt].src=c2BajGlyphBand[c2BajGlyphScrollText[vLoopInt]].src
   }
return 0
}

//  for layout reasons, the first and last slices are created explicit.
function c2subDrawBajGlyphTicker() {
  var grt = unescape("%3e")
  document.write('<IMG SRC="tickred.gif" HEIGHT=4 WIDTH=35' + grt)
  document.write('<IMG SRC="ticktop.gif" HEIGHT=4 WIDTH=35' + grt)
  document.write('<IMG SRC="' + c2BajGlyphBand[1].src + '" NAME=c2BajGlyphNews HEIGHT=4 WIDTH=35' + grt)
  for (var vLoopInt = 1; vLoopInt < c2ConBajGlyphRows; vLoopInt++){
    var vSliceInt = c2BajGlyphScrollText[vLoopInt]
    document.write('<IMG SRC="' + c2BajGlyphBand[vSliceInt].src + '" HEIGHT=4 WIDTH=35' + grt)
    }
  document.write('<IMG SRC="tickbot.gif" HEIGHT=4 WIDTH=35' + grt)
  document.write('<IMG SRC="tickred.gif" HEIGHT=4 WIDTH=35' + grt)
}
