// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function reloadImage(img,new_src) { 
 var myDate = new Date(); 
 img.src = new_src + '?t=' + myDate.getTime(); 
} 
function newCropper(element) {
		new Cropper.Img(
			document.getElementById(element),
			{ onEndCrop: onEndCrop }
		);
}


function onEndCrop( coords, dimensions ) {
	if (document.getElementById( 'y1' )) {
		document.getElementById( 'x1' ).value = coords.x1;
		document.getElementById( 'y1' ).value = coords.y1;
		document.getElementById( 'width' ).value = dimensions.width;
		document.getElementById( 'height' ).value = dimensions.height;
	}
}

	function closeOverlay () {
		 new Effect.Fade('overlay-div', {duration: 0.2});
	}
	
	function reloadPage () {
		window.location.reload();
	}	
	