//Run BC Blog Feed to Home Page
$.getJSON("http://rss.madwirewebdesign.com/feed.php?feed=http://www.skiuniverse.com/rss.php?action=newblogs&type=rss&desc_char_limit=70&max_posts=2&thumbnail=no&read_more=2&callback=?", function(data) {
	for (i = 0; i < data.length; i++)
	{
	   $(".blog-feeder-list").append(
	   "<li><h4><a href='" + data[i].rssItem.link + "'>" + data[i].rssItem.title + "</a></h4><div class='pubdate'>" + data[i].rssItem.pubdate + "</div><div class='image'><img src='" + data[i].rssItem.postThumbnail + "'></div><div class='description'>" + data[i].rssItem.description + "<span class='read-more'><a href='" + data[i].rssItem.link + "'>" + data[i].rssItem.readMore + "</a></span>" + "</div></li>"   	
	   ); 		
	}		
}); 

$(document).ready(function(){

//Activate bcNav
//	$('#SideCategoryList').bcNav();

	$("#PrimaryMenu > ul > li:last-child").addClass("last");
	$("#PrimaryMenu > ul > li:first-child").addClass("First");
	$(".SubCategoryListGrid ul li.RowDivider").remove();
	$(".SubCategoryListGrid ul li:last-child").remove();
	
	// $("#ProductReviews > a > img").replaceWith("write a review");
	// $("#ProductReviews > a").addClass("button");
	
//Add Active class to main navigation
	var loc_href = window.location.pathname;
		$('#PrimaryMenu a').each(function () {
		if (loc_href == $(this).attr('href')) {
			$(this).parent("li").addClass('ActivePage');
		}
	});

//Replace Text Inputs
	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"));
	

// Load cycle on home page
	//GET URL	
	var url = window.location.pathname;
	url = url.toLowerCase();
	//READ URL
	// uncomment alert to see what the url is in browser if needed
	//alert(url);
	if (url == '/' || url == "/index.php") {
	//RUN CYCLE
		$("#cycle").cycle({
			fx: "fade"
		});
	};

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

});
