
$(document).ready(function(){

	//최신앨범 > 상세정보 춤추기
	$('#divid_nalbum>div>ul>li').mouseenter(function () {
		$(this).find('.nalbum_singer').hide();
		$(this).find('.nalbum_sub').slideToggle("fast");
	}).mouseleave(function () {
		$(this).find('.nalbum_singer').show();
		$(this).find('.nalbum_sub').slideToggle("fast");
	});

	 //최신앨범 > 글자 흘리기
	$('#divid_nalbum>div>ul>li').mouseenter(function () {
		var txt2_w01 = $(this).find("div.overWrap > span.txtInfo > div.pointer > div").css("width");
		txt2_w01 = parseInt(txt2_w01);
		var txt2_w02 = txt2_w01 - (txt2_w01 + txt2_w01);
		
		if(txt2_w01 > 120){
			$(this).find("div.overWrap > span.txtInfo > div.pointer > div").delay(650).animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) ,function(){
				$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
					$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
						$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
							$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
								$(this).css("marginLeft","0");
							});
						});
					});
				});
			});
		}
	}).mouseleave(function() {
		$(this).find("div.overWrap > span.txtInfo > div.pointer > div").clearQueue().stop().css("marginLeft" , "0");
	});

	 //최신앨범 > 글자 흘리기 > 살짝 멈추기
	$("#divid_nalbum>div>ul>li> div.overWrap > span.txtInfo > div.pointer > div").mouseenter(function() {
		$(this).stop();
	}).mouseleave(function() {
		var txt2_w01 = $(this).css("width");
		txt2_w01 = parseInt(txt2_w01);
		var txt2_w02 = txt2_w01 - (txt2_w01 + txt2_w01);

		if(txt2_w01 > 120){
			$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
				$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
					$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
						$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
							$(this).css("marginLeft","0");
						});
					});
				});
			});
		}	
	});

});      


//차트>마우스오버아웃
function LJS_Chart_OVEROUT(divid, flag)
{
	if (flag == "over"){
		$(divid).addClass("on");
	}
	else{
		$(divid).removeClass("on");
	}
}


//이벤트
function LJS_Open_Event(this_cnt, tot_cnt)
{			
	for(k=0;k<=tot_cnt;k++){
		if (k==this_cnt){			
			$("#imgid_event"+k).attr("src", $("#imgid_event"+k).attr("src").replace("_off","_on"));
			$("#divid_event"+k).fadeIn(400);
		}
		else{
			$("#imgid_event"+k).attr("src", $("#imgid_event"+k).attr("src").replace("_on","_off"));
			$("#divid_event"+k).hide();
		}
	}
}	


//오늘왜이슈>마우스오버아웃
function LJS_Issue_OVEROUT(divid, flag, str_date, str_img)
{
	if (flag == "over"){
		$(divid).addClass("on");
		$("#imgid_issue").html("<a href='/trend/trend_main.dal?n_left_code=5&str_date_str="+str_date+"'><img src=\'"+str_img+"\' width='108' height='138'/></a>");
	}
	else{
		$(divid).removeClass("on");
	}
}


//오늘왜이슈>곡정보가져오기
function LJS_Issue_Song_Ajax(str_date)
{
	var url = "/main/inc_v2_issue_song_ajax.dal";
	var param = {
		str_date	: str_date
	};

	$.post(url, param, function(rtn_msg){		
		GJS_Open_Player(1, rtn_msg);
	});
}


//좋아요/싫어요 아티스트 상세보기
function LJS_MArtist_Open(this_cnt,tot_cnt)
{	
	for(k=0;k<=tot_cnt;k++){
		if (k==this_cnt){			
			$("#liid_ar_simg"+k).addClass("on");
			$("#imgid_rank"+k).attr("src", DAL_IMG_URL+"/main_v2/rank0"+(k+1)+".png");
			$("#divid_ar_playlist"+k).show();
			$("#divid_ar_bimg"+k).show();
		}
		else{
			$("#liid_ar_simg"+k).removeClass("on");
			$("#divid_ar_playlist"+k).hide();
			$("#divid_ar_bimg"+k).hide();
		}
	}
}	

//플래시 안녕
function flashhide(){
	$("#flashLayer").fadeOut(500);
}


//음악이용권 띄우기
function flashLink32(){
	
	if (GJS_Is_Login() == false){		
		GJS_popLogin(3, "/");
		return false;
	}	
	else {
		GJS_winopen_center("http://www.dal.co.kr/payment/buy/pop_buy_item.dal?n_item_idx=32", "_dalbuy", "420", "380", "0");
	}
}



