function bindEvent(name) {
	$("#" + name).bind("mouseenter",function() {
		$("#" + name).animate({"width": "+=15px"},"normal");
 	 }).bind("mouseleave",function() { 
 		$("#" + name).animate({"width": "-=15px"},"normal");
  });
}
function zoom_image( img, width, height ) { 
	var url = (typeof(img)=='string'?img:img.src);
	width+=40;
	height+=40;
	if( !width || width > screen.availWidth - 40 )
		width = screen.availWidth - 40;
	if( !height || height > screen.availHeight - 40 )
		height = screen.availHeight - 40;
	var left = parseInt((screen.availWidth/2) - (width/2));
	var top = parseInt((screen.availHeight/2) - (height/2)) - 20;
	var windowFeatures = "width=" + width + ",height=" + height +
		",resizable=yes,left=" + left + ",top=" + top +
		"screenX=" + left + ",screenY=" + top + ",scrollbars=yes";
	new_window=window.open(url, "", windowFeatures);
	return false;
}

/* legioners section */
function disable_all()
{
	var $div = $('#page_overlay');
	if (!$div.length) {
		$('<div>').appendTo('body').height($(document).height()).width($(document).width()).css({
			'background-color': '#000000',
			'opacity': '0.5',
			'position': 'fixed',
			'left': 0,
			'top': 0,
			'z-index': 1
		})
		.attr('id', 'page_overlay');
	}
	$div.show();
}
function enable_all()
{
	$('#page_overlay').hide();
}
function legioner(id) {
	disable_all();
	$( '#legioner' ).html( '&nbsp;' ).load( 'legioner/?id=' + id);
	$( '#legioner' ).stop(true, true).fadeIn("slow");
}
function legioner_close() {
	enable_all();
	$( '#legioner' ).stop(true, true).hide();
}
function addPhotoClickHandlers() {
    $(".photo").click( function() { legioner(this.id) });
}
