document.observe("dom:loaded",bindClickAction);
function bindClickAction() {
 $$("a.other").each(function (element) {
 	element.observe("click" , showLargeImageFade);
 });
}
function showLargeImageFade (e) {
	e.stop();
	var target = (e.target.href) ? e.target.href : e.currentTarget.href;
	//allClose();
	//target.setStyle("background-position:0 -240px");

	var imgURL = target + ".jpg";
	var textURL = target + "_comment.jpg";
	
	var img = '<img src ="'+ imgURL +'" alt "" id="photo" width="300" height="450" />';
	var text = '<img src ="'+ textURL +'" alt "" id="comment" width="350" height="330" />';
	
	$("sidebarinner").update(img);
	$("textareatopinner").update(text);
	
	var photo = $("photo");
	var comment = $("comment");
	
	photo.hide();
	comment.hide();
	
	photo.setStyle("visibility:visible");
	comment.setStyle("visibility:visible");
	
	photo.observe("load" , function (event) {
		event.stop();
		var element = photo;
		new Effect.Appear(element, {duration:1.0, afterFinish:function () {
			$("sidebar").setStyle("background-image:url("+ imgURL +")");
			photo.setStyle("visibility:hidden");
		}});
	});
	
	comment.observe("load" , function (event) {
		event.stop();
		var element = comment;
		new Effect.Appear(element, {duration:1.0, afterFinish:function () {
			$("textareatop").setStyle("background-image:url("+ textURL +")");
			comment.setStyle("visibility:hidden");
		}});
	});

return false;
}

function allClose () {
	$$("a.other").each(
		function(element){
			element.setStyle("background-position:0 0");
		}
	);
}