function LJS_NewAlbum(this_cnt){
	var hide_cnt=1;
	var show_cnt=1;

	if (this_cnt == "N"){
		for(k=1;k<=3;k++){
			if ($("#nalbum_ul"+k).val()=="full"){
				hide_cnt = k;
			}
		}

		show_cnt = hide_cnt + 1;		

		if (show_cnt > 3){
			//alert('마지막페이지입니다.');
			return;
			//show_cnt = 0;
		}
	}
	else if(this_cnt == "P"){

		for(k=1;k<=3;k++){
			if ($("#nalbum_ul"+k).val()=="full"){
				hide_cnt = k;
			}
		}

		show_cnt = hide_cnt - 1;
		if (show_cnt < 1){
			//show_cnt = 3;
			
			//alert('첫페이지입니다.');
			return;
		}
	}
	else{
		for(k=1;k<=3;k++){
			if ($("#nalbum_ul"+k).val()=="full"){
				hide_cnt = k;
			}
		}
		
		show_cnt = this_cnt;
	}

	if (hide_cnt < show_cnt){
		$("#nalbum_ul"+show_cnt).show("slide", { direction: "right" }, 100);
		$("#nalbum_ul"+hide_cnt).animate({ 
		 marginLeft: "-630"
		 }, 500 ); 
	}
	else{

		$("#nalbum_ul"+hide_cnt).show("slide", { direction: "left" }, 100);	
		$("#nalbum_ul"+show_cnt).animate({ 
		 marginLeft: "0"
		 }, 500 ); 
	}

	$("#nalbum_ul"+show_cnt).val("full");	
	$("#nalbum_pg"+show_cnt).attr("src", $("#nalbum_pg"+show_cnt).attr("src").replace("_off","_on"));
	$("#nalbum_ul"+hide_cnt).val("empty");	
	$("#nalbum_pg"+hide_cnt).attr("src", $("#nalbum_pg"+hide_cnt).attr("src").replace("_on","_off"));



}

//최신앨범 열기
function LJS_PostJQ_NewAlbum(url, param, divid) 	
{
	$.post(url, param, function(rtn_data){		
			var aaab = $(divid).html(rtn_data).find("#divid_nalbum>div>ul>li");

			//최신앨범 > 상세정보 춤추기
			aaab.mouseenter(function () {
				$(this).find('.nalbum_singer').hide();
				$(this).find('.nalbum_sub').slideToggle("fast");
			}).mouseleave(function () {
				$(this).find('.nalbum_singer').show();
				$(this).find('.nalbum_sub').slideToggle("fast");
			});

			 //최신앨범 > 글자 흘리기
			aaab.mouseenter(function () {
				var txt2_w01 = $(this).find("div.overWrap > span.txtInfo > div.pointer > div").css("width");
				txt2_w01 = parseInt(txt2_w01);
				var txt2_w02 = txt2_w01 - (txt2_w01 + txt2_w01);
				
				if(txt2_w01 > 120){
					$(this).find("div.overWrap > span.txtInfo > div.pointer > div").delay(650).animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) ,function(){
						$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
							$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
								$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
									$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
										$(this).css("marginLeft","0");
									});
								});
							});
						});
					});
				}
			}).mouseleave(function() {
				$(this).find("div.overWrap > span.txtInfo > div.pointer > div").clearQueue().stop().css("marginLeft" , "0");
			});

			 //최신앨범 > 글자 흘리기 > 살짝 멈추기
			$("div.overWrap > span.txtInfo > div.pointer > div").mouseenter(function() {
				$(this).stop();
			}).mouseleave(function() {
				var txt2_w01 = $(this).css("width");
				txt2_w01 = parseInt(txt2_w01);
				var txt2_w02 = txt2_w01 - (txt2_w01 + txt2_w01);
				if(txt2_w01 > 120){
					$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
						$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
							$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
								$(this).css("marginLeft","120px").animate({ marginLeft:  txt2_w02  }, (txt2_w01*30) + (900) ,function(){
									$(this).css("marginLeft","0");
								});
							});
						});
					});
				}	
			});

	}, "html");
	
}




//======================================================
//--- Description : LJS_Main_SWF 불러오기
//--- Func Name :LJS_Main_SWF(src, w, h)
//--- Param : LJS_Main_SWF(swf위치), w(width), h(height)
//--- Make Date : 2008/11/19
//--- Author : wildbear
//======================================================
function LJS_Main_SWF(src, w, h, id)
{
	html = '';
	html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + id + '" width="'+w+'" height="'+h+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">';
	html += '<param name="movie" value="'+src+'" \/>';
	html += '<param name="quality" value="high">';	
	html += '<param name="wmode" value="transparent">';
	html += '<param name="menu" value="0">';
	html += '<param name="allowScriptAccess" value="always">';
	html += '<embed src="'+src+'" width="'+w+'" height="'+h+'" quality="high"  bgcolor="#000000" name="DCPlayer"  align="middle" play="true" loop="false" wmode="transparent" quality="high" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"> <\/embed> <\/object>';

	$("#flashLayer").show();
	$("#flashLayer").html(html);
}
//======================================================
	
