function showInfo(element,zoom) {
  $('messagesDisplay').innerHTML =
    'element position: (' + element.offsetLeft + ',' +
    element.offsetTop + ')' + '<br /> element size: (' + element.getWidth() + ',' + element.getHeight() + ')<br />' +
	'Zoom: '+zoom;
}

function topLeft(){
	$('actualImage').style.position = "absolute";
	$('actualImage').style.top = 0;
	$('actualImage').style.left = 0;
	$('actualImage').style.bottom = "";
	$('actualImage').style.right = "";
	
}

function topRight(){
	$('actualImage').style.position = "absolute";
	$('actualImage').style.bottom = "";
	$('actualImage').style.right = 0;
	$('actualImage').style.top = 0;
	$('actualImage').style.left = "";
	
}
function bottomLeft(){
	$('actualImage').style.position = "absolute";
	$('actualImage').style.bottom = 0;
	$('actualImage').style.right = "";
	$('actualImage').style.top = "";
	$('actualImage').style.left = 0;
	
}
function bottomRight(){
	$('actualImage').style.position = "absolute";
	$('actualImage').style.bottom = 0;
	$('actualImage').style.right = 0;
	$('actualImage').style.top = "";
	$('actualImage').style.left = "";
	
}

function centerImage(){
	var image = $('actualImage');
	var box = $('picturewindow');
	
	var imageSize = image.getDimensions();
	var boxSize = box.getDimensions();
	
	var imagePosition = image.cumulativeOffset();
	var boxPosition = box.cumulativeOffset();
	
	var boxMiddlePosition = {
		left: boxPosition['left'] + (boxSize['width'] /2),
		top: boxPosition['top'] + (boxSize['height'] /2)
	};			
	
	var boxMiddleDistance = {
		left: boxSize['width'] / 2,
		top: boxSize['height'] / 2
	};
	
	
	image.style.left = boxMiddleDistance['left'] - (imageSize['width'] / 2)+"px"; 
	image.style.top = boxMiddleDistance['top'] - (imageSize['height'] / 2)+"px"; 
	
}

function colorizeMe(action){
	new Ajax.Request(
		'/default/index/'+action, 
		{ 	method:'post',   
			onSuccess: function(transport){
				json = transport.responseText.evalJSON();
				$('actualImage').src = $('actualImage').src + Math.floor(Math.random()*999999+1);
				$('pleasewaitdiv').remove();
			},
			onCreate: function (){
				var pleasewaitdiv = document.createElement("div");
				var pleasewaitimg = document.createElement("img");
				pleasewaitdiv.id = "pleasewaitdiv";
				pleasewaitimg.src = "/images/120837393833.gif";
				pleasewaitdiv.appendChild(pleasewaitimg);
				$("stage").appendChild(pleasewaitdiv);
			}   
		}
	); 	
}