$(document).ready(function() {
	/* Style Updates */
	$("#style_updates #thumbs a").click(function() {
		if ($(this).attr("class")!="active") {
			$("#image_large img").attr("src",$(this).attr("href"));
			$("#thumbs a.active").removeClass("active");
			$(this).addClass("active");
			$("#items_shown ul.active").removeClass("active");
			$("#items_shown #" + $(this).attr("id") + "_items").addClass("active");
			
		}
		return false;
	});
	
	/* Contact Advisor */
	$("#contact_advisor #select_symptoms").change(function() {
		location.href=$(this).val();
		return false;
	});
	
	/* Wellness Advisor Landing */
	$("#articles_collapsible h4").click(function() {
		var pDiv = $(this).parent();
		var toggleDiv = $(".teaser", pDiv); 
		if (pDiv.is(".closed")) {
			//alert(pDiv.attr("class"));
			$(".open .teaser").hide("fast");
			$(".open").removeClass("open").addClass("closed");
			toggleDiv.show("fast");
			pDiv.removeClass("closed").addClass("open");
		} else if (pDiv.is(".open")) {
			toggleDiv.hide("fast");
			pDiv.removeClass("open").addClass("closed");
		} 
	});
	
	
	/* Wellness Advisor Landing */
	$("#newsletter_collapsible h4").click(function() {
		var pDiv = $(this).parent();
		var toggleDiv = $(".teaser", pDiv); 
		if (pDiv.is(".closed")) {
			//alert(pDiv.attr("class"));
			$(".open .teaser").hide("fast");
			$(".open").removeClass("open").addClass("closed");
			toggleDiv.show("fast");
			pDiv.removeClass("closed").addClass("open");
		} else if (pDiv.is(".open")) {
			toggleDiv.hide("fast");
			pDiv.removeClass("open").addClass("closed");
		} 
	});
	
});

function emailPage(){
	var bodyMessage="Hi, I thought that you would enjoy the following article on the Clary Sage Organics website:%0D%0D" + location.href;
	var mailToLink = 'mailto:?subject=Clary Sage Organics article&body='+bodyMessage;

	emailWindow = window.open(mailToLink,'emailWindow'); 
	if (emailWindow && emailWindow.open &&!emailWindow.closed) emailWindow.close(); 
	return false;
} 
