$(document).ready(function(){

	$("#PrimaryMenu > ul > li:last-child").addClass("last");
	
	$(".SubCategoryListGrid ul li.RowDivider").remove();
	$(".SubCategoryListGrid ul li:last-child").remove();
	
	// $("#ProductReviews > a > img").replaceWith("write a review");
	// $("#ProductReviews > a").addClass("button");
	
	/*
		This is a short and simple script that will create an Active class for your custom pages menu links(if you have to use stuff like Category pages for your main navigation).
		Keep in mind that this will also work for any other list (like custom Side Vendors, Side Categories, or Side Brands) by just changing the ID Selector. **Credit to Krystin Rice
	*/
	var loc_href = window.location.pathname;
		$('#PrimaryMenu a').each(function () {
		if (loc_href == $(this).attr('href')) {
			$(this).parent("li").addClass('ActivePage');
		}
	});
	
	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"));
	
	// // loads the cycle or whatever on specific url in this case the home page
	var url = window.location.pathname;
	url = url.toLowerCase();
	if (url == '/' || url == "/index.php") {
		$("#cycle").cycle({
			fx:     'fade', 
			speed:  'slow', 
			timeout: 5000, 
			next:   '#next', 
			prev:   '#prev' 
		});
	};
	
	// // loads only if the cycle selector exists
	// if ($("#cycle").length > 0){	
		// $("#cycle").cycle({
			// fx: "fade"
		// });
	// };


	//	jCarouselLite example -- you will need to add a <div class="ProductListContainer"> around the <ul>
	//	in the HomeFeaturedProducts Panel

//	$("#HomeFeaturedProducts .ProductListContainer").jCarouselLite({
//        btnNext: "#featured-next",
//        btnPrev: "#featured-prev",
//	      visible: 5,
//	 	  scroll: 5,
//		  speed: 800
//   });

});
