// JavaScript Document
var len = $(".offer").length;
	var x = 0;
	//$("#slideshow #total").text(len);
	$(".offer:eq(0)").addClass("current");//mark the first entry with empy class - current
	$(".offer").each(function() {//loop through each offer
		$(this).attr('rel', x);//assign the 'rel' attribute to each offer with a value of the var x
		x++;//increment x----which means each object (offer) in the array will get a higher number 
	});	//end that each loop
	$(".nextAd").click(function() {//function if the nextAd button is clicked
			var current = $(".offer.current");//I think this assigns the div that's marked with the class current to the var current - check that double class syntax
			var next = parseFloat(current.attr('rel'))+1;//parseFloat is a js function, which determines if the first character of a string is a number and returns it if it is. So this adds 1 to the value of the rel attribute of the current object (offer) and assigns that value to var next
			if(next==len) {//if the var next is equal to the value of len, which is the length of our array
				return false;//break out of the function because we're on the last offer
			}
		//$("#num").text(parseFloat(next)+1); not using this right now
		current.removeClass('current');//removes the current class from what was the current object
		$(".offer").each(function() {//loop through the offers again
			if($(this).attr('rel')==next) {//look for the offer with the rel value that matches the var next
				$(this).addClass('current');//add the class current to that offer
			}
		});									
	});
	$(".prevAd").click(function() {
		var current = $(".offer.current");
		var prev = parseFloat(current.attr('rel'))-1;
		if(prev<0) {
			return false;
		};
		//$("#num").text(parseFloat(prev)+1);
		current.removeClass('current');
		$(".offer").each(function() {
			if($(this).attr('rel')==prev) {
				$(this).addClass('current');
				};
		});
	});
