$(document).ready(function(){
	// put anything that needs to run on page load here
	
	popupify(user_logged_in);
	
	// make pictures appear all the same size code monkey!
	$("#property_photo_thumbs li").each(function(i)
	{
		if (i % 3 == 0)
		{
			// determine the max height of the images in this row
			var max_height = 0;
			for (j = 0; j < 3; j++)
			{
				var thumb_index = i + j;
				if ($('#thumb_' + thumb_index).length > 0)
				{
					var current_height = $('#thumb_' + thumb_index + ' img').height();
					if (Number(current_height) > Number(max_height))
					{
						max_height = current_height;
					}
				}
			}
			
			// adjust image heights accordingly
			for (j = 0; j < 3; j++)
			{
				var thumb_index = i + j;
				if ($('#thumb_' + thumb_index).length > 0)
				{
					$('#thumb_' + thumb_index).css('height', Math.ceil(max_height) + 'px');
					$('#thumb_' + thumb_index).css('background', '#eeeeee');
				}
			}
		}
	});
	
	// move `agent_info` block up to bottom of thumbnails
	$("#agent_info").appendTo("#main");
 	var position = $('#property_photo_thumbs').position();
	var height = $('#property_photo_thumbs').height();
	var width = $('#property_photo_thumbs').width();
	$("#agent_info").css( { "position" : "absolute" , 
							"top": (position.top + height + 25) + "px",
							"left": (position.left) + "px"} );

});

function showPicture(src, width, height)
{
	$('#big_picture').attr('src', src);
	$('#big_picture').css('width', width);
	$('#big_picture').css('height', height);
}