   function jm_set_element_opacity( element, cnt )
   {
      eval( 'document.getElementById("' + element + '").style.opacity=' + ( cnt / 100 )+ ';' );
      eval( 'document.getElementById("' + element + '").style.filter="alpha(opacity:' + cnt + ')";' );
   }

function jm_show_element( element )
{
  document.getElementById( element ).style.display = 'block';
}

function jm_scrollto( elementName )
{
	var el = document.getElementById( elementName );
	var top = el.offsetTop;
	el.offsetParent.scrollTop = top;
	
} 

function jm_backtotop( elementName )
{
	var el = document.getElementById( elementName );
	el.scrollTop = 0;
	
} 


function TimerData( element, myName, start, end, executionTime, startTime, tickTime, finishFunction )
   {
    this.mElement = element;
	this.mMyName = myName;
	this.mStart = start;
	this.mEnd = end;
	this.mExecutionTime = executionTime;
	this.mStartTime = startTime;
	this.mTickTime = tickTime;
	this.mFinishFunction = finishFunction;
   }
   
   TimerData.prototype.mElement;
   TimerData.prototype.mMyName;
   TimerData.prototype.mStart;
   TimerData.prototype.mEnd;
   TimerData.prototype.mExecutionTime;
   TimerData.prototype.mStartTime;
   TimerData.prototype.mTickTime;
   TimerData.prototype.mFinishFunction;

   TimerData.prototype.restart = function()
   {
      var d = new Date();
	  this.mStartTime = d.valueOf();
   }

   TimerData.prototype.restartCount = function()
   {
	  this.mStart = 0;
   }

   TimerData.prototype.isDone = function( cntMillis )
   {
     return ( this.mStartTime + this.mExecutionTime ) <= cntMillis;
   }
   
   TimerData.prototype.isDoneCount = function()
   {
   	 return ( this.mStart >= this.mEnd );
   }
   
   TimerData.prototype.getValueForTime = function( cntMillis )
   {
     var t = cntMillis - this.mStartTime;
	 
	 return this.mStart + ( ( this.mEnd - this.mStart ) * t / this.mExecutionTime );
   }
   
   function fade_tick( timerData )
   {
      var cntTime = new Date();
	  var cntMillis = cntTime.valueOf();
	  
	  if ( timerData.isDone( cntMillis ) )
	  {
	    jm_set_element_opacity( timerData.mElement, timerData.mEnd );
		eval( timerData.mFinishFunction );
	  }
	  else
	  {
	    jm_set_element_opacity( timerData.mElement, timerData.getValueForTime( cntMillis ) );
	    post_fade_tick( timerData );
	  }
   }
   
   function post_fade_tick( timerData )
   {
      setTimeout( 'fade_tick( ' + timerData.mMyName + ' );', timerData.mTickTime );
   }
   
   function start_fade( timerData )
   {
   	  timerData.restart();
   	  post_fade_tick( timerData );
   }
function writeConsole(content) {
 top.consoleRef=window.open('','myconsole',
  'width=350,height=250'
   +',menubar=0'
   +',toolbar=1'
   +',status=0'
   +',scrollbars=1'
   +',resizable=1')
 top.consoleRef.document.writeln(
  '<html><head><title>Console</title></head>'
   +'<body bgcolor=white onLoad="self.focus()">'
   +content
   +'</body></html>'
 )
 top.consoleRef.document.close()
}

   function select_tick( timerData )
   {
      var el = document.getElementById( timerData.mElement );
      var cntTime = new Date();
	  var cntMillis = cntTime.valueOf();
	  
	  if ( timerData.isDone( cntMillis ) )
	  {
      	 add_class_to_element( el, "selected" );
      	 eval( timerData.mFinishFunction );
      }
      else
      {
       	 var i = parseInt( timerData.getValueForTime( cntMillis ) );

      	 if ( ( i & 1 ) == 1 )
      	 {
      	 	remove_class_from_element( el, "selected" );
      	 }
      	 else
      	 {
	      	add_class_to_element( el, "selected" );
	     }
	     
	     post_select_tick( timerData );
      }
   }
   
   function post_select_tick( timerData )
   {
   	 setTimeout( 'select_tick( ' + timerData.mMyName + ' );', timerData.mTickTime );
   }
