
$(document).ready(function() {
	$('a.new-window').click(function() { window.open(this.href); return false; });

	if(location.pathname === "/how-to" || location.pathname === "/hass-variety" || location.pathname === "/hass-kids" || location.pathname === "/nutrition" || location.pathname === "/recipes-and-entertaining" || location.pathname === "/avoworld")
	{
		$('#left-column .add-this-button-wrapper').css('top','11px');
	}
	
	// Social Media Icon Rollover Message for icons in top left
	var url = location.href;
	if(url.indexOf("print") == -1) {	
		$('#container').append('<div id="socialMediaMessage"><div id="habMessage">* Please Note: By clicking this link you will be exiting AvocadoCentral.com to a Web site maintained by a third party. For HAB\'s policy on third party Web sites, please read the Hass Avocado Board Disclaimer.</div></div>');
	}
	$('#socialMediaMessage')
	.css('opacity','0.75')
	.css('position','fixed')
	.css('color','#ffffff')
	.css('background', '#000')
	.css('z-index','1000')
	.css('margin-left', '188px')
	.css('top','68px')
	.css('height','80px')
	.css('width','385px')
	.hide();


	$('#habMessage').css('padding','10px').css('color','#ffffff');

	$('#social-icons').hover(function(){$('#socialMediaMessage').css('top','68px');}, function(){ $('#socialMediaMessage').stop(true, true).fadeOut('slow'); });
	
	var socialMediaIcons	= $('#social-icons a');
	socialMediaIcons.each(function(){
		var href		= $(this).attr("href");
		if(href.indexOf("avocadocentral.com") != -1 ) {
			$(this).hover(function() { 
				$('#socialMediaMessage').stop(true, true).fadeOut('slow'); 
			}, function(){});		
		} else {
			$(this).hover(function(){ 
				$('#socialMediaMessage').stop(true, true).fadeIn('slow'); 
			}, function(){});
		}
	});	
	
	// Social Media Icon Rollover Message for links in body with class social-media-links
	$('.social-media-links').append('<div id="socialMediaLinks"><div id="leaveMessage">* Please Note:<br /> By clicking this link you will be exiting AvocadoCentral.com<br /> to a Web site maintained by<br /> a third party. For HAB\'s policy<br /> on third party Web sites,<br /> please read the Hass Avocado Board Disclaimer at www.avocadocentral.com/disclaimer</div></div>');
	$('#leaveMessage').css('padding','10px').css('color','#ffffff').css('font-size','10px').css('line-height','15px');
	$('#socialMediaLinks')
	.css('opacity','0.75')
	.css('position','relative')
	.css('color','#ffffff')
	.css('background', '#000')
	.css('z-index','1000')
	.css('right', '255px')
	.css('bottom','350px')
	.css('height','150px')
	.css('width','200px')
	.css('padding', '10px')
	.hide();
		
	var socialMediaLinks	= $('.socialMediaAnchorLink');
	
	socialMediaLinks.each(function(){
		$(this).hover(
			function(){ 
				$('#socialMediaLinks').stop(true, true).fadeIn('slow'); 
			}, 
			function(){ 
				$('#socialMediaLinks').stop(true, true).fadeOut('slow'); 
			}
		);
	});
	$('.social-media-links').hover(function(){}, function(){ $('#socialMediaLinks').stop(true, true).fadeOut('slow'); });
	
	//Added by Rylan Bowers 7/7/2010
	//This is for this page: /recipes-and-entertaining/hass-avocado-party-tips-entertaining/progressive-potluck-dinner-party-tips
	$('.socialMediaAnchorLinkNew').hover(function(){
											   $('#socialMediaMessage').css('top','75%');
											   $('#socialMediaMessage').stop(true, true).fadeIn('slow'); }, function(){ 
													$('#socialMediaMessage').stop(true, true).fadeOut('slow'); });
													
													
	var showMoreLink		= "<a href='#' id='showMoreLink'>Show More</a>"
	$('#show_more').hide();
	$('#show_more').parent().append(showMoreLink);	
	
	var showMoreOpen		= true;
	$('#showMoreLink').click(function(){
		if(showMoreOpen) {
			$('#show_more').show('fast');	
			$('#showMoreLink').html("[Close]");
			showMoreOpen	= false;
		} else {				
			$('#showMoreLink').html("Show More");
			$('#show_more').hide('fast');
			showMoreOpen	= true;
		}
		return false;	
	});
});

/**
 * Clears text from an input field.
**/
function clearText(thefield) { if(thefield.defaultValue==thefield.value) { thefield.value = ""; } }

/**
 * Replaces text in an input field.
**/
function replaceText(thefield) { if (thefield.value=="") { thefield.value = thefield.defaultValue; } }
