$(function(){
	$("#mainVis").imageNavigation({
		time:3500,
		animationTime:500,
		rolloverTime: 0,
		rolloutTime: 500,
		rolloverImage: false
	});
	$("#newsCat001").click(function(){
		$("#cat001").show();
		$("#cat002, #cat003, #cat004").hide();
		$(this).addClass("ac");
		$("#newsCat002, #newsCat003, #newsCat004").removeClass("ac");
	});
	$("#newsCat002").click(function(){
		$("#cat002").show();
		$("#cat001, #cat003, #cat004").hide();
		$(this).addClass("ac");
		$("#newsCat001, #newsCat003, #newsCat004").removeClass("ac");
	});
	$("#newsCat003").click(function(){
		$("#cat003").show();
		$("#cat001, #cat002, #cat004").hide();
		$(this).addClass("ac");
		$("#newsCat001, #newsCat002, #newsCat004").removeClass("ac");
	});
	$("#newsCat004").click(function(){
		$("#cat004").show();
		$("#cat001, #cat002, #cat003").hide();
		$(this).addClass("ac");
		$("#newsCat001, #newsCat002, #newsCat003").removeClass("ac");
	});
/*	if(!$.cookie('renewBB2011')){
		$.colorbox({"href":"renew_flash.html",iframe:true, innerWidth:900, innerHeight:506, scrolling:false, open:true});
		$.cookie('renewBB2011','1');
	}*/

	var lilist = $('div#hotItemList ul > *').length;
	var xmov = 280;
	
	$("#hotItemList li a").click(function(){ return false; });
	$("#hotItemList li a").click(function(){
		tgt = Number($(this).parent().attr("class"));
		leftPos = -(tgt*280); 
		$("#detailset").css("left",leftPos);
		
		btnAction(tgt);
		tgtChenge(tgt);
		
		$("#hotItemList,#detailWrap").toggle();
		return false;
	});
	$("#closeBtn").click(function(){
		$("#hotItemList,#detailWrap").toggle();
	});
	
	function btnAction(n){
		if(n!=0){
			$("#prevBtn").click(function(){
				n--;
				tgtChenge(n);
				xmove=-(n*xmov);
				$("#detailset").stop();
				$('#detailset').animate({left:xmove});
			});
		}
		if(n!=lilist-1){
			$("#nextBtn").click(function(){
				n++;
				tgtChenge(n);
				xmove=-(n*xmov);
				$("#detailset").stop();
				$('#detailset').animate({left:xmove});
			});
		}
		
	}
	function tgtChenge(n){
		if(n==0){
			$('#prevBtn').hide();
		}else if(n==lilist-1){
			$('#nextBtn').hide();
		}else{
			$('#prevBtn').show();
			$('#nextBtn').show();
		}
	}
});

