	var mssImgEnlarge = new Class({
		initialize: function(options) {
			this.options = Object.extend({bImgs: '.mssBigCont img',sImgs: '.mssSmlCont img'}, options || {});
			this.index = 0;
			this.sImgs = $$(this.options.sImgs);
			this.bImgs = $$(this.options.bImgs);
			this.multipleImgs = this.options.multipleImgs || false;
			this.ratio = 1.5;
			this.smlWidth = 150;
			this.smlHeight = 150;
			this.bigWidth = 300;
			this.bigHeight = 300;
			this.init();
		},
		init: function(){
			this.sImgs.each(function(s,i){s.addEvent('click', this.enlarge.bind(this));},this);
			this.bImgs.each(function(b,i){b.addEvent('click', this.reduce.bind(this));b.setStyle('display','none');}, this);
		},
		enlarge: function(e){ 
			var simg = (e.target) ? e.target : ((e.srcElement) ? e.srcElement : null);
			this.index = this.sImgs.indexOf(simg);
			var bimg = $(this.bImgs[this.index]);
			bimg.setStyle('display','block');
			this.smlHeight = simg.offsetHeight;
			this.smlWidth = simg.offsetWidth;
			this.ratio = bimg.offsetHeight / this.smlHeight;
			bimg.style.width=this.smlWidth + "px";
			bimg.style.height=this.smlHeight + "px";
			simg.parentNode.style.zIndex=1;
			bimg.parentNode.style.zIndex=1000;
			simg.set('morph',{duration: 1000});
			bimg.set('morph',{duration: 1000});
			simg.morph({'width':[this.smlWidth * this.ratio],'height':[this.smlHeight * this.ratio],'opacity':[0]});					
			bimg.morph({'width':[this.smlWidth * this.ratio],'height':[this.smlHeight * this.ratio],'opacity':[1]});		
		},
		reduce: function(e){
			var bimg = (e.target) ? e.target : ((e.srcElement) ? e.srcElement : null);
			var simg = $(this.sImgs[this.index]);
			var bigHeight = bimg.offsetHeight;
			var bigWidth = bimg.offsetWidth;
			this.ratio = bimg.offsetHeight / this.smlHeight;
			simg.parentNode.style.zIndex=1000;
			bimg.parentNode.style.zIndex=1;
			simg.set('morph',{duration: 1000});
			var bimgFx = new Fx.Morph(bimg, {duration: 1000});
			bimgFx.start({'width':[this.smlWidth],'height':[this.smlHeight],'opacity':[0]}).chain(function(){bimg.setStyle('display','none');bimg.style.width=bigWidth + "px";  bimg.style.height=bigHeight + "px";});			
			simg.morph({'width':[this.smlWidth * this.ratio, this.smlWidth],'height':[this.smlHeight * this.ratio, this.smlHeight],'opacity':[0,1]});
         
		}
	});
	window.addEvent('domready',function(){var myImg=new mssImgEnlarge()});
