function animate(dir, step) { 
var position; 
position = parseInt($("#content").css("margin-left")); 
var contentwidth; 
var sliderwidth; 
contentwidth = parseInt($("#content").css("width")); 
sliderwidth = parseInt($("#slider").css("width")); 
//alert(position); 
switch (dir) { 
case "right": 
position = ((position - step) < (sliderwidth - contentwidth)) ? (sliderwidth - contentwidth) : (position - step); 
break; 
case "left": 
position = ((position + step) > 0) ? 0 : (position + step); 
break; 
default: 
break; 
}; 
//alert(position); 
$("#content").animate({ marginLeft: position + "px" }, 560); 
} 
$(document).ready(function() { 
$("#slider").css("width", (560) + "px"); 
$("#leftA").click(function() { 
animate("left", 560); 
}); 
$("#rightA").click(function() { 
animate("right", 560); 
}); 
}); 
