
// trundles our carousel about...
function latest_slide(direction) {
	// get an array of what our slide offsets will be based on the frame widths.
	var offsets = new Array();
	var n = 0;
	$("#latest_items > .latest_item").each(function() {
		offsets.push(n * -1);
		//alert($(this).width());
		n += $(this).width();
	});
	
	// get our current offset.
	current = $("#latest_items").position();
	current = current.left;
	
	// see where that offset sits on our array of offsets.
	for(i=0;i<offsets.length;i++) {
		if(offsets[i] == current) {
			break;
		}
	}
	
	// look at the direction they're going and adjust our index accordingly.
	i = (direction == "next") ? (i + 1) : (i - 1);
	i = (i < 0) ? offsets.length - 1 : i;
	i = (i == offsets.length) ? 0 : i;
	
	// slide there already.
	//alert(offsets[i]);
	$("#latest_items").animate({"left" : offsets[i]}, "fast");
}
