$(document).ready(function() {
	jQuery.easing.def = "easeInOutQuart";
	
	//get_rss_feed();
	
	
	//$('.plainRow li tr td:nth-child(3n+2)').html(""); 


	function get_rss_feed() {
		
		 
		$('.plainRow').html("<p>Loading Latest Products...</p>"); 
		var url = "https://m2boutique.myshopify.com/collections/frontpage.atom";
		
		$.get('proxy.php?url='+ url, function(d) {

			$(".plainRow").empty();
			
			var count = 0;
			
			$(d).find('entry').each(function() {
				
				if (count <= 2){
				var $item = $(this);
				
				var title = $item.find('title:first').text();
				var vendor = $item.find('s:type:first').text();
				var link = $item.find('link').attr("href");
				var pubDate = $item.find('summary').text();

				var html = "<a href=\"" + link + "\" class=\"link\"><div class='featured-item'><span>" + title + "</span>" + pubDate + "</div></a>";


				$('.plainRow').append($(html)); 
				$('.plainRow tr:first-child td:last-child').css("display", "none"); 
				$('.plainRow tr:last-child').css("display", "none");  
				
				count++;
				}
			});
			
		});
	
	}; 
	
	
	
	var currentPos = 0;

	var wid =  $('#pressBar #pressContent').children().size()

	$("#pressNav .back").click(function(){
		if(currentPos != 0){
			currentPos--;
			moveBar(currentPos);
		}
	});
	
	$("#pressNav .forward").click(function(){
		if(currentPos <= wid - 6){
			currentPos++;
			moveBar(currentPos);
		}
	});
	
	function moveBar(num) {
		//$("#pressNav p").html(currentPos + " | " + wid);

		$("#pressBar #pressContent").animate({ left: -(num * 181), easing: "swing" }, 600);
		//$("#footer h2").html(currentPos + " | " + $('#pressBar #content').children().size() + " | " + wid);
	}; 


});


