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

var fadeSpeed = .2;
var alphaSpeed_bab = 100;
var alphaSpeed_aba = 100; // microseconds

function fadeTo(obj, to, speed) {
	if (!speed) speed = fadeSpeed;
	if (!self.is || (!is.ie||is.v<6)&&!is.ns6) return;

	try {
		if (is.ie) {
			var alphaobj = obj.filters.alpha;
			if (!alphaobj || typeof(alphaobj.opacity) != 'number') return;
		}
	} catch(e) {
		return;
	}

	if (obj.tmr) clearTimeout(obj.tmr);
	obj.tmr = 0;
	var alpha = is.ie ? alphaobj.opacity : obj.style.MozOpacity * 100;
	alpha += (to - alpha) * fadeSpeed;
	if (Math.abs(alpha - to) < 2) {
		if (is.ie) {
			alphaobj.opacity = to;
		}
		else {
			obj.style.MozOpacity = to / 100;
		}
		return;
	}
	if (is.ie) {
		alphaobj.opacity = alpha;
	}
	else {
		obj.style.MozOpacity = alpha / 100;
	}
	obj.tmr = setTimeout(function() { fadeTo(obj, to, speed) }, 100);
}

function alpha_aba(obj, speed, started) {
	if (!speed) speed = alphaSpeed_aba;
	if (!self.is || (!is.ie||is.v<6)&&!is.ns6) return;

	try {
		if (is.ie) {
			var alphaobj = obj.filters.alpha;
			if (!alphaobj || typeof(alphaobj.opacity) != 'number') return;
		}
	} catch(e) {
		return;
	}

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

	var to = obj.to;
	if (!to) to = 50;
	if (to == 100) {
		obj.to = 50; // first fade
		if (is.ie) alphaobj.opacity = to;
		else obj.style.MozOpacity = to / 100;
		if (started) return; // done
	} else if (to == 50) {
		obj.to = 100; // go back 100
		if (is.ie) alphaobj.opacity = to;
		else obj.style.MozOpacity = to / 100;
	}

	obj.tmr = setTimeout(function(){alpha_aba(obj, speed, true)}, speed);
}
function alpha_bab(obj, speed, started) {
	if (!speed) speed = alphaSpeed_bab;
	if (!self.is || (!is.ie||is.v<6)&&!is.ns6) return;

	try {
		if (is.ie) {
			var alphaobj = obj.filters.alpha;
			if (!alphaobj || typeof(alphaobj.opacity) != 'number') return;
		}
	} catch(e) {
		return;
	}

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

	var alpha = alphaobj.opacity;
	var to = obj.to;
	if (!to) to = 50; // start

	var to = obj.to;
	if (!to) to = 50;
	if (to == 100) {
		obj.to = 50; // first fade
		if (is.ie) alphaobj.opacity = to;
		else obj.style.MozOpacity = to / 100;
	} else if (to == 50) {
		obj.to = 100; // go back 100
		if (is.ie) alphaobj.opacity = to;
		else obj.style.MozOpacity = to / 100;
		if (started) return; // done
	}
	obj.tmr = setTimeout(function() {alpha_bab(obj, speed, true)}, speed);
}

function bhover(borderColor,e) {
	var o = e_getSrc(e);
	var p = is.ie ? 'parentElement' : 'parentNode';
	while (o && o.tagName != 'TD' && o.tagName != 'A' && o.tagName != 'DIV')
		o=o[p];
	if (!o) return;

	return borderHover(o,borderColor,e)
}

function borderHover(o,borderColor,e)
{
	var div, st;
	var add = false;
	if (!self.is || !is.ie) return;
	if (o.style.cursor) return;
	o.style.cursor = is.hand;
	var fc = o.firstChild;
	while (fc) {
		if (fc.nodeName == 'IMG' || fc.nodeName == 'INPUT') {
			div = fc;
			break;
		}
		fc = fc.nextSibling;
	}
	if (!div) {
		add = true;
		div = document.createElement('div');
	}

	st = div.style;

	st.display = 'inline';
	st.cursor = is.hand;
	st.borderStyle = 'solid';
	st.borderColor = borderColor;

	st.borderWidth = '1px'
	div.onmouseover = function () { this.style.borderWidth='1px'; }
	div.onmouseout = function() { this.style.borderWidth='0px'; }

	if (!add) return;
	fc = o.firstChild;
	if (fc&&div!=fc) {
		o.insertBefore(div,fc);
		o.removeChild(fc);
	} else {
		o.appendChild(div);
	}
}

scriptscomplete['effect'] = true;

