FishEye = Class.create();
FishEye.prototype = {
	
	/*Costruttore*/
	initialize: function(zoomHeight, zoomWidth, zoomTop, originalHeight, originalWidth){
		this.zoomHeight = zoomHeight;
		this.zoomWidth = zoomWidth;
		this.zoomTop = zoomTop;
		this.originalHeight = originalHeight;
		this.originalWidth = originalWidth;
		this.startZoom = null;
	},
	
	zoomIn: function(element){
		this.startZoom = new Effect.Morph(element, {
			style: {
				height: this.zoomHeight,
				width: this.zoomWidth,
				top: this.zoomTop
			},
			afterFinish: function(){
				if(element.next('span') != null){
					Element.show(element.next('span'));
				}
			}
		})
	},
	
	zoomOut: function(element){
		if(element.next('span') != null){
			Element.hide(element.next('span'));
		}
		if(this.startZoom != null){
			this.startZoom.cancel();
		}
		new Effect.Scale(element, 100, {
			scaleFromCenter: true,
			scaleMode: {
				originalHeight: this.originalHeight, /*59*/
				originalWidth: this.originalWidth /*83*/
			}
		})
	}
	
};