﻿// JScript File
SlideFade.prototype = new Tween();
SlideFade.prototype.constructor = Tween;
SlideFade.superclass = Tween.prototype;
var alertedie = false;
var alertedie2 = false;
function SlideFade(obj,func,fromHeight,toHeight,duration){
	this.targetObject = obj;
	this.HandleSecondaryTween=true;	
	this.begin_b = fromHeight>toHeight?100:0;
	this.finish_b = fromHeight>toHeight?0:100;
	this.init(obj.style,'top',func,fromHeight,toHeight,duration,'px');
}
var o = SlideFade.prototype;
o.targetObject = {};
o.Opacity=0;
o.onMotionChanged = function(evt){
	var v = this.Opacity = evt.target.SecondaryPosition;
	if(px.Cart.Browser.IsIe8 || px.Cart.Browser.IsIe8up)
	{
		this.handleIE8Up(evt);
		return;
	}
	var t = this.targetObject;
	try
	{
	t.style['opacity'] = v / 100;
	t.style['-moz-opacity'] = v / 100;
	}catch(e){}
	if(t.filters){ try { if(!alertedie){alertedie=true} t.filters.alpha['opacity'] = v; } catch(e) { try {if(!alertedie2){alertedie2=true};  t.style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=' + v + ')'; } catch(e){} } }
}
var n = 0;
var sb = "";
o.handleIE8Up = function(evt)
{
	var v = evt.target.SecondaryPosition;
	var t = this.targetObject;	
	t.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + v + ')';
// loop through the child elements and pass opacity to them as well since ie8 seems to not inherit
//for(var i = 0; i < t.childNodes.length; i++)
//	this.fadeChildren(t.childNodes[i], v);
}
o.fadeChildren=function(p, o)
{
		for(var i = 0; i < p.childNodes.length; i++)
		{
			var c = p.childNodes[i];
			if(c.style != null)
				c.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + v + ')';
			if(c.childNodes.length>0)
				this.fadeChildren(c, o);
		}
}
