// Remember to invoke within jQuery(window).load(...)
			// If you don't, Jcrop may not initialize properly
			/*
			jQuery(window).load(function(){

				$('#cropbox').Jcrop({
					onChange: showPreview,
					onSelect: showPreview,
					aspectRatio: 1,
					//setSelect:   [ 100, 100, 49, 49 ],
					//allowResize: 0,
					//minSize: [ 100, 100 ],
					//maxSize: [ 100, 100 ],
					onSelect: updateCoords
				});

			});
			*/

			function updateCoords(c)
			{
				$('#x').val(c.x);
				$('#y').val(c.y);
				$('#w').val(c.w);
				$('#h').val(c.h);
			};
			
			function checkCoords()
			{
				if (parseInt($('#x').val())) return true;
				alert('Please select a crop region then press submit.');
				return false;
			};

			// Our simple event handler, called from onChange and onSelect
			// event handlers, as per the Jcrop invocation above
			function showPreview(coords)
			{
			var imgwidth = $("#cropbox").attr('width');
			var imgheight = $("#cropbox").attr('height');
			
				if (parseInt(coords.w) > 0)
				{
					var rx = 76 / coords.w;
					var ry = 76 / coords.h;

					jQuery('#preview').css({
						width: Math.round(rx * imgwidth) + 'px',
						height: Math.round(ry * imgheight) + 'px',
						marginLeft: '-' + Math.round(rx * coords.x) + 'px',
						marginTop: '-' + Math.round(ry * coords.y) + 'px'
					});
				}
			}
