jQuery(document).ready(function(){
	jQuery(".axPhotoDetail ul li").hover(
		function() {
			jQuery("span", this).fadeIn(100);
		},
		function() {
			jQuery("span", this).fadeOut(500);
		}
	);
	jQuery(".axPhotoDetail ul li").click(
		function() {
			jQuery(".axPhotoDetail img").click();
		}
	);
	jQuery(".axTags a").hover(
		function() {
			jQuery("#axTag" + this.rel + " span").fadeIn(100);
		},
		function() {
			jQuery("#axTag" + this.rel + " span").fadeOut(500);
		}
	);
	jQuery('[id$="btnEditPhoto"]').click(
		function() {
			jQuery("#axDisplayPanel").toggle();
			jQuery('[id$="pnlEdit"]').toggle();

			jQuery("html, body").animate({scrollTop: jQuery('[id$="pnlEdit"]').offset().top}, 1500);
			return (false);
		}
	);
	jQuery('[id$="btnDeletePhoto"]').click(
		function() {
			return (confirm("Are you sure you want to delete this photo?"));
		}
	);
	jQuery("#btnCancel").click(
		function() {
			jQuery('[id$="pnlEdit"]').toggle();
			jQuery("#axDisplayPanel").toggle();
			jQuery("html, body").animate({scrollTop: jQuery("#axPhotoOuter").offset().top}, 1000);
			return (false);
		}
	);
	jQuery(".axCommentPanel textarea").click(
		function() {
			jQuery(this).val('');
			jQuery(this).unbind("click");
			jQuery(this).keyup();
		}
	);

	jQuery(".axEditPanel textarea").textlimit('div.counter', 2048);
	jQuery(".axCommentPanel textarea").textlimit('span.counter', 2048);
});

jQuery.fn.fadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

