//jQuery.noConflict();
jQuery(document).ready(function($){
	// called before Cufon.replace 
	//$('#elements, .elements').html(function(i,v){ 
	//return v.replace(/\s+</g,'<').replace(/>\s+/g,'>');
	// this will remove all whitespace 
	//return v.replace(/[\t\n\r]+</g,'<').replace(/>[\t\n\r]+/g,'>');
	//this will leave spaces and only strip newlines/tabs 
	//}); 	
	//custom font
	//Cufon.replace('h1, h2, h3, #buttons');
	//Cufon.replace('#rightCol .links li, .prodInfo .title, .view a, .cart h4, .cart strong');
	
	//email spam protection - Example Markup: <span class="email">name[at]domain[dot]com</span>
	$('.email').each(function() {
		var $email = $(this);
		var address = $email.text()
		.replace(/\s*\[at\]\s*/, '@')
		.replace(/\s*\[dot\]\s*/g, '.');
		$email.html('<a href="mailto:' + address + '">'+ address +'</a>');
	});

	$('sup.reg').each(function() {
		var $sup = $(this);
		var registered = $sup.text()
		.replace(/\s*\[r\]\s*/g, '&reg;');
		$sup.html(''+ registered +'');
	});
	
	$('span.copy').each(function() {
		var $copy = $(this);
		var copyright = $copy.text()
		.replace(/\s*\[c\]\s*/g, '&copy;');
		$copy.html(''+ copyright +'');
	});


	if($("#buttons")) {
		$('#buttons li:last').addClass('last');
		//$('#buttons li:last-child').addClass('last');
	  	//$("#buttons li:has('ul') > a").parent("li").addClass('parent');
		//$("#buttons li:has('ul') > a").parent("li").mouseover(function(){$(this).addClass('parent')});
		//$("#buttons li:has('ul') > a").parent("li").mouseout(function(){$(this).addClass('parent')});

		$('#buttons li ul').hide();
		$("#buttons li.selected ul").show();

		//$('#buttons li ul li ul').hide();
		//$("#buttons li.selected ul li.selected ul").show();

	}

	//Expanders
	$('.expand').next('div').hide();
	$('.first').click(function() {
		//$(this).toggleClass('expanded').next('div').slideToggle();
		$('.first').toggleClass('expanded').next('div').slideToggle("slow");
		$('.second').removeClass('expanded').next('div').slideUp("slow");
		$('.third').removeClass('expanded').next('div').slideUp("slow");
		//$('.first').parent().addClass('expanded');
		return false;
	});

	//$('.expand').next('div').hide();
	$('.second').click(function() {
		//$(this).toggleClass('expanded').next('div').slideToggle();
		$('.second').toggleClass('expanded').next('div').slideToggle("slow");
		$('.first').removeClass('expanded').next('div').slideUp("slow");
		$('.third').removeClass('expanded').next('div').slideUp("slow");
		//$('.second').parent().addClass('expanded');
		return false;
	});
	
	//$('.expand').next('div').hide();
	$('.third').click(function() {
		//$(this).toggleClass('expanded').next('div').slideToggle();
		$('.third').toggleClass('expanded').next('div').slideToggle("slow");
		$('.first').removeClass('expanded').next('div').slideUp("slow");
		$('.second').removeClass('expanded').next('div').slideUp("slow");
		//$('.second').parent().addClass('expanded');
		return false;
	});
	
	//$('.expand').next('div').hide();
	//$('.expand').click(function() {
	//	$(this).toggleClass('expanded').next('div').slideToggle();
	//	return false;
	//});
	
	//$('.hide').hide();
	//$('.show').click(function() {
	//	$(this).prev('.hide').slideDown();
	//	$(this).remove();
	//	return false;
	//});
	
	//Seasonality
	//$(".produce").hide();

	//$(".season").toggle(function(){
	//	$(this).addClass("active"); 
	//	}, function () {
	//	$(this).removeClass("active");
	//});
	
	//$(".season").click(function(){
	//	$(this).parent().next(".produce").slideToggle("slow,");
	//});

});
