/*
 * Images
 */

$(document).ready(function(){   
	$('img').each(function (id, val) {
		var width  = val.naturalWidth;
		var height = val.naturalHeight;
		/*console.debug ("height: " + height);*/
		
		if (height > 150) {
			newHeight = height * 0.5;
			newWidth = width * 0.5;
			$(val).height (newHeight);
			$(val).width (newWidth);
			
			$(val).attr ("title", $(val).attr ("title") + ": Click to magnify!");
			$(val).css ("cursor", "pointer");
			
			$(val).toggle (
				function () {
					$(this).stop()
					$(this).animate({
						width: width,
						height: height
					});
				},
				function () {
					$(this).stop()
					$(this).animate({
						width: (this.naturalWidth * 0.5),
						height: (this.naturalHeight * 0.5)
					});
				}
			);
		}
	});
});
