window.addEvent('domready', function() {	
	new ArtistWorksListPicZoomGroup("ArtistWorksListPicZoomGroup");
});		//END: Window.AddEvent

var ArtistWorksListPicZoomGroup = new Class({
	options: {
	},

	//Create class instance
	//container = the first argument in "new ArtistWorksListPicZoomGroup" call in "window.addEvent("domready"..."
	initialize: function(container, options) {
		this.setOptions(options);
		this.container = $(container);
		this.zoomStatus = false;
		this.zoomHt = $('ArtistPgWorkInfo').getStyle('height').toInt() + 189;	//(225 + 12) - 48
		this.shrinkHt = $('ArtistPgWorkInfo').getStyle('height').toInt();// - 189;	//(225 + 12) - 48
		
		
		//Adds events to all image elements with the class name 'CatListPic'.
//		$(document.body).getElements('img.CatListPic').addEvents({
/*		this.aItems = $(document.body).getElements('img.CatListPic');
		this.aItems.each(function(imgObj) {
			imgObj.addEvents({
*/
		this.imgElements = $(document.body).getElements('img.CatListPic');
		for(var i = 0; i < this.imgElements.length; i++){
			nextImg = this.imgElements[i];
			
			var tmpStr = nextImg.alt;
			nextImg.addEvents({
			    'mouseenter': function(nextImg){
					if(this.zoomStatus == false){
						//Create morph for photo zoom
						CatListPicZoom = new Fx.Morph(nextImg, {duration: 800, transition: Fx.Transitions.Bounce.easeInOut});
						WorkSpaceZoom = new Fx.Morph($('ArtistPgWorkInfo'), {duration: 600, transition: Fx.Transitions.Bounce.easeInOut});
						
						//Get the wrapper div created by "Slide" function in "moo_slide_artist_info.js"
						var parent = $('ArtistPgWorkInfo').getParent();
						WorkWrapperZoom = new Fx.Morph(parent, {duration: 400, transition: Fx.Transitions.Bounce.easeInOut});
		//				parent.setStyle('height', this.zoomHt);	//Set the height
							
//						var SrcImgEl = parent.getElement('img');
						var patt = /width\=[0-9]{2,3}/;
						var widthStr = patt.exec(nextImg.alt);
		//				document.write("Returned value: " + result);
						var patt = /[0-9]{2,3}/;
						var picWidth = patt.exec(widthStr);

						(function(){	//Delay						
							WorkWrapperZoom.set({		//Zoom wrapper large
							    'height':[this.zoomHt]
							});									
						    WorkSpaceZoom.set({		//Zoom work div large
							    'height':[this.zoomHt]
							});
						    CatListPicZoom.start({		//Zoom pic large
							    'height':[225],
							    'width': [picWidth]
							});
							this.zoomStatus = true;
						}).delay(1000, this);															
					}	//END: if(this.zoomStatus == false) 
			    }.bind(this, nextImg),
			    'mouseleave': function(nextImg){
			    	if(this.zoomStatus == true){
			    		//Create morph for photo zoom
						CatListPicZoomDn = new Fx.Morph(nextImg, {duration: 400, transition: Fx.Transitions.Bounce.easeInOut});
						WorkSpaceZoomDn = new Fx.Morph($('ArtistPgWorkInfo'), {duration: 600, transition: Fx.Transitions.Bounce.easeInOut});
						
						//Get the wrapper div created by "Slide" function in "moo_slide_artist_info.js"
						var parent = $('ArtistPgWorkInfo').getParent();
						WorkWrapperZoomDn = new Fx.Morph(parent, {duration: 800, transition: Fx.Transitions.Bounce.easeInOut});
		//				parent.setStyle('height', this.shrinkHt);	//Set the height
						
						(function(){	//Delay
							CatListPicZoomDn.set({		//Zoom pic small
							    'height':[48],
							    'width': [48]
							});
							WorkSpaceZoomDn.set({		//Zoom work div small
								    'height':[this.shrinkHt]
							});
							WorkWrapperZoomDn.start({		//Zoom wrapper small
								    'height':[this.shrinkHt]
							});						    
							this.zoomStatus = false;
			    		}).delay(1000, this);															
			    	}	//END: if(this.zoomStatus == true)
			    }.bind(this, nextImg)	//END: 'mouseleave': function(){
			});				//END: nextImg.addEvents({
//		}.bind(this));	//END: this.aItems.each(function(imgObj)
		}	//END: for(var i = 0; i < this.imgElements.length; i++)


		//********************************************************************************
	}	//END: initialize
});

ArtistWorksListPicZoomGroup.implement(new Events); // Implements addEvent(type, fn), fireEvent(type, [args], delay) and removeEvent(type, fn)
ArtistWorksListPicZoomGroup.implement(new Options);// Implements setOptions(defaults, options)

