$(function() {
	
	/* All Pages */	
	$('input').placeholder(); //Make the "Placeholder" attribute work on browsers that don't support it
	
	var zIndexAdjust = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexAdjust);
		zIndexAdjust += 10;
	}); // Adjust z-index to fix the zindex bug in IE6 and IE7
	
	/* HOMEPAGE */
	
		$('#catBtn').click(function() {
			var buttonPos = $('#catBtn').offset();
			var theDiff = posBottom() - buttonPos.top;		
			
			if (theDiff <= 150) {
				$('.categories').toggle('fast');
				$('.categories').css({
					left: 70,
					bottom: 194
				});
			}
			else {
				$('.categories').toggle('fast');		
				$('.categories').css({
					left: 70
				});
			}
			return false;
		}); 	
	
	
	/* OPT-IN PAGES */
	
	$('#options li').hover(function() {
		$(this).stop(true, true).animate({borderColor: '#670303'}, 1000);
	}, function(){
		$(this).stop().animate({borderColor: '#dadada'}, 'fast');
	});  // Animate border color on opt-in pages elements
	
	/* COACHING */

	var p1 = $('p.1');
	
	$('#summary p:not(.intro)').hide();
	$('.program h3:not(.static)').stop().hover(function() {
		var thisClass = $(this).attr('class');
		p1.hide();
		$('p.'+thisClass).show();
	}, function() {
		var thisClass = $(this).attr('class');			
		p1.fadeIn(100);			
		$('p.'+thisClass).hide();
	});												
		
});	

function pageHeight() {
	return $(window).height();
	}
function posTop() {
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
	} 
function posBottom() {
	return posTop()+pageHeight();
	}
                    
