$(document).ready(function(){

	$('#Menu li:last-child').addClass('last');

	$('#cycle').cycle({
		fx: 'fade'
	});
	
	$('.Content .ProductList li:nth-child(4n)').addClass('last');

	function textReplacement(input){
		var originalvalue = input.val();
		input.focus( function(){
			if( $.trim(input.val()) == originalvalue ){ input.val(''); }
		});
		input.blur( function(){
			if( $.trim(input.val()) == '' ){ input.val(originalvalue); }
		});
	}

	textReplacement($('#search_query'));
	textReplacement($('#nl_first_name'));
	textReplacement($('#nl_email'));


	$('#test').rssfeed('http://feeds.feedburner.com/glassbangers/LatestNews', {
		limit: 3
	  });
	
	
//	jCarouselLite example -- you will need to add a <div class="ProductListContainer"> around the <ul>
//	in the HomeFeaturedProducts Panel

	$("#SideProductRelated").jCarouselLite({
        btnNext: "#related-next",
        btnPrev: "#related-prev",
		visible: 5,
		scroll: 5,
		speed: 800,
	});
	

	$cartitems = $('.crt').html().replace('(','').replace(')','').replace(' item','');
$('.crt').html($cartitems); 
	
	// REWRITE THE OUTPUT OF THE "(X ITEMS)" FIELD TO MATCH THEME
         
	var cartValue = $(".crt").html();
	var cartDigit;

	cartValue = jQuery.trim(cartValue); /*Trim whitespace for IE*/
	switch (cartValue)
		{
			case "":
			  $(".crt").html("<span class='item-no'>0</span><span class='item-txt'>items</span>");
			  number = 0;
			  break;
			case "(1 item)":
			  $(".crt").html("<span class='item-no'>1</span><span class='item-txt'>item</span>");
			  number = 1 ;
			  break;
			default:
			  //cartDigit = 3;
			   
			   
			  if(cartValue != ""){
				  splitup=cartValue.split(" ");
				  number = splitup[0].replace("(", "");
				  $(".crt").html("<span class='item-no'>" + number + "</span> <span class='item-txt'>items</span>");
				}
			  break;
		}
	


});
