if(document.getElementById){
	doc = 'document.getElementById("';
	sty = '").style';
	htm = '';
}

if(document.layers){
	doc = 'document.';
	sty = '';
	htm = '.document'
}

if(document.all){
	doc = 'document.all.';
	sty = '.style';
	htm = '';
}

function animate(lyr,xadd,amp,trans,freq,end,delay){
    layerName = eval(doc + lyr + sty);
    layerName.left =  parseInt(layerName.left) + xadd;
    if(!document.layers)
	layerName.top =  parseInt(Math.sin(parseInt(layerName.left)*(freq/90))*amp + trans);
    else
	layerName.top =  Math.sin(layerName.left*(freq/90))*amp + trans;

	//These variables allow us to avoid building a String for setTimeout()
	l = lyr;	//ball
	x = xadd;	//move x-axis - move increments - lower=slower
	a = amp;	//curve height
	t = trans;	//initial top property? y?
	e = end;	//end x-coord.
	f = freq;	//freqeuncy - number of repetitions
	d = delay;	//

    if(((xadd > 0) && (parseInt(layerName.left) < end))||((xadd < 0) && (parseInt(layerName.left) > end)))
	setTimeout('animate(l,x,a,t,f,e,d)',d);
    else {
	    initfade();
    }
}
//without fade
function animate2(lyr,xadd,amp,trans,freq,end,delay){
    layerName = eval(doc + lyr + sty);
    layerName.left =  parseInt(layerName.left) + xadd;
    if(!document.layers)
	layerName.top =  parseInt(Math.sin(parseInt(layerName.left)*(freq/90))*amp + trans);
    else
	layerName.top =  Math.sin(layerName.left*(freq/90))*amp + trans;

	//These variables allow us to avoid building a String for setTimeout()
	l = lyr;	//ball
	x = xadd;	//move x-axis - move increments - lower=slower
	a = amp;	//curve height
	t = trans;	//initial top property? y?
	e = end;	//end x-coord.
	f = freq;	//freqeuncy - number of repetitions
	d = delay;	//

    if(((xadd > 0) && (parseInt(layerName.left) < end))||((xadd < 0) && (parseInt(layerName.left) > end)))
	setTimeout('animate2(l,x,a,t,f,e,d)',d);
    else
	    initfade2();////
}