jQuery.fn.fadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

(function($) {
	$(document).ready(function() {
		
		$('body').addClass('js');
		
		/** Link Click Event
		 *
		 * Add a pretty highlight effect on all 
		 * links inside the content and footer
		 * areas when clicked
		 */
		$('#content-row a:not(.no-effects),#secondary-content-row a:not(.no-effects),#middlecol a:not(.no-effects),#rightcol a:not(.no-effects),#footer-row a:not(.no-effects),#footer a:not(.no-effects)').click(function(event) {
			$(this).animate({
				opacity: '.5'
			}, 200).animate({
				opacity: '1'
			}, 200);
		});
		
		/** Link Hover
		 *
		 * Add a pretty hover effect on all 
		 * links inside the content and footer
		 * areas
		 */
		$('#content-row a:not(.no-effects),#secondary-content-row a:not(.no-effects),#middlecol a:not(.no-effects),#rightcol a:not(.no-effects),#footer-row a:not(.no-effects),#footer a:not(.no-effects)').hover(
			function(event) {
				$(this).animate({
					color: '#307ef2'
				}, 150);
			},
			function(event) {
				$(this).animate({
					color: '#1f5099'
				}, 150);
			}
		);
		
		/** Opacity Click Event
		 *
		 * .opacity-hover elements have a special
		 * onClick event
		 */
		$('a.opacity-hover').click(function(event) {
			$(this).dequeue().animate({
				opacity: ".5"
			}, 200).animate({
				opacity: '1'
			}, 200);
		});
		
		/** Opacity Hover
		 *
		 * .opacity-hover elements are 75% opacity
		 * until onHover or onFocus
		 */
		$('.opacity-hover').css({
			opacity: ".75"
		});
		
		$('.opacity-hover').hover(
			function(event) {
				$(this).dequeue().animate({
					opacity: "1"
				}, 150);
			},
			function(event) {
				$(this).dequeue().animate({
					opacity: ".75"
				}, 150);
			}
		);
		
		/** Pending Reveal
		 *
		 * Hides .pending-reveal elements and
		 * inserts a "More…" link above them 
		 */
		$('.pending-reveal').hide();
		$('.pending-reveal').each(function(i) {
			$(this).attr('id', 'pending-reveal-' + i);
			$(this).before('<p><a href="#pending-reveal-' + i + '" class="jsreveal" rel="pending-reveal-' + i + '">More…</a></p>');
		});
		
		$('.jsreveal').live('click', function(event) {
			if (event.button != 2) {
				$(this).blur();
				var elementId = $(this).attr('rel');
				$(this).animate({opacity: "0"}, 250).slideUp(500);
				$('#' + elementId).slideDown(500);
				event.preventDefault();
			}
		});
		
	});
})(jQuery);