jQuery.noConflict(); var $ = jQuery;
$(function() {

	window.nowcat="ALL";

	$("#index-category ."+nowcat).css('color','#33cc00');

	$(".index-title-year a").each(function(){
		$(this).data('myURL',$(this).attr('href'));
	});
	
	$(".tn_img a").each(function(){
		$(this).data('myURL',$(this).attr('href'));
	});

	//////////////////////////////////////////////////////////////////////////////////
	//show .tn_txt
	//////////////////////////////////////////////////////////////////////////////////

	$(".tn").hover(function(){
		if($(this).find("img").css('opacity')!=0){
			$(this).find(".tn_txt").css('color','#222');
		}
	},function(){
			$(this).find(".tn_txt").css('color','#fff');
	});

	$(".index-title-year a").hover(function(){
		if($(this).parent().parent().css('opacity') ==1){
			$(this).css('color','#33cc00');
		}
	},function(){
		$(this).css('color','#222');
	});

	//////////////////////////////////////////////////////////////////////////////////
	//toggle category
	//////////////////////////////////////////////////////////////////////////////////
	
	$(".togglecat").click(function(){
		$(".index-title-year ul").not($("."+nowcat)).animate({'opacity':'1'},{queue:false},600);
		$(".tn").not($("."+nowcat)).find("img").animate({'opacity':'1'},{queue:false},600);
		$("#index-category ."+nowcat).css('color','#222');
		nowcat = $(this).html();
		$("#index-category ."+nowcat).css('color','#33cc00');
		$(".index-title-year a").each(function(){
			$(this).attr('href',$(this).data('myURL'));
		});
		$(".tn_img a").each(function(){
			$(this).attr('href',$(this).data('myURL'));
		});
		if(nowcat=="ALL"){
			$(".index-title-year ul").animate({'opacity':'1'},{queue:false},600);
			$(".tn").find("img").animate({'opacity':'1'},{queue:false},600);
		}else{
			$(".index-title-year ul").not($("."+nowcat)).find("a").attr('href','javascript:void(0)')
			$(".tn").not($("."+nowcat)).find("a").attr('href','javascript:void(0)');
			$(".index-title-year ul").not($("."+nowcat)).animate({'opacity':'0.2'},{queue:false},600);		
			$(".tn").not($("."+nowcat)).find("img").animate({'opacity':'0'},{queue:false},600);
		}
		return false;
	});


});

