
	isNS4 = (document.layers) ? true : false;
	isIE4 = (document.all && !document.getElementById) ? true : false;
	isIE5 = (document.all && document.getElementById) ? true : false;
	isNS6 = (!document.all && document.getElementById) ? true : false;

	function Strobe(){
		if(typeof(_Strobe_prototype_called) == 'undefined'){
		  _Strobe_prototype_called = true;
		  Strobe.prototype.changeBG = _changeBG;
		  Strobe.prototype.isEven = _isEven;
		  Strobe.prototype.launch = _launch;
		  Strobe.prototype.clear = _clear;
		  Strobe.prototype.wait = _wait;
		  Strobe.prototype.reset = _reset;
		  Strobe.prototype.counter = _counter;
		  Strobe.prototype.resetCells = _resetCells;
		 }
		
		this.speed = 50;			//speed is in milliseconds
		this.numCells = 10			//number of cells
		this.cellPrefix = "cells"	//prefix of the cell ID
		this.classNormal = "normal"
		this.classSelOne = "highlight"
		this.classSelTwo = "highlight2"
		
		var speed = this.speed;
		var numCells = this.numCells;
		var cellPrefix = this.cellPrefix;
		var classNormal = this.classNormal;
		var classSelOne = this.classSelOne;
		var classSelTwo = this.classSelTwo;
				
		var motionCount = 0;
		var runThroughCount = 2;
		var counter = 0;
		var callCount = 0;
		var timerCount = 0;
		var globalStrobeInterval = 0;
		
		function _resetCells(numTD, cllPre, clsNorm){
			var motionCount = 0;
			var runThroughCount = 2;
			var counter = 0;
			var callCount = 0;
			for(var x=1; x<=numTD; x++){
					var selCell = cllPre+x;
					document.getElementById(cllPre+x).className = clsNorm;					
				}
		}
		
		function _changeBG(numTD, cllPre, clsNorm, clsOne, clsTwo){					
								
					//if it is even go up the winner
					//if it is odd go down the river
						if(Strobe.prototype.isEven(runThroughCount)){
							
							motionCount = motionCount + 1;
						}else{
							motionCount = motionCount - 1;
						}						

					//if the motion count leaves the bounds it
					//must be reset depending on which direction the 
					//river is flowing		
							
					if((motionCount > numTD) || (motionCount <= 0)){
						runThroughCount = runThroughCount + 1;
						if(Strobe.prototype.isEven(runThroughCount)){
							motionCount = 2;
						}else{
							motionCount = numTD-1;
						}
					}
						
					//if runThroughCount is even we are going up the 
					//river, so increment the cells
					//if not we are going down the river and 
					//decrement the cells
					if(Strobe.prototype.isEven(runThroughCount)){
						
						for(var x=1; x<=numTD; x++){
							var selCell = cllPre+x;
							//alert(selCell);
							if(x == motionCount){
								document.getElementById(cllPre+x).className = clsOne;
								
								if((x-1) > 0){
								document.getElementById(cllPre+(x-1)).className = clsTwo;
								}
									
							}else{
								document.getElementById(cllPre+x).className = clsNorm;
								
							}
								
						}
					}else{
						for(var x=numTD; x>=1; x--){
							
							if(x == motionCount){
								document.getElementById(cllPre+x).className = clsOne;
								
								
								if((x+1) <= numTD){
								document.getElementById(cllPre+(x+1)).className = clsTwo;
								}
							}else{
								document.getElementById(cllPre+x).className = clsNorm;
								
							}
						}
					}
					
					callCount = callCount + 1
					//alert(callCount);
					if(callCount == 55){
						callCount = 0;
						Strobe.prototype.resetCells(numTD, cllPre, clsNorm);
						//alert("Interval="+globalStrobeInterval);
						Strobe.prototype.clear(globalStrobeInterval);
						Strobe.prototype.wait('Strobe.prototype.launch()', 5);
					}

			}
		
			
			function _launch(){
				//alert('launching');
				globalStrobeInterval = setInterval('Strobe.prototype.changeBG('+numCells+',"'+cellPrefix+'","'+classNormal+'", "'+classSelOne+'", "'+classSelTwo+'")', speed);
				
			}
			
			
			function _clear(interval1){
				//clear the interval
				//alert('Clearing Interval ' + interval1);
				clearInterval(interval1);
			}
			
			
			function _reset(strobeInterval, numSecs){
				var strobeReset = setInterval('Strobe.prototype.launch();Strobe.prototype.clear('+strobeInterval+');  Strobe.prototype.clear('+strobeReset+')', numSecs)
				
			}
			
			function _wait(func, secs){
				globalStrobeInterval = setInterval('Strobe.prototype.counter('+ secs +')', 1000);
			}
			
			function _counter(secs){
				timerCount = timerCount + 1
				
				if(timerCount == secs){
					timerCount = 0;
					clearInterval(globalStrobeInterval)
					Strobe.prototype.launch();
				} 
			}
		//end strobe class
		}
		
		
		
		function _isEven(num){
			return (num%2) ? false:true;
		
		}
		

