/* chaser.js
 * by Aaron Boodman v1.0 000919
 * Copyright (c) 2000 Aaron Boodman. All Rights Reserved.
 * Created for GreatEqualizer.com (http://www.greatequalizer.com/) and
 * documented at DHTML Lab (http://www.webreference.com/dhtml/)
 * License to use is granted if and only if this entire
 * copyright notice is included.
*/
var isNS=(document.layers);
var _all=(isNS)? '' : 'all.' ;
var _style=(isNS)? '' : '.style' ;
var _visible=(isNS)? 'show' : 'visible';
var w_x, w_y, okscroll=false, godown;
var maxDiff = (document.all)? document.body.clientHeight : window.innerHeight;
var itemDIV

var isIE = (document.all)? true : false;
var A, B, C, D, currentY, targetY, newTargetY, scrollTop;


function oChasermain()
{

    itemDIV = document.getElementById("item");

     if(document.body.scrollTop>200){

        itemDIV.style.visibility=_visible;

	currentY	= isIE ? itemDIV.style.pixelTop : document.getElementById("item").style.top

	scrollTop	= isIE ? document.body.scrollTop : window.pageYOffset

	newTargetY	= scrollTop + 20

        if (currentY.length < 1){
           currentY = 0;
        }else{
          if ("px" == Right(currentY, 2)){currentY = Left(currentY, currentY.length-2);}
        }

	if ( currentY != newTargetY ) {
		if ( newTargetY != targetY ) {
			targetY = newTargetY
			oChaserslideInit()
		}
		oChaserslide()		
	}
      }else{itemDIV.style.visibility="hidden";}
}

function oChaserslideInit()
{
	var now	= new Date()	
	A		= targetY - currentY
	B		= Math.PI / ( 2 * 1200 )
	C		= now.getTime()
	if (Math.abs(A) > maxDiff) {
		D = A > 0 ? targetY - maxDiff : targetY + maxDiff
		A = A > 0 ? maxDiff : -maxDiff
	} else {
		D = currentY
	}

}

function oChaserslide()
{
	var now	= new Date()
	var newY	= A * Math.sin( B * ( now.getTime() - C ) ) + D
	newY		= Math.round( newY )

	if (( A > 0 && newY > currentY ) ||
		( A < 0 && newY < currentY )) {
		if ( isIE )itemDIV.style.pixelTop = newY
			else			itemDIV.style.top = newY
	}
}

  function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
  }

  function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
  }