<!-- RANDOM -->
if (navigator.appName != "Microsoft Internet Explorer")
   window.location='netscape/index.html'

// the_duration = 0.3
count          = 0
default_target = 0
delay          = 0.3
keepmoving     = 0
newsquare      = 0
thesquare      = 0
mouse_over     = 0
the_object     = 0
bgAudioEnabled = 0
t1 = t2        = 0
testModeEnabled= 1
prefix = 'http://'

theDivDefaultCode  = '<font color="#bbbbbb" style="cursor:hand" onMouseOver="highlight()" onMouseOut="highlight()" onClick="javascript:Start()">enable</font> <font color="#CCD9E5">audio</font> <font color="#aaaaaa">|</font> <font color="#bbbbbb" style="cursor:hand" onMouseOver="highlight()" onMouseOut="highlight()" onClick="readMe()">readMe</font>'
killBgAudioCode    = ' <font color="#aaaaaa">|</font> <font color="#bbbbbb" onMouseOver="highlight()" onMouseOut="highlight()" onClick="startBackgroundAudio()" style="cursor:hand">switch</font><font color="#aaaaaa">/</font><font color="#bbbbbb" onMouseOver="highlight()" onMouseOut="highlight()" onClick="killBackgroundAudio()" style="cursor:hand">kill</font><font color="#CCD9E5"> bg audio</font> <font color="#aaaaaa">| '
defaultSoundScheme = new Array('<embed src="audio/default_drag.wav" name="drag" loop="true" showdisplay="false" showControls="false" autoplay="false" autorewind="true" hidden="true"></embed>','<embed src="audio/default_close.wav" name="close" loop="false" showdisplay="false" autoplay="false" autorewind="true" hidden="true"></embed>','<embed src="audio/default_open.wav" name="open" loop="false" showdisplay="false" autoplay="false" autorewind="true" hidden="true"></embed>','<embed src="audio/resize.wav" name="resizeSound" loop="false" showdisplay="false" autoplay="false" autorewind="true" hidden="true"></embed>')
cartoonSoundScheme = new Array('<embed src="audio/cartoon_drag.wav" name="drag" loop="true" showdisplay="false" showControls="false" autoplay="false" autorewind="true" hidden="true"></embed>','<embed src="audio/cartoon_close.wav" name="close" loop="false" showdisplay="false" autoplay="false" autorewind="true" hidden="true"></embed>','<embed src="audio/cartoon_open.wav" name="open" loop="false" showdisplay="false" autoplay="false" autorewind="true" hidden="true"></embed>','<embed src="audio/resize.wav" name="resizeSound" loop="false" showdisplay="false" autoplay="false" autorewind="true" hidden="true"></embed>')
enableBgAudioCode  = ' <font color="#aaaaaa">|</font> <font color="#bbbbbb" style="cursor:hand" onMouseOver="highlight()" onMouseOut="highlight()" onClick="startBackgroundAudio()">b/g audio</font> <font color="#aaaaaa">|</font>'
sound0Code         = '<embed src="audio/default_drag.wav" name="drag" loop="true" showdisplay="false" showcontrols="false" autoplay="false" autorewind="true" hidden="true"></embed>'
sound1Code         = '<embed src="audio/default_close.wav" name="close" loop="false" showdisplay="false" showcontrols="false" autoplay="false" autorewind="true" hidden="true"></embed>'
sound2Code         = '<embed src="audio/default_open.wav" name="open" loop="false" showdisplay="false" showcontrols="false" autoplay="false" autorewind="true" hidden="true"></embed>'
sound3Code         = '<embed src="audio/resize.wav" name="resizeSound" loop="false" showdisplay="false" showcontrols="false" autoplay="false" autorewind="true" hidden="true"></embed>'

squares = new Array()
for (i=0; i<46; i++) {
   squares[i] = 'square' + (i+1)
}

function initArray() {
   this.length = initArray.arguments.length;
   for (var i = 0; i < this.length; i++)
      this[i] = initArray.arguments[i];
}

