var tempTween = [];

/* product pop ups */
function popupAnim(tgt, i, o)
{
	var nx = o.xpos!=undefined ? o.xpos : 0;
	var ny = o.ypos!=undefined ? o.ypos : 0;
	var f = o.timeout ? o.timeout : 1;
	var t = tempTween[i] = new Tween(tgt.style,'top', Tween.sineEaseInOut,nx,ny,f,'px');
	if (o.doComplete) 
		t.onMotionFinished = function(){ hideElement(tgt, i); }
	else {
		t.onMotionFinished = null;
		t.removeListener();
	}
	t.start();
}

function popdownAnim(tgt, i, o)
{
	popupAnim(tgt, i, o);
}

function dropdownAnim(tgt, i, o)
{
	var nx = o.xpos!=undefined ? o.xpos : 0;
	var ny = o.ypos!=undefined ? o.ypos : 0;
	var f = o.timeout ? o.timeout : 1;
	var t = tempTween[i] = new Tween(tgt.style,'top', Tween.sineEaseInOut,nx,ny,f,'px');
	if (o.doComplete) 
		t.onMotionFinished = function(){ hideElement(tgt, i); }
	else {
		t.onMotionFinished = null;
		t.removeListener();
	}
	t.start();
}

function dropupAnim(tgt, i, o)
{
	dropdownAnim(tgt, i, o);
}

function hideElement(t, n)
{
	tempTween[n].onMotionFinished = null;
	t.style.visibility = 'hidden';
}