function Rollover(imageId, graySrc, src, minWidth, minHeight, maxWidth, maxHeight){
	var img,x,y;
	function init(){
		this.img = img = document.getElementById(imageId);
		img.src = graySrc;
		img.isComplete=false;
		img.style.position="static";
		img.style.width = minWidth + "px";
		img.style.height = minHeight + "px";
		img.onmouseover = over;
		preLoad(src);
	}
	
	function over(){
		OutAnim=null;
		img.onmouseover=null;
		img.onmouseout=out;
		img.src=src;
		img.isOut = false;
		getParentDiv(img).style.zIndex=100;
		img.style.position="absolute";
		img.style.zIndex=100;
		var x = img.offsetLeft-5;//-maxWidth/2;
		var y = img.offsetTop-5;//-maxHeight/2;
		var OverAnim = new Animation();
		OverAnim.resize(img, maxWidth, maxHeight, 4, function(){
			img.isComplete = true;
			OverAnim=null;
			if(img.isOut) out();
		});
		new Animation().move(img, x, y, 2);
	}
	this.over = over;
	
	function out(){
		if(!img.isComplete){
			img.isOut=true;
			return;
		}
		img.isOut=false;
		if(typeof OverAnim!="undefined") OverAnim.onComplete() ;
		getParentDiv(img).style.zIndex=1;
		img.onmouseout=null;
		img.isOut = true;
		OutAnim=new Animation()
		OutAnim.resize(img, minWidth, minHeight, 4, function(){
			img.onmouseover = over;
			img.src=graySrc;
			img.isComplete=false;
		});
		var x = img.offsetLeft+5;//-maxWidth/2;
		var y = img.offsetTop+5;//-maxHeight/2;
		new Animation().move(img, x, y, 2, function(){
			img.isOut=false;
			//OutAnim=null;
		});
	}
	this.out = out;
	
	function attachEvent(o,h,e){
		if(o.attachEvent) o.attachEvent("on"+h,e);
		else if(o.addEventListener) o.addEventListener(h,e,false);
	}
	
	function detachEvent(o,h,e){
		if(o.detachEvent) o.detachEvent("on"+h,e);
		else if(o.removeEventListener) o.removeEventListener(h,e,false);
	}
	
	function preLoad(s){
		var i = new Image();
		i.src=s;
	}
	
	function getParentDiv(img){
		return img.parentNode.parentNode;
	}
	
	init();
}
