function mouseAnim(config) {
	var callback = this;
	
	this.obj = config.attachTo;
	this.origY = this.obj.offsetTop;
	this.origX = this.obj.offsetLeft;
	
	this.curX = this.origX
	this.curY = this.origY
	this.tarX = this.curX
	this.tarY = this.tarX
	
	this.animInt = null;
	
	this.obj.onmouseover = function() { callback.mi(); }
	this.obj.onmouseout = function() { callback.mo(); }
	
	this.mi = function () {
		clearInterval(this.animInt);
		this.tarY = this.origY + config.overY;
		this.tarX = this.origX + config.overX;
		this.animInt = setInterval(function() { callback.moveTowards() }, 10);
	}
	this.mo = function () {
		clearInterval(this.animInt);
		this.tarY = this.origY;
		this.tarX = this.origX;
		this.animInt = setInterval(function() { callback.moveTowards() }, 10);
		
	}
	this.moveTowards = function () {
		
		if (this.curX > this.tarX) { this.curX-- }
		if (this.curX < this.tarX) { this.curX++ }
		if (this.curY > this.tarY) { this.curY-- }
		if (this.curY < this.tarY) { this.curY++ }
		
		this.obj.style.left = this.curX + "px";
		this.obj.style.top = this.curY + "px";
		
		if (this.curX == this.tarX && this.curY == this.tarY) { clearInterval(this.animInt); }
		
	}
}


window.onload = function() {
	new mouseAnim({attachTo: document.getElementById('siteswitch'), overY: 10, overX: 0});
}
