	var ImageTaggerControl = {
			/**
			 * Holds the current Cropper.Img object
			 * @var obj
			 */
			curCrop: null,
			
			/**
			 * Initialises the cropImageManager
			 *
			 * @access public
			 * @return void
			 */
			init: function() {
				this.attachCropper();
			},
			
			/**
			 * Handles the changing of the select to change the image, the option value
			 * is a pipe seperated list of imgSrc|width|height
			 * 
			 * @access public
			 * @param obj event
			 * @return void
			 */
			onChange: function( e ) {
				var vals = $F( Event.element( e ) ).split('|');
				this.setImage( vals[0], vals[1], vals[2] ); 
			},
			
			/**
			 * Sets the image within the element & attaches/resets the image cropper
			 *
			 * @access private
			 * @param string Source path of new image
			 * @param int Width of new image in pixels
			 * @param int Height of new image in pixels
			 * @return void
			 */
			setImage: function( imgSrc, w, h ) {
				$( 'imageBeeingTagged' ).src = imgSrc;
				$( 'imageBeeingTagged' ).width = w;
				$( 'imageBeeingTagged' ).height = h;
				this.attachCropper();
			},
			
			/** 
			 * Attaches/resets the image cropper
			 *
			 * @access private
			 * @return void
			 */
			attachCropper: function() {
				if( this.curCrop == null ) this.curCrop = 
					new Cropper.Img( 'imageBeeingTagged', 
					{ 
						displayOnInit: true,
            			minWidth: 50,
            			minHeight: 50,
            			maxWidth: 150,
            			maxHeight: 150,
            			//ratioDim: { x: 1, y: 1 },
            			captureKeys: false,
						onEndCrop: onEndCrop
					 } );
				else this.curCrop.reset();
			},
			
			/**
			 * Removes the cropper
			 *
			 * @access public
			 * @return void
			 */
			removeCropper: function() {
				if( this.curCrop != null ) {
					this.curCrop.remove();
					this.curCrop = null;
				}
			},
			
			/**
			 * Resets the cropper, either re-setting or re-applying
			 *
			 * @access public
			 * @return void
			 */
			resetCropper: function() {
				this.attachCropper();
			}
		};


	/**
	* function onEndCrop
	*/
	function onEndCrop( coords, dimensions ) {
		$( "naImageTag_x1" ).value = coords.x1;
		$( "naImageTag_y1" ).value = coords.y1;
		$( "naImageTag_x2" ).value = coords.x2;
		$( "naImageTag_y2" ).value = coords.y2;
		$( "naImageTag_width" ).value = dimensions.width;
		$( "naImageTag_height" ).value = dimensions.height;
	}
	
