// effect.js
// copyright by oursky.net, all rights reserved.

var fadeSpeed = .8;
var effectObjID = 0;
var alphaSpeed_bab = .7;

var alphaSpeed_aba = 100; // microseconds
function alpha_aba(obj, started) {
	if (!is.ie) return;

	if (typeof obj == "string") obj = document.getElementById(obj);

	if (!obj.filters) return;

	if (obj.tmr) clearTimeout(obj.tmr);
	obj.tmr = 0;


	var to = obj.to;
	if (!to) to = 50;
	/*
	var alpha = obj.filters.alpha.opacity;

	alpha += (to - alpha) * alphaSpeed_aba;
	if (Math.abs(alpha - to) < 2) {
	*/
		if (to == 100) {
			obj.to = 50; // first fade
			obj.filters.alpha.opacity = to;
			if (started) return; // done
		} else if (to == 50) {
			obj.to = 100; // go back 100
			obj.filters.alpha.opacity = to;
		}
	/*
	} else {
		obj.filters.alpha.opacity = alpha;
	}
	*/

	if (!obj.id) obj.id = "fadeImg" + (++effectObjID);
	obj.tmr = setTimeout("alpha_aba('"+obj.id+"', true)", alphaSpeed_aba);
}