////////////////////////////////////////////////////////////////////////
// cpanim.js by Dr Alex                                               //
// Copyright 2002-2006 C Point                                        //
// This script is free for personal, educational, and commercial use  //
// provided that this header is left unmodified                       //
//                                                                    //
//           Created with Antechinus JavaScript Editor                //
//                    http://www.c-point.com                          //
////////////////////////////////////////////////////////////////////////

function go(i) 
{
    i.filters[0].Apply();

	if (i.style.visibility == "visible") {
        i.style.visibility = "hidden";
	i.filters.revealTrans.transition=2;
    }
    else {
        i.style.visibility = "visible";
	i.filters[0].transition=3;
    }
    i.filters[0].Play();
}


function cpMoveSize(i, x, y, sx, sy, a, b, n)
{
	cpMoveObj(i, x, y, a, 0);
	cpSizeObj(i, sx, sy, a, b, n);
}

// Move object i to x,y by the amount a, return n to cpSequencer()
function cpMoveObj(i, x, y, a, n)
{
	xNow = i.style.posLeft;
	yNow = i.style.posTop;
	var b = a - 1;
	if (xNow > (x + b))
	{
		xNow = xNow - a;
	    i.style.posLeft = xNow;
	}
	else if (xNow < (x - b))
	{
		xNow = xNow + a;
		i.style.posLeft = xNow;
	}
	else
	{
		xNow = x;
		i.style.posLeft = xNow;
	}
	if (yNow > (y + b))
	{
		yNow = yNow - a;
	    i.style.posTop = yNow;
	}
	else if (yNow < (y - b))
	{
		yNow = yNow + a;
		i.style.posTop = yNow;
	}
	else
	{
		yNow = y;
		i.style.posTop = yNow;
	}

	if(xNow == x && yNow == y) 
	{
		if(n) cpSequencer(n);
		return;
	}
	window.setTimeout("cpMoveObj("+i.id+","+x+","+y+","+a+", "+n+");", 1);
}

function cpSizeX(i, x, a, n)
{
	if(i.width<x)  i.width+=a;

	if(i.width >= x)
	{
		cpSequencer(n);
		return;
	}
	window.setTimeout("cpSizeX("+i.id+", "+x+", "+a+", "+n+");", 1);
}

// Size object i to x, y by the amount a, b, return n to cpSequencer()
function cpSizeObj(i, x, y, a, b, n)
{
	if(i.width<x)  i.width+=a;
	if(i.height<y) i.height+=b; 

	if((i.width >= x) && (i.height >= y)) 
	{
		if(n) cpSequencer(n);
		return;
	}
	window.setTimeout("cpSizeObj("+i.id+", "+x+", "+y+", "+a+", "+b+", "+n+");", 1);
}


// Blend image i to the new image newsrc
function cpBlend(i, newsrc)
{	
	i.filters.blendTrans.Apply();
	i.src = newsrc;
	i.filters.blendTrans.Play()
}


function cpTransition(i, t, d) 
{
    i.filters[0].Apply();

	if(i.style.visibility == "visible") i.style.visibility = "hidden";
    else i.style.visibility = "visible";

	i.filters[0].duration=d;
	i.filters[0].transition=t;
    i.filters[0].Play();
}