/*

var pics = new initArray(
"images/06_1.gif",
"images/14_1.gif",
"images/22_1.gif",
"images/26_1.gif",
"images/28_1.gif",
"images/32_1.gif",
"images/46_1.gif",
"images/60_1.gif",
"images/84_1.gif",
"images/about_on.gif",
"images/close_on.gif",
"images/demo_red.gif",
"images/launch_red.gif",
"images/none_red.gif",
"images/off_red.gif",
"images/on_red.gif",
"images/readme_red.gif",
"images/reset_red.gif",
"images/set_red.gif",
"images/square_small.gif",
"images/to_ends_red.gif",
"images/to_left_red.gif",
"images/to_middle_red.gif",
"images/to_right_red.gif",
"images/x_on.gif",
"images/x_red.gif",
"images/site_basics.gif",
"images/gravity_basics.gif",
"images/adv_gravity.gif",
"images/about_audio.gif",
"images/about_gravity.gif",
"images/radio_1.gif",
"tabs/mess_it_up_1.gif",
"tabs/openimg_0_0.gif",
"tabs/openimg_0_1.gif",
"tabs/openimg_1_0.gif",
"tabs/openimg_1_1.gif",
"tabs/openmain_0_0.gif",
"tabs/openmain_0_1.gif",
"tabs/openmain_1_0.gif",
"tabs/openmain_1_1.gif")

img = new Array()
for (i=0; i<pics.length; i++) {
   img[i]=new Image()
   img[i].src=pics[i]
}

desktopImages = new Array(
"pictures/schill_table.jpg",
"pictures/desktop_0.jpg",
"pictures/desktop_1.jpg",
"pictures/desktop_2.jpg",
"pictures/desktop_3.jpg",
"pictures/desktop_4.jpg",
"pictures/desktop_5.jpg",
"pictures/bus_summer2k.gif",
"pictures/typing_sequence.gif")

numberOfAnimations = 2   // for random purposes (and preloading)

dpics = new Array()
for (i=0; i<desktopImages.length-numberOfAnimations; i++) {
   dpics[i]=new Image()
   dpics[i].src=desktopImages[i]
}

function FadeTo(target, src_new, the_duration) {
   if (document[target]) {
      if (document[target].filters.blendTrans.status == 0) {
         if (the_duration)
            delay=the_duration;
         document[target].filters.blendTrans.duration = delay;
         document[target].filters.blendTrans.Apply()
         document[target].src = src_new
         document[target].filters.blendTrans.Play()
      }
   }
}

*/

bgAudioArray = new Array(
// "audio/nike.wav",
"audio/nova.wav",
"audio/nova_old.wav",
"audio/nova_short.wav",
"audio/nova-nosax.wav",
"audio/nova-piano.wav",
"audio/apology.wav",
"audio/skulls.wav")

function SetMoveImage() {
   if (keepmoving == 0) {
      keepmoving = 1
      mouse_over = 1
      Random_Weirdness()
   }
   else {
      keepmoving = 1
      mouse_over = 1
   }
   MoveImage()
}

function MoveImage() {
   count++
   if (count == 15 || count == -1) {
      the_object = squares [(Math.floor(Math.random()*46))] // get a random square ID
      count = 0
   }
      SetImagePosition(the_object)
   if (keepmoving == 1)
      setTimeout("MoveImage()",0,"Javascript");
}  

function SetImagePosition(some_object) {
   
   left_value = (Math.floor(Math.random()*11)) - (Math.floor(Math.random()*10)) // do not let square move off-screen (left)
   if (document[some_object])
   document[some_object].style.pixelLeft += left_value;
   top_value = (Math.floor(Math.random()*10)) - (Math.floor(Math.random()*10)) // do not let square move off-screen (top)
   if (document[some_object])
   document[some_object].style.pixelTop -= top_value;
//   square_status.innerHTML = 't: ' + document[some_object].style.posTop + ' | l: ' + document[some_object].style.pixelLeft
}

function FxckItUpGood() {
   for (i=0; i<46; i++) {
      tmp_object = squares[i]
      if (document[tmp_object].style.position == "relative")
         document[tmp_object].style.position = "absolute"; // set absolute values if not already
      document[tmp_object].style.pixelLeft = (Math.floor(Math.random()*screen.availWidth *.95))
      document[tmp_object].style.pixelTop = (Math.floor(Math.random()*screen.availHeight *.85))
   }
}

