var x = 0;
var curPage = 0;  
var thumbWidth = 	230;  
var thumbsVis = 3;

$(document).ready(function() {
  
  $(".sub").hide();
  //Get OS
  var os = navigator.platform;
  if(os.toLowerCase().search("mac") > -1) {
    $("body").addClass("mac");
  }
  		
  //Work Scroller
	var numThumbs = $("#item-scroll img").length;
	
	$("#next").click(function() { 
		updateOffset(1,numThumbs);
		$("#item-scroll").animate({ left: x }, 1000, "expoinout");	
		return false;
	});
	$("#prev").click(function() { 
		updateOffset(0,numThumbs);
		$("#item-scroll").animate({ left: x }, 1000, "expoinout");
		return false;
	});	
	
});// end doc ready


function updateOffset(next,thumbs) {
	if(next == 1) {
		if (x == (0 - ((thumbs - thumbsVis) * thumbWidth))) {
			x = 0;
		} else {
			x = x - (thumbWidth*thumbsVis);
		}
	}
	if(x <= 0 && next != 1) {
		if (x == 0) {
			x = (0 - ((thumbs - thumbsVis) * thumbWidth));
		} else {
			x = x + (thumbWidth*thumbsVis);
		}
	}
	
}// end updateOffset