$(document).ready(function() {

	//index_gallery
	INDEX_GALLERY();

});

function INDEX_GALLERY() {

	GALLERY_FUNC();

	//왼쪽으로 버튼 이동
	$("#move_left").click(function() {
		$("#gallery .lists li:last-child").insertBefore($("#gallery .lists li:eq(0)"));		
		GALLERY_FUNC();
	});

	//오른쪽으로 버튼 이동
	$("#move_right").click(function() {
		$("#gallery .lists li:eq(0)").insertAfter($("#gallery .lists li:last-child"));
		GALLERY_FUNC();
	});

	
	
	GALLERY_ACTION();
	

}

//갤러리 기본 기능
function GALLERY_FUNC() {

	//리스트 숨기기
	$("#gallery .lists li").each(function() {
		$(this).hide();
	});

	//리스트 중 2번째와 3번째만 보이기
	$("#gallery .lists li:eq(1), #gallery .lists li:eq(2)").show();

	//리스트 중 숨겨진 1번째는 크게 보이게 한다.
	$("#gallery .show").html($("#gallery .lists li:eq(0)").html());
	
}

function GALLERY_FUNC2() {

	$("#gallery .lists li:eq(0)").insertAfter($("#gallery .lists li:last-child"));
	GALLERY_FUNC();
}

function GALLERY_ACTION() {

	MOVE();		

}

function MOVE() {

	var GALLERY_MOVE = setInterval("GALLERY_FUNC2()", 5000);
}