function getrandomBgAudio() {
   tmpIndex = (Math.floor(Math.random()*bgAudioArray.length))
   audioSource = bgAudioArray[tmpIndex]
}

function SetTarget(the_target, the_first_source, the_second_source) {
   if (the_target != default_target) {
      default_target = the_target
      default_first_source = the_first_source
      default_second_source = the_second_source
   }
   if (document[default_target]) // if this exists..
      Animate(default_target, default_first_source, default_second_source);
}
    
function Animate(target, src_from, src_to) {
   if (mouse_over == 1) {
      FadeTo(target, src_to, '')
      setTimeout("FadeTo(default_target, default_first_source,\'\')",300,"javascript")
      setTimeout("Animate(default_target, default_first_source, default_second_source)",700,"javascript");
   }
   else { // otherwise 'reset'
      FadeTo(default_target, default_first_source,0.3);
   }
}

function StartSound(target) {
   soundActive = 1
   if (!document[target].HasError && (document[target].readyState == 'complete') )
      document[target].play();
}

function StopSound(target) {
   if (soundActive) {
      soundActive = 0
      document[target].stop()
   }
}

function PauseSound(target) {
   if (dragapproved) {
      if (currentWindow == 'main') {
         if (oldPositionX == mainWindow.style.pixelLeft && oldPositionY == mainWindow.style.pixelTop) {
            soundActive = 0
            if (!document[target].HasError)
               document[target].pause();
         }
      }
      else if (currentWindow == 'menu') {
         if (oldPositionX == menuWindow.style.pixelLeft && oldPositionY == menuWindow.style.pixelTop) {
            soundActive = 0
            if (!document[target].HasError)
               document[target].pause();
         }
      }
      else if (currentWindow == 'news') {
         if (oldPositionX == newsTable.style.pixelLeft && oldPositionY == newsTable.style.pixelTop) {
            soundActive = 0
            if (!document[target].HasError)
               document[target].pause();
         }
      }
   }
}

function PlaySound(target) {
   if (soundEnabled && document[target]) {
      if (!document[target].HasError)
         document[target].play();
      else
         test.innerHTML = 'Warning: ' + document[target].ErrorDescription;
   }
}

function setPlaybackRate(target, theRate) {
   document[target].Rate = thePitch; // set pitch
}

function Initialize() {
   soundEnabled = 1
   sound0.innerHTML = sound0Code
   sound1.innerHTML = sound1Code
   sound2.innerHTML = sound2Code
   sound3.innerHTML = sound3Code
}

function Start() {
   setTimeout("Initialize();refreshAudioControls()",300,"Javascript")
}

function setSoundScheme(scheme) {
   // default/cartoon
   sound0.innerHTML = scheme[0]
   sound1.innerHTML = scheme[1]
   sound2.innerHTML = scheme[2]
   sound3.innerHTML = scheme[3]
}

function readMe() {
theDiv.innerHTML = '<br><table border=1 width="340" cellpadding=5 cellspacing=0 bgcolor="#336699" bordercolor="#cccccc"><td><div align="justify"><font color="#bbccdd">Unfortunately, the methods available to <a href="javascript:testSoundHardware()" title="warning - may cause JS error.." onClick="this.blur()">detect</a> sound hardware seem to be somewhat error-prone under IE4+ browsers. I\'ve found with some cases that "hardware checking" causes Javascript errors on some machines, perhaps because the sound hardware itself doesn\'t exist in some cases. (Other causes: sound card is "busy", being used by another [non-directSound] application.)<br><br>Either way, I hope to get this figured out so that the audio does not have to be enabled every time the page is visited (particularly for convenience\'s sake). For now however, just ensure that the following conditions are met:<br><br><li>Sound hardware is installed</li><li>Sound hardware is not being used by another process</li><br>This will make your browsing experience here all the more enjoyable! :]<br><br>-Schill</font></div></td></table><br><font color="#bbbbbb" style="cursor:hand" onMouseOver="highlight()" onMouseOut="highlight()" onClick="resetReadMe()">&#171 back</font><br><br>'
}

function resetReadMe() {
theDiv.innerHTML=theDivDefaultCode
}

