$(document).ready(function() {
	
	$(".MENU ul li").click(function() {
		$(this).parent().find("ul").slideUp();
		if ($(this).find("ul").css('display') == "none")
			$(this).find("ul").slideDown();
	});	


	
	$(".ART_LINK").click(function() {
		$(".VIDEO_BOX").html($(this).next(".VIDEO_VIDEO").html());					  
	});
	$(".VIDEO_NAME").click(function() {					
		$(".VIDEO_BOX").html($(this).next().next(".VIDEO_VIDEO").html());					  
	});	
	
	var speed = 700;
	var height = 400;
	
	$(".NEXT").click(function() {
		if ($(".COUNTER").val() < $(".TOTAL").val()) {
			$(".G_BOX_G").animate({top:"-="+height+"px"}, speed);
			 cVal = parseInt($(".COUNTER").val(), 10);
			$(".COUNTER").val(cVal + 1);
		}
	});
	$(".BACK").click(function() {
		if ($(".COUNTER").val() > 1) {
			$(".G_BOX_G").animate({top:"+="+height+"px"}, speed);
			 cVal = parseInt($(".COUNTER").val(), 10);
			$(".COUNTER").val(cVal - 1);
		}
	});
	
	$(".G_NUMBER").click(function() {								  
		 cVal = parseInt($(".COUNTER").val(), 10);
		 cNum = parseInt($(this).text(), 10);
		 if (cVal < cNum) {
			hVal = ((cNum-cVal) * height);
			$(".G_BOX_G").animate({top:"-="+hVal+"px"}, speed);
			$(".COUNTER").val(cNum);
		 } else if (cVal > cNum) {
			 hVal = ((cVal-cNum) * height);
			$(".G_BOX_G").animate({top:"+="+hVal+"px"}, speed);	
			$(".COUNTER").val(cNum);
		 }
	});
	$("a[rel='example1']").colorbox();

	$(".LIGHTBOX").colorbox({slideshow: false});

});
