﻿// JScript File

/*
	Hejbe objektem z leva doprava.
		ID - id objektu
		totalFrames - kolikrat s nim hejbne a pak se resetne zpet do vychozi pozice
		startLeftPosition - pocatecni pozice
*/
function animateObjectLeftToRight(id, actFrame, actLeftPosition,   totalFrames, startLeftPosition, offset)
{
	if(actFrame < totalFrames)
	{
		actLeftPosition += offset;	
		document.getElementById(id).style.left = actLeftPosition + "px";
		actFrame++;
	} else {
		actFrame = 0;
		offset = offset * -1;
		if(offset > 0)
			actLeftPosition = startLeftPosition;
	}
	setTimeout("animateObjectLeftToRight('" + id + "', " + actFrame + ", " + actLeftPosition + ", " + totalFrames + ", " + startLeftPosition + ", " + offset + ")", 20);
}