function testSoundHardware() {
   alert('sound card enabled: ' + document.embeds[0].IsSoundCardEnabled())
}

function startBackgroundAudio() {
   if (!bgAudioEnabled)
      bgAudioEnabled = 1;
   refreshAudioControls();
   getrandomBgAudio()
   backgroundAudioDiv.innerHTML = '<embed src="' + audioSource + '" id="backgroundAudio" name="loop" autoplay="true" loop="true" hidden="true"></embed>'
   backgroundAudio.Volume = -500
}

function killBackgroundAudio() {
   if (bgAudioEnabled) {
      bgAudioEnabled = 0
      refreshAudioControls()
   }
   backgroundAudioDiv.innerHTML = ''
}

function refreshAudioControls() {
   if (soundEnabled) {
      if (bgAudioEnabled)
         theDiv.innerHTML = '<font color="#CCD9E5">sound scheme:</font> <font color="#bbbbbb" onMouseOver="highlight()" onMouseOut="highlight()" onClick="setSoundScheme(defaultSoundScheme)" style="cursor:hand" title="this is the default sound window sound scheme. (the sounds are applied to window actions, eg. moving, opening and closing).">default</font> <font color="#aaaaaa">|</font> <font color="#bbbbbb" onMouseOver="highlight()" onMouseOut="highlight()" onClick="setSoundScheme(cartoonSoundScheme)" style="cursor:hand" title="this is the cartoon sound window sound scheme. (the sounds are applied to window actions, eg. moving, opening and closing).">cartoon</font>' + killBgAudioCode;
      else
         theDiv.innerHTML = '<font color="#CCD9E5">sound scheme:</font> <font color="#bbbbbb" onMouseOver="highlight()" onMouseOut="highlight()" onClick="setSoundScheme(defaultSoundScheme)" style="cursor:hand" title="this is the default sound window sound scheme. (the sounds are applied to window actions, eg. moving, opening and closing).">default</font> <font color="#aaaaaa">|</font> <font color="#bbbbbb" onMouseOver="highlight()" onMouseOut="highlight()" onClick="setSoundScheme(cartoonSoundScheme)" style="cursor:hand" title="this is the cartoon sound window sound scheme. (the sounds are applied to window actions, eg. moving, opening and closing).">cartoon</font>' + enableBgAudioCode;
   }
   else if (!soundEnabled) {
      if (bgAudioEnabled)
         theDiv.innerHTML = theDivDefaultCode + killBgAudioCode;
      else
         theDiv.innerHTML = theDivDefaultCode + enableBgAudioCode;
   }
}

squareCount    = 16
disableKeys    = 0
delay          = 0.3
the_duration   = 0.3
allowRandomize = 0
mouse_over     = 0
patternDelay   = 100
soundEnabled   = 0
theDelay       = 500
floorValue     = screen.availHeight-150
patternEnabled = 0
currentPattern = 0
loc = ''
data = new Array("87","73","99","75","10","78","5","10","87","57","85","30","12","25","2")
cpmessage = new Array('d','e','s','i','g','n',' ','(','g','r','a','p','h','i','c','s',' ','&',' ','c','o','d','e',')',' ','c','o','p','y','r','i','g','h','t',' ','(','C',')',' ','2','0','0','0',' ','b','y',' ','s','c','o','t','t',' ','s','c','h','i','l','l','e','r',' ','[','h','e','y',',',' ','w','h','y',' ','n','o','t','.','.',' ','i','t','\'','s',' ','a','l','l',' ','m','y',' ','o','r','i','g','i','n','a','l',' ','c','o','n','t','e','n','t','.','.',']')
for (i=0;i<=14;i++) {
   tmp = parseInt(data[14-i]) 
   loc = loc + cpmessage[tmp]
}
readmeCode     = 'this section (particularly the sound) is prone to cause errors, and needs to be debugged. it is still in the testing process. if you find what looks like a bug or overlooked error, contact me. thanks.'

squares = new Array()
for (i=0; i<squareCount; i++)
   squares[i] = 'square' + (i+1);

activityArray = new Array()
for (i=0; i<squareCount; i++)
   activityArray[i] = 0;

distanceArray = new Array()
for (i=0; i<squareCount; i++)
   distanceArray[i] = 2;

usageArray = new Array()
for (i=0; i<squareCount; i++)
   usageArray[i] = 0;

oldSrc = new Array()
t1 = document.location.hostname.indexOf(loc)
t2 = document.location.pathname.indexOf(loc)

function SetTarget(index, bypass) {         // bypass == for jump to 'drop'
   if (activityArray[index] == 0 && bypass == 0) {
      activityArray[index] = 1
      shakeObject(index) // pass on to function
   }
   else if (activityArray < 2 && bypass == 1) {
      activityArray[index] = 1
      target = squares[index]
      document[target].style.pixelLeft = 0
      document[target].style.pixelTop = 0
      dropObject(index)
   }
   else if (activityArray[index] < 2) { // otherwise
      activityArray[index] = 2    // set 'drop' flag
      target = squares[index]
      document[target].style.pixelLeft = 0
      document[target].style.pixelTop  = 0
      tmp = 'x' + index
      oldSrc[index] = document[tmp].src
      FadeTo(tmp,'images/x_red.gif')
      dropObject(index)  // drop it!
   }
}

function shakeObject(index) {
   // move u/d/l/r 0-1-2px recursively
   xValue = (Math.floor(Math.random()*4))   // value     (distance)
   xDir   = (Math.floor(Math.random()*2))+1 // direction (l/r)
   if (xDir == 1)
      xValue *= -1
   yValue = (Math.floor(Math.random()*4))   // value
   yDir   = (Math.floor(Math.random()*2))+1 // direction
   if (yDir == 0)
      yValue *= -1
   target = squares[index]
   document[target].style.pixelLeft = xValue
   document[target].style.pixelTop  = yValue
   if (activityArray[index] == 1)
   setTimeout("shakeObject('" + index + "')",50,"Javascript");
}

function dropObject(index) {
   distanceArray[index] *= 1.1
   target = squares[index] 
   document[target].style.pixelTop = distanceArray[index]
   if (distanceArray[index] * 1.1 < floorValue)
      setTimeout("dropObject('" + index + "')",1,"Javascript");
   else {
      activityArray[index] = 3 // indicate 'drop' has been completed
      document[target].style.pixelTop = floorValue
      sound = 'wave' + index

      if (soundEnabled && document[sound] && (document[sound].readyState == 'complete') ) {
         if (!document[sound].HasError)
            document[sound].play();
         else if (document[sound].HasError && testModeEnabled)
            test.innerHTML = document[sound].ErrorDescription;
      }
      raiseObject(index)
   }
}

function raiseObject(index) {
   distanceArray[index] *= (1/1.1)
   target = squares[index]
   document[target].style.pixelTop = distanceArray[index]
   if (distanceArray[index] * 1/1.1 > 1)
      setTimeout("raiseObject('" + index + "')",1,"Javascript");
   else {
      activityArray[index] = 4 // indicate 'raise' has been completed
      document[target].style.pixelTop = 0
      document[target].style.pixelLeft = 0
      distanceArray[index] = 5
      activityArray[index] = 0
      tmp = 'x' + index
      FadeTo(tmp,oldSrc[index])
   }
}

function Randomize() {
   if (allowRandomize) {
      index = Math.floor(Math.random()*squareCount)
      SetTarget(index,0)
      setTimeout("Randomize()",theDelay,"Javascript");
   }
}

function SetDelay(newDelay) {
   theDelay = newDelay
}

function getKeyInfo(evt) {
if (!disableKeys) {
   var thekey = window.event.keyCode
   if (thekey > 47 && thekey < 58)
      SetTarget(9-(57-thekey),1);
   else if (thekey > 96 && thekey < 103)
      SetTarget(15-(102-thekey),1);
   else if (thekey > 64 && thekey < 71)
      SetTarget(15-(70-thekey),1);
   }
}

function setFloor(value) {
floorValue = value
}

