var animation_steps = 10;
var animation_delay = 20;

var animations = new Array();
function animation_fly(aniobj) {
	aniobj['stepx'] = ((aniobj['tox'] - aniobj['fromx']) / animation_steps),
	aniobj['stepy'] = ((aniobj['toy'] - aniobj['fromy']) / animation_steps),
	aniobj['stepw'] = ((aniobj['tow']- aniobj['fromw']) / animation_steps),
	aniobj['steph'] = ((aniobj['toh']- aniobj['fromh']) / animation_steps),
	aniobj['currentx'] = aniobj['fromx'],
	aniobj['currenty'] = aniobj['fromy'],
	aniobj['currentw'] = aniobj['fromw'],
	aniobj['currenth'] = aniobj['fromh'],
	aniobj['step'] = 0,
	animations.push(aniobj);
	if (!animation_timer_enabled)
		setTimeout('animation_timer()',animation_delay);
}

var animation_timer_enabled = 0;
function animation_timer() {
	animation_timer_enabled = 0;
	for (a = 0; a < animations.length; a++) {
		if (animations[a].step < animation_steps) {
			animation_timer_enabled = 1; // OK, we got dirty
			var obj = document.getElementById(animations[a]['objid']);
			animations[a]['currentx'] += animations[a]['stepx'];
			animations[a]['currenty'] += animations[a]['stepy'];
			animations[a]['currentw'] += animations[a]['stepw'];
			animations[a]['currenth'] += animations[a]['steph'];
			animations[a]['step'] += 1;
			obj.style.left = animations[a]['currentx'];
			obj.style.top = animations[a]['currenty'];
			obj.style.width = animations[a]['currentw'];
			obj.style.height = animations[a]['currenth'];
			obj.style.display = 'block';
		} else if (animations[a].step == animation_steps) { // Last movement
			animations[a]['step'] += 1;
			animation_timer_enabled = 1; // OK, we got dirty
			if (animations[a]['thenhide'])
				document.getElementById(animations[a]['objid']).style.display = 'none';
			if (animations[a]['theneval']) {
				eval(animations[a]['theneval']);
			}
		}
	}
	if (animation_timer_enabled)
		setTimeout('animation_timer()',animation_delay); // Dirty - Run again
	else
		animations = new Array(); // No dirt - wipe the array to free memory
}
