function top_artist_chg(n){
	$(".pic_art a").hide();
	$(".pic_art a").eq(n-1).show();	
}


function fImgResize(){
    var clientWidth = 610; // 현재 화면의 Width
	var clientHeight = 600;
 
    $(".view_pic .photo img").each(function(index, obj) {        
		var orgImgObj   = new Image();
		orgImgObj.src   = obj.src; 	
		
        var imgWidth    = orgImgObj.width;                 // 이미지의 Width (this.width 와 동일)
        var imgHeight   = orgImgObj.height;                // 이미지의 Height
        var rate = 1;                                // 비율(키우고 줄이는)
 
        if (imgWidth == 0 || imgHeight == 0)
        {
			fImgResize()
        }else{
			// 이미지 width가 화면의 width보다 큰 경우 줄임
			if( imgWidth > clientWidth ){
				rate = clientWidth / imgWidth;
				obj.width  = imgWidth  * rate;
				obj.height  = imgHeight  * rate;
			// 현재 이미지 width가 현재창보다는 작고, 원본사이즈보다 작을 때 키워줌
			}
			if( imgHeight > clientHeight){
				rate = clientHeight / imgHeight;
				obj.height= imgHeight  * rate;
				obj.width= imgWidth  * rate;
			// 현재 이미지 width가 현재창보다는 작고, 원본사이즈보다 작을 때 키워줌
			}
		}
    });
}

function photo_list(n, img){

	
	var num = Number($(".photo_view .num").val());
	var num2 = Number($(".photo_view .num2").val());
	var num3 ;
	

	if (n == "prev")
	{
		if (num == 1)
		{
			num = $(".photo_view .con_slider_list ul li").length;
		}else{
			num = num - 1;
		}

		if (num2 > 1)
		{
			num2 = num2 - 1;
		}else{
			num2="last";
		}
		n = num;		
		if (img == "big_img")
		{			
			
			if (num2 == "last")
			{
				num2 = $(".photo_view .con_slider_list ul a").length;
				num3 = $(".photo_view .con_slider_list ul li").length-1;
			}else{
				num3 = (num2-1) / 7;
			}

			$(".photo_view .con_slider_list ul a span").removeClass("selected");
			$(".photo_view .con_slider_list ul a").eq(num2-1).find("span").addClass("selected");
			big_img_src = $(".photo_view .con_slider_list ul .selected").text();						
			$(".photo_view table .big_chg").html("<img src='"+big_img_src+"' alt='' class='big_img'/>");
			fImgResize()
			$(".photo_view .con_slider_list ul").animate({ "left": -$(".photo_view .con_slider_list ul > li").eq(num3).position().left  }, { duration:200});		
			$(".photo_view .view_pic dl").hide();
			$(".photo_view .view_pic dl").eq(num2-1).show();
		}else{
			$(".photo_view .con_slider_list ul").animate({ "left": -$(".photo_view .con_slider_list ul > li").eq(n-1).position().left  }, { duration:200});
		}
		$(".photo_view .num").val(n);
		$(".photo_view .num2").val(num2);
	}
	else if (n == "next"){		
		if (num < $(".photo_view .con_slider_list ul li").length)
		{
			num = num +1;
		}else{
			num = 1;
		}
		if (num2 < $(".photo_view .con_slider_list ul a").length)
		{
			num2 = num2 + 1;
		}else{
			num2 = "first"
		}
		n = num;		
		if (img == "big_img")
		{		
				
			if (num2 == "first")
			{
				num2 = 1;
				num3 = 0;
			}else{
				num3 = (num2-1) / 7;
			}

			$(".photo_view .con_slider_list ul a span").removeClass("selected");
			$(".photo_view .con_slider_list ul a").eq(num2-1).find("span").addClass("selected");
			big_img_src = $(".photo_view .con_slider_list ul .selected").text();						
			$(".photo_view table .big_chg").html("<img src='"+big_img_src+"' alt='' class='big_img'/>");
			fImgResize()
					
			$(".photo_view .con_slider_list ul").animate({ "left": -$(".photo_view .con_slider_list ul > li").eq(num3).position().left  }, { duration:200});
			$(".photo_view .view_pic dl").hide();
			$(".photo_view .view_pic dl").eq(num2-1).show();
		}else{
			$(".photo_view .con_slider_list ul").animate({ "left": -$(".photo_view .con_slider_list ul > li").eq(n-1).position().left  }, { duration:200});
		}
		$(".photo_view .num").val(n);
		$(".photo_view .num2").val(num2);
	}else{
		$(".photo_view .con_slider_list ul a span").removeClass("selected");
		$(".photo_view .con_slider_list ul a").eq(n-1).find("span").addClass("selected");
		big_img_src = $(".photo_view .con_slider_list ul .selected").text();						
		$(".photo_view table .big_chg").html("<img src='"+big_img_src+"' alt='' class='big_img'/>");
		fImgResize()

		$(".photo_view .view_pic dl").hide();
		$(".photo_view .view_pic dl").eq(num2-1).show();

		$(".photo_view .num2").val(n);
	}
	
}