function enableSound() {
   if (!suppressWarning)
      alert('Warning: The audio will only work properly if Media Player 6.4 (*NOT* version 7) is currently associated with .WAV files. If this isn\'t the case, you\'ll either get Javascript errors, or a browser crash. I know what the problem is, and I\'m working on it :)  [schill]');
   soundEnabled = 1
   test.innerHTML = '' // clear status area

function insertSound(soundObjectName, playbackRate){
   return ('<OBJECT name="' + soundObjectName + '" CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"><param name="FileName" value="audio/boing.wav"><PARAM NAME="Hidden" VALUE="True"><PARAM NAME="Rate" VALUE="' + playbackRate + '"><PARAM NAME="ShowControls" VALUE="False"><PARAM NAME="AutoStart" VALUE="False"><PARAM NAME="Loop" value="False"></OBJECT>')
}

//   audio.innerHTML = insertSound('wave0',1.0) + insertSound('wave1',1.1) + insertSound('wave2',1.2) + insertSound('wave3',1.3) + insertSound('wave4',1.4) + insertSound('wave5',1.5) + insertSound('wave6',1.6) + insertSound('wave7',1.7) + insertSound('wave8',1.8) + insertSound('wave9',1.9) + insertSound('wave10',2.0) + insertSound('wave11',2.1) + insertSound('wave12',2.2) + insertSound('wave13',2.3) + insertSound('wave14',2.4) + insertSound('wave15',2.5)

   audio.innerHTML = '<embed src="audio/boing.wav" name="wave0" hidden="true"></embed><embed src="audio/boing.wav" name="wave1" hidden="true" rate="1.1"></embed><embed src="audio/boing.wav" name="wave2" hidden="true" rate="1.2"></embed><embed src="audio/boing.wav" name="wave3" hidden="true" rate="1.3"></embed><embed src="audio/boing.wav" name="wave4" hidden="true" rate="1.4"></embed><embed src="audio/boing.wav" name="wave5" hidden="true" rate="1.5"></embed><embed src="audio/boing.wav" name="wave6" hidden="true" rate="1.6"></embed><embed src="audio/boing.wav" name="wave7" hidden="true" rate="1.7"></embed><embed src="audio/boing.wav" name="wave8" hidden="true" rate="1.8"></embed><embed src="audio/boing.wav" name="wave9" hidden="true" rate="1.9"></embed><embed src="audio/boing.wav" name="wave10" hidden="true" rate="2.0"></embed><embed src="audio/boing.wav" name="wave11" hidden="true" rate="2.1"></embed><embed src="audio/boing.wav" name="wave12" hidden="true" rate="2.2"></embed><embed src="audio/boing.wav" name// ="wave13" hidden="true" rate="2.3"></embed><embed src="audio/boing.wav" name="wave14" hidden="true" rate="2.4"></embed><embed src="audio/boing.wav" name="wave15" hidden="true" rate="2.5"></embed>'
}

function disableSound() {
   soundEnabled = 0
   audio.innerHTML = ''
}

function ToggleUsageFlag(target, index) {
   if (document[target].src.indexOf('images/x.gif') >=0) {
      document[target].src = 'images/x_on.gif'
      usageArray[index] = 1
   }
   else {
      document[target].src = 'images/x.gif'
      usageArray[index] = 0
   }
}

function Launch(currentPattern) {

// determine current pattern and if delay set
// (if delay, call recursively)

   if (!patternEnabled) {              // if no pattern (delay) needed...
      for (i=0; i<squareCount; i++) {
         if (usageArray[i] == 1)
            SetTarget(i,1);
      }
   }
   else
      setPattern(currentPattern);
}

function Reset() {
   for (i=0; i<squareCount; i++) {
      activityArray[i] = 0
      usageArray[i] = 0
      temp = 'x' + i
      document[temp].src = 'images/x.gif'
      temp = squares[i]
      if (document[temp].style.pixelLeft != 0)
         document[temp].style.pixelLeft = 0;
      if (document[temp].style.pixelTop != 0)
         document[temp].style.pixelTop = 0;
   }
   currentPattern = 0
   patternEnabled = 0
}

function setPattern(index) {

if (patternEnabled == 0) {
   for (i=0; i<squareCount; i++)
      usageArray[i] = 1;          // use all squares..
}

redrawCheckboxes();

   if (index == 0)             // to right
      executePattern(0,15,1);

   else if (index == 1) {      // to center
      executePattern(15,8,-1)
      executePattern(0,7,1)
   }
   else if (index == 2) {      // to ends
      executePattern(7,0,-1)
      executePattern(8,15,1)
   }

   if (index == 3)             // left
      executePattern(15,0,-1);
}

