//var move = 340;
function moveR() {
  var curLeft = parseInt($('#slideRoom ul').css("left"));
  var a = parseInt(0 - parseInt($('#slideRoom ul').css("width")));
  if ( a + move*2 <= curLeft ) {
    $('#slideRoom ul').animate({
      left: curLeft - move + "px"
    },
    300,
    function() {
      if (curLeft > 0) {
        $('#slideRoom ul').css("left", "0px")
      }
    })
  } else {
	  $('#slideRoom ul').animate({
      left: "0px"
    },
    300)
	}
}

$(function() {
	var len = $('#slideRoom li').length;
  $('#slideRoom ul').css({
    "width": move * len + "px",
    "left":"0px"
  });
	var slideD = '';
	$('#slideRoom').hover(function(){
    clearInterval(slideD);
	}, function(){
	  slideD = setInterval("moveR()",5000);
	}).mouseout();
	$('#slideBtnNext').click(function(){
    clearInterval(slideD);
    moveR();
	});
})

