function moveSmooth(objId,x1,y1,x2,y2,steps,speed)
{
	// Moves objId to (x2,y2) from its current location in the
	// number of steps specified, at the specified speed.
	// (Speed can be anywhere between 1 (low) and 10 (high))
	// This allows for easy and smooth animation of elements.
	// Made by Jonathan Voss, 1/12/2010
	// Copying and distributing freely is hereby granted so
	// long as this comment block remains.
	
	// Variable and array declarations
	var xm = new Array(steps);
	var ym = new Array(steps);
	var xp, yp, temp;
	
	// Setup x coordinates for animation
	if (x1>x2)
	{
		xp = x1 - x2; // How many pixels it must move
		xp = xp / steps; // How many pixels it must move per step
		for (i=0;i<steps+1;i++) // Assigns x coordinates for each index of the xm array
		{
			temp = x1 - (xp*i);
			xm[i] = temp;
		}
	}
	else if (x1<x2)
	{
		xp = x2 - x1;
		xp = xp / steps;
		for (i=0;i<steps+1;i++)
		{
			temp = x1 + (xp*i);
			xm[i] = temp;
		}
	}
	else // if (x1=x2)
	{
		for (i=0;i<steps+1;i++)
			xm[i] = x1;
	}
	
	// Setup y coordinates for animation
	if (y1>y2)
	{
		yp = y1 - y2; // How many pixels it must move
		yp = yp / steps; // How many pixels it must move per step
		for (i=0;i<steps+1;i++) // Assigns y coordinates for each index of the ym array
		{
			temp = y1 - (yp*i);
			ym[i] = temp;
		}
	}
	else if (y1<y2)
	{
		yp = y2 - y1;
		yp = yp / steps;
		for (i=0;i<steps+1;i++)
		{
			temp = y1 + (yp*i);
			ym[i] = temp;
		}
	}
	else // if (y1=y2)
	{
		for (i=0;i<steps+1;i++)
			ym[i] = y1;
	}
	// Fix first and last positions 
	xm[0]=x1; ym[0]=y1; xm[steps]=x2; ym[steps]=y2;
	
	// Set timeouts for movements
	speed = Math.round(speed);
	if (speed<1 || speed>10) // Check to make sure the speed is set correctly
		alert("Javascript error: (function.moveSmooth)\nInvalid value for speed: "+speed+"\nSpeed must be between 1 (low) and 10 (high)");
	else
	{
		var time = 200;
		for (i=1;i<speed+1;i++)
			time = time-16.66667;
		obj = document.getElementById(objId);
		for (i=0;i<steps+1;i++)
		{
			setTimeout("obj.style.left=\""+xm[i]+"px\"",time*i);
			setTimeout("obj.style.top=\""+ym[i]+"px\"",time*i);
		}
	}
}

function moveSimple(objId,x,y)
{
	obj = document.getElementById(objId);
	obj.style.top=y+"px";
	obj.style.left=x+"px";
}

function fadeIn(objId,steps,speed)
{
	// Basic fading in animation.
	// Speed must be an integer between 1 and 5.
	// Made by Jonathan Voss, 1/21/2010.
	// Copying and distributing freely is granted
	// so long as this comment block remains.
	
	// Variable, object, and array declarations
	obj = document.getElementById(objId).style;
	var ffOa = new Array();
	var ieOa = new Array();
	
	// Setup arrays
	var n = 100/steps;
	for (i=0;i<steps+1;i++)
	{
		ieOa[i] = n*i;
		ffOa[i] = n*i/100;
	}
	
	speed = Math.round(speed);
	if (speed<1 || speed>5)
		alert("Javascript error: (function.fadeOut)\nInvalid value for speed: "+speed+"\nSpeed must be between 1 (low) and 5 (high)");
	else
	{
		time = 200;
		for (i=1;i<speed+1;i++)
			time = time - 37.5;
		for (i=0;i<steps+1;i++)
		{
			setTimeout("obj.opacity=\""+ffOa[i]+"\"",time*i);
			setTimeout("obj.filter=\"alpha(opacity="+ieOa[i]+")\"",time*i);
		}
	}
}

function fadeOut(objId,steps,speed)
{
	// Basic fading out animation.
	// Speed must be an integer between 1 and 5.
	// Made by Jonathan Voss, 1/21/2010.
	// Copying and distributing freely is granted
	// so long as this comment block remains.
	
	// Variable, object, and array declarations
	obj = document.getElementById(objId).style;
	var ffOa = new Array();
	var ieOa = new Array();
	
	var n = 100/steps;
	// Setup arrays
	for (i=0;i<steps+1;i++)
	{
		ieOa[i] = 100 - (n*i);
		ffOa[i] = 1 - (n*i/100);
	}
	
	speed = Math.round(speed);
	if (speed<1 || speed>5)
		alert("Javascript error: (function.fadeOut)\nInvalid value for speed: "+speed+"\nSpeed must be between 1 (low) and 5 (high)");
	else
	{
		time = 200;
		for (i=1;i<speed+1;i++)
			time = time - 37.5;
		for (i=0;i<steps+1;i++)
		{
			setTimeout("obj.opacity=\""+ffOa[i]+"\"",time*i);
			setTimeout("obj.filter=\"alpha(opacity="+ieOa[i]+")\"",time*i);
		}
	}
}