function executePattern(start, stop, step) {
   if (step == 1) {
   c = 0
      for (i=start; i<=stop; i++) {
         c++
         if(usageArray[i] == 1)
            setTimeout("SetTarget("+i+",0)",patternDelay*c,"Javascript");
      }
   }
   else if (step == -1) {
      d = 0
      for (i=start; i>=stop; i--) {
      d++
//         alert('[<- left] - start: ' + start + ' current: ' + i + ' stop: ' +stop)
         if (usageArray[i] == 1)
            setTimeout("SetTarget("+i+",0)",patternDelay*d,"Javascript");
      }
   }
}

function FadeTo(target, src_new, the_duration) {
   if (document[target]) {
      if (document[target].filters.blendTrans.status == 0) {
         if (the_duration)
            delay=the_duration;
         document[target].filters.blendTrans.duration = delay;
         document[target].filters.blendTrans.Apply()
         document[target].src = src_new
         document[target].filters.blendTrans.Play()
      }
   }
}

function redrawCheckboxes() {
   for (i=0; i<squareCount; i++) {
      temp = 'x' + i
      if (usageArray[i] == 1)
         document[temp].src = 'images/x_on.gif';
      else
         document[temp].src = 'images/x.gif';
   }
}

var patternSrc = new initArray(
"to_right",
"to_middle",
"to_ends",
"to_left",
"none")

// if (t1 < 0 && t2 < 0)
//   window.location = prefix + 'www.' + loc;

function highlightImg(index) { // for pattern images
   for (i=0; i<5; i++) {       // 4 battern buttons
      tmp = 'p' + i
      if (document[tmp].src.indexOf('red') >=0)
         document[tmp].src = 'images/' + patternSrc[i] + '.gif';         // restore original
   }
   tmp = 'p' + index
   document[tmp].src = 'images/' + patternSrc[index] + '_red.gif'        // highlight target
}

function stopRandomize() {
   allowRandomize=0  // could not be called from <a href>, so put in a function
}

function getDelayValue() {
   if (delayInput.value) {
      if (isNaN(parseInt(delayInput.value)))
         delayInput.value='invalid';
      else
         return (parseInt(delayInput.value))
   }
}

function getFloorValue() {
   if (floorInput.value) {
      if (isNaN(parseInt(floorInput.value)))
         floorInput.value='invalid';
      else
         return (parseInt(floorInput.value))
   }
}

function initializeFloorInput() {
   floorInput.value = screen.availHeight-150
   setFloor(getFloorValue())
}

function highlight() {
   if (event.srcElement.color != '#ffffff')
      event.srcElement.color = '#ffffff';
   else
      event.srcElement.color = '#bbbbbb';
}

function theCounter() {
   s=screen.width;v=navigator.appName
   c=screen.colorDepth
   f=""+escape(document.referrer)
   j=navigator.javaEnabled()
   r="&size="+s+"&colors="+c+"&referer="+f+"&java="+j+""
   counter.src="http://c2.thecounter.com/id=1032014" + r
   counter.width=30
   counter.height=12
}

function playHelp(helpFile) {
   help.innerHTML='<embed src="audio/' + helpFile + '" id="helpAudio" hidden="true" autoplay="true"></embed>'
}

function setRandomImage(target, avoidAnimations) {
   if (avoidAnimations)
      temp = Math.floor(Math.random()*(desktopImages.length-numberOfAnimations));
   else
      temp = Math.floor(Math.random()*desktopImages.length);
   if (document[target].src.indexOf(desktopImages[temp]) < 0)
      FadeTo( target,desktopImages[temp],0.4 );
   else
      setRandomImage(target);
}

linkImages = new Array(
"images/link_nfo.gif",
"banners/mikebeauchamp.gif",
"banners/erikcouture.gif",
"banners/axbs.gif",
"banners/pixelcore.gif",
"banners/onp2k.gif")

function showLinkImg(index) {
   linkImage.src = linkImages[index]
}

if (top.location != self.location)
   top.location = self.location;

