(function($) {
	
	// Suckerfish for IE6
	sfHover = function() {
		$('.suckerfish li').hover(
			function() {
				$(this).addClass('sfhover');
			},
			function() {
				$(this).removeClass('sfhover');
			}
		);
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);
	
	// Store menu
	var crapPanel = $('#crap_panel');
	
	$('.crap_panel-links a').hover(
		function() {
			var hoverClass = $(this).attr('class');
			if (hoverClass) { crapPanel.html($('#crap_panel-data .'+hoverClass).html()); }
		},
		function() {
			crapPanel.html('');
		}
	);
	
	// Front page slides
	$('#specials').cycle({
		timeout: 10000,
		fx: 'fade'
	});
	
	// Accreditation carousel
	var accreditation = $('.accreditation');
	
	accreditation.jCarouselLite({
		auto: 3000,
		speed: 1000,
		visible: 3
	});
	
	$('li', accreditation).hover(
		function() {
			$('li', accreditation).css('opacity', '0.5');
			$(this).css('opacity', '1');
		},
		function() {
			$('li', accreditation).css('opacity', '1');
		}
	);
	
	// Meerkat Banner
	meerkat({
		  close: '.close-meerkat',
		  dontShow: '.dont-show',
		  animation: 'fade',
		  animationSpeed: 250,
		  meerkatPosition: 'bottom',
		  height: '90px'
	});
	
	// Agree to Terms checkbox on Bulk Ordering page
	var agreeButton = $('#agree');
	var proceedLink = $('#proceed');
	
	proceedLink.addClass('invisible');
	
	agreeButton.click(function() {
		proceedLink[agreeButton.is(':checked') ? 'removeClass' : 'addClass']('invisible');
	});
	
	// Shopp "Add to Cart" AJAX
	ShoppCartAjaxRequest = function(url, data, response) {
		$.blockUI({
			message: '<img src="/wp-content/themes/herbalart/images/blockui-loader.gif" alt="" style="padding-right: 10px;vertical-align: middle;" /> adding to cart...',
			css: {
				padding: '20px',
				color: '#555',
				fontFamily: 'Georgia, Times, serif',
				fontSize: '12pt',
				border: '2px solid #c5c0a1'
			}
		});
		
		cartajax(url, data, 'html');
	}
	
	ShoppCartAjaxHandler = function(html) {
		$('#shopp-cart-ajax').before(html).remove(); // update sidecart
		
		items = $('#shopp-cart-items').html();
		$('#top_cart').html('<a href="/shop/cart/" class="cart_icon">'+items+' item(s) in cart</a>'); // update top cart
		
		$.unblockUI();
	}
	
})(jQuery);