$(function(){

	$("#imgLoop ul").css("width",315*$("ul#slideList li").size()+"px");
 	$("#imgLoop ul li:last").prependTo("ul#slideList");
	$("#imgLoop").css("margin-left","-157px");
 	
 	
 	var timerID = setInterval(function(){
 		$("#imgLoop").animate({
			marginLeft : parseInt($("#imgLoop").css("margin-left"))-315+"px"
		},"slow","swing" , 
		function(){
			$("#imgLoop").css("margin-left","-157px")
			$("#imgLoop ul li:first").appendTo("#imgLoop ul:last");
		});
		
	},2000);

 var layer = $('<div id="imgWk"></div><div id="rightB"></div>');
 
 
 $('#sliderBox .wrap').append(layer);
 
 	
 	/*$('#sliderBox ul').css({
 		position : 'absolute',
 		top: '89px',
 		zIndex:'5'
 	});*/
 	$('#imgWk').css({
 					background : 'url(images/right.png) no-repeat',
 					position:'absolute',
 					top: '0px',
 					height:'27px',
 					width:'960px',
 					zIndex:'10'
 					});
 	$('#rightB').css({
 					display:'none',
 					background : 'url(images/spot.png) no-repeat',
 					position:'absolute',
 					top: '27px',
 					width:'960px',
 					height:'193px',
 					zIndex:'11'
 					});
	$('#rightB').fadeIn(800);
	$("li.level1").click(function () {
		$("table.sd a").fadeTo("slow", 1);
  		$("table.sd a").not(".level1").fadeTo("slow", 0.1);
	});
	
	$("li.level2").click(function () {
		$("table.sd a").fadeTo("slow", 1);
  		$("table.sd a").not(".level2").fadeTo("slow", 0.1);
	});
	
	$("li.level3").click(function () {
		$("table.sd a").fadeTo("slow", 1);
  		$("table.sd a").not(".level3").fadeTo("slow", 0.1);
	});
	
	$("li.level4").click(function () {
		$("table.sd a").fadeTo("slow", 1);
  		$("table.sd a").not(".level4").fadeTo("slow", 0.1);
	});
	$("li.cl").click(function () {
		$("table.sd a").fadeTo("slow", 1);
	});
	
	
	var voiceSecond = 4500;
	var voiceTimerID;
	var voiceWrapper = "#atBox";
	var voiceVisible = voiceWrapper + " > div.visible";
	var voiceLists = voiceVisible + " > ul";
	var voiceList = voiceLists + " > li";
	var voiceListFirst = voiceList + ":first-child";
	var voiceLength = $(voiceList).length;

	$(voiceListFirst).animate({height:"15px"},"fast");


	if(voiceLength > 1){
		voiceTimerID = setInterval(function(){
			$(voiceListFirst).appendTo(voiceLists).css({bottom:"auto",top:"0px"}).animate({height:"0px"},"fast");
			$(voiceListFirst).css({bottom:"0px",top:"auto"}).animate({height:"16px"},"fast");
		},voiceSecond);
	}
	
	
	var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';
	
	jQuery(thumbnails).addClass("fancybox");
	
	$("a.fancybox").fancybox();
	
});


	
	
