function Move( obj, speed )
{
	this.element = obj;
	this.speed = speed;
	
	this.animatecounter = 0;
	this.animator = 0;
	this.is_animating = 0;

	this.position = new Array();
	
	this.position['original'] = new Array();
	this.position['original']['x'] = this.element.offsetLeft;
	this.position['original']['y'] = this.element.offsetTop;
	
	this.position['current'] = new Array();
	this.position['current']['x'] = this.element.offsetLeft;
	this.position['current']['y'] = this.element.offsetTop;		
	
	this.position['new'] = new Array();
	this.position['new']['x'] = 0;
	this.position['new']['y'] = 0;
	
	this.difference = new Array();
	this.difference['x'] = 0;
	this.difference['y'] = 0;
	
	this.direction = new Array();
	this.direction['x'] = 0;
	this.direction['y'] = 0;
	
	this.newy = 0;
	this.newx = 0;
}

Move.prototype.set = function( type , value )
{
	switch( type )
	{
		case 'x':
			this.position['new']['x'] = value;
		break;
		
		case 'y':
			this.position['new']['y'] = value;
		break;		
		
		case 'speed':
			this.speed = value;
		break;
	}
}

Move.prototype.init = function()
{
	if( this.is_animating == 1 )
	{
		clearInterval( this.animator );
		this.is_animating = 0;
	}

	this.position['original']['x'] = this.element.offsetLeft;
	this.position['original']['y'] = this.element.offsetTop;
	
	this.position['current']['x'] = this.element.offsetLeft;
	this.position['current']['y'] = this.element.offsetTop;	
	
	
	this.difference['x'] = ( this.position['current']['x'] < this.position['new']['x'] ? ( this.position['new']['x'] - this.position['current']['x'] ) : ( this.position['current']['x'] - this.position['new']['x'] ) );
	this.difference['y'] = ( this.position['current']['y'] < this.position['new']['y'] ? ( this.position['new']['y'] - this.position['current']['y'] ) : ( this.position['current']['y'] - this.position['new']['y'] ) );
	
	this.direction['x'] = ( this.position['current']['x'] < this.position['new']['x'] ? 1 : 0 );
	this.direction['y'] = ( this.position['current']['y'] < this.position['new']['y'] ? 1 : 0 );

	
	this.xdone = false;
	this.ydone = false;
	
	this.is_animating = 1;
	this.animatecounter = 0;
	this.animator = setInterval( this.animate.bind( this ), 10 );
}

Move.prototype.animate = function()
{
	
	this.xdone = ( (( Math.sin( this.animatecounter / this.speed ) * this.difference['x'] )) < this.difference['x']-2 && this.xdone == false ? false : true );
	this.ydone = ( (( Math.sin( this.animatecounter / this.speed ) * this.difference['y'] )) < this.difference['y']-2 && this.ydone == false ? false : true );
	
	xposition = 0;
	yposition = 0;
	//
	// X position
	//
	
	if( !this.xdone )
	{
		xposition = ( Math.sin( this.animatecounter / this.speed ) * this.difference['x'] );
	}
	else
	{
		xposition = this.difference['x'];
	}
	
	if( this.direction['x'] == 1 )
	{

		this.element.style.left = ( xposition + this.position['current']['x'] ) + 'px';

	}
	else
	{
		this.element.style.left = ( this.position['current']['x'] - xposition ) + 'px';
	}
	
	//
	// Y position
	//
	
	if( !this.ydone )
	{
		yposition = ( Math.sin( this.animatecounter / this.speed ) * this.difference['y'] );
	}
	else
	{
		yposition = this.difference['y'];
	}
	
	if( this.direction['y'] == 1 )
	{
		this.element.style.top = ( yposition + this.position['current']['y'] ) + 'px';

	}
	else
	{
		this.element.style.top = ( this.position['current']['y'] - yposition ) + 'px';
	}

	this.animatecounter++;
	
		
	if( this.xdone && this.ydone )
	{
		this.is_animating = 0;
		clearInterval( this.animator );
	}

}
