window.onerror = jsErrorLogSend;

function jsErrorLogSend(sMsg,sUrl,sLine) {
	jsErrLog(" javascript ¿¡·¯ errStatus : " + sLine + " Line " +sMsg + " , errURL : " + sUrl );
}

var retwin ;
var webMoviePop ;
var webPlayerPop ;
var webDownPop ;
var objRun ;
var intTimeCnt = 0 ;

/* OPEN.WINDOW COMMON MODUEL */
var openPopupClass = {
	name:"POP",			/* ÆË¾÷ ¸í	*/
	left:100,			/*	ÆË¾÷ À§Ä¡ ( ¿ÞÂÊ ±âÁØ )*/
	top:100,			/*	ÆË¾÷ À§Ä¡ ( À§ÂÊ ±âÁØ )*/
	scrollbars:"no",	/*	½ºÅ©·Ñ¹Ù ¿©ºÎ*/
	toolbar:"no",		/*	µÚ·Î,¾ÕÀ¸·Î,°Ë»ö Áñ°ÜÃ£±â µî ¹öÆ° »ý¼º ¿©ºÎ*/
	location:"no",		/*	ÁÖ¼ÒÃ¢ »ý¼º ¿©ºÎ*/
	resizeble:"yes",	/*  ÆË¾÷ Ã¢ Å©±â ÀçÁ¤ÀÇ ¿©ºÎ */
    status:"no",		/*	ÆË¾÷ »óÅÂÃ¢ ³ëÃâ ¿©ºÎ*/
	titlebar:"no",		/*	Á¦¸ñÁÙ ³ëÃâ ¿©ºÎ ( IE 7.0 ¿¡¼­ Á¦¾î°¡ ¾ÈµÇ³×... )*/
	fullscreen:"no",	/*	»õÃ¢ ¶ç¿ï ½Ã ÃÖ´ëÈ­ ¿©ºÎ*/
	poptype:""			/*	ÆË¾÷ Å¸ÀÔ	( P: À¥ÇÃ·¹ÀÌ¾î , M: ¹«ºñÇÃ·¹ÀÌ¾î , D: ´Ù¿î·ÎµåÆË¾÷ )*/
}

openPopupClass.reset = function() {
	openPopupClass.name="POP";
	openPopupClass.left=100;
	openPopupClass.top=100;
	openPopupClass.scrollbars="no";
	openPopupClass.toolbar="no";
	openPopupClass.location="no";
	openPopupClass.resizeble="yes";
	openPopupClass.status="no";
	openPopupClass.titlebar="no";
	openPopupClass.fullscreen="no";
	openPopupClass.poptype="";
}

openPopupClass.openpop = function ( purl , pname , pwidth , pheight ) {
	var strStatus="" ;
	var reg = "scrollbars|toolbar|location|resizeble|status|menubar|titlebar|fullscreen";
	var reg1 = "yes|no|1|0";

	if ( pname == "" || pname == null )
	{
		pname = openPopupClass.name ; 
	}

	if ( isFinite(pwidth) && isFinite(pheight) )	/*	ÆË¾÷ »çÀÌÁî ÀÎÀÚ °ª int Çü Ã¼Å© */
	{
		strStatus += "width=" + String(pwidth) + "px,height=" + String(pheight) + "px"; 
	} else 
	{
		alert("ÆË¾÷ »çÀÌÁî´Â ¼ýÀÚÇüÀ¸·Î ÀÔ·ÂÇÏ¼¼¿ä.");
		return;
	}
	
	if ( isFinite(openPopupClass.top) && isFinite(openPopupClass.left) )	/*	ÆË¾÷ À§Ä¡ ÀÎÀÚ °ª int Çü Ã¼Å© */
	{
		strStatus += ",top=" + String(openPopupClass.top) + "px,left=" + String(openPopupClass.left) + "px"; 
	} else 
	{
		alert("ÆË¾÷ À§Ä¡´Â ¼ýÀÚÇüÀ¸·Î ÀÔ·ÂÇÏ¼¼¿ä.");
		return;
	}

	for (prop in openPopupClass){ /*  for in ·çÇÁ¸¦ »ç¿ëÇÏ¿© À­ ¿¹Á¦¿¡¼­ »ý¼ºÇÑ »ç¿ëÀÚ Á¤ÀÇ °³Ã¼ ¸ðµç ¼Ó¼º°ªµéÀ» Ãâ·ÂÇÑ´Ù. */
		if ( reg.indexOf(prop.toLowerCase()) > -1 )
		{
			if ( reg1.indexOf(openPopupClass[prop].toLowerCase()) < 0 )
			{
				alert( prop + "¼Ó¼º °ªÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù.");
				return;
			}else
			{
				strStatus += "," + prop + "=" + openPopupClass[prop].toLowerCase();	
			}
		}	
	}

	if (openPopupClass.poptype == "P"){
		webPlayerPop = window.open( purl , pname , strStatus ) ;
	}else if (openPopupClass.poptype == "M"){
		webMoviePop = window.open( purl , pname , strStatus ) ;
	}else if (openPopupClass.poptype == "D"){
		webDownPop = window.open( purl , pname , strStatus ) ;
	}else{
		retwin = window.open( purl , pname , strStatus ) ;
	}
	openPopupClass.reset();
}

function openwin ( purl , pname , pwidth , pheight ) {
	openPopupClass.openpop( purl , pname , pwidth , pheight ) 
}

/* LOGIN , ADULT CHECK  */
function checkAdult() {
	if ( isLogin == "true")	{
		if ( isAdult == "true") {
			return true;
		} else {
			alertLayer("¼±ÅÃÇÏ½Å Ç×¸ñÀº 'Á¤º¸Åë½Å¸Á ÀÌ¿ëÃËÁø ¹× Á¤º¸º¸È£µé¿¡ °üÇÑ ¹ý·ü ¹× Ã»¼Ò³â º¸È£¹ý' ±ÔÁ¤¿¡ µû¶ó 19¼¼¹Ì¸¸ Ã»¼Ò³âÀº ÀÌ¿ëÀÌ Á¦ÇÑµË´Ï´Ù")
			return false;
		}
	} else {
		OpenLogin();
		return false;
	}	
}

function checkLogin(retURL) {	/* return URL : °ª Àü´Þ X -> POPUP LOGIN , °© Àü´Þ O -> PAGE LOGIN */
	if ( isLogin == "true")	{
		return true;
	} else {
		if (retURL==undefined){
			OpenLogin();
		}else {
			document.location.href = '/Includes/Commons/Auth/f_UserLogin.asp?pageRefer='+retURL;
		}		
		return false;
	}	
}

/* LINK */
function ViewArtist(id) {
	if (id == 14958011 || id == "14958011")	{
		return;
	}
	document.location.href = "/ArtistDetail/f_Artist_info.asp?artist_id=" + id ;
}

function ViewAlbum(id) {
	document.location.href = "/AlbumDetail/f_Album_info.asp?album_id=" + id ;
}  

function ViewMyPage(id, type) {
	if (type=="P"){
		window.open("/MyPage/f_MypageMain.asp?uno=" + id);
	}else {
		document.location.href = "/MyPage/f_MypageMain.asp?uno=" + id ;	
	}
}

function OpenerViewArtist(id) {
	if (id == 14958011 || id == "14958011")	{
		return;
	}
	try
	{
		opener.location.href = "/ArtistDetail/f_Artist_info.asp?artist_id=" + id ;
	}
	catch (e)
	{
		window.open("/ArtistDetail/f_Artist_info.asp?artist_id=" + id);
	}
}

function OpenerViewArtist_Popup(id) {
    if (id == 14958011 || id == "14958011") {
        return;
    }
    try {
        window.open("/ArtistDetail/f_Artist_info.asp?artist_id=" + id);
    }
    catch (e) {
        window.open("/ArtistDetail/f_Artist_info.asp?artist_id=" + id);
    }
}

function OpenerViewAlbum(id) {
	try
	{
		opener.location.href = "/AlbumDetail/f_Album_info.asp?album_id=" + id ;
	}
	catch (e) 
	{
		window.open("/AlbumDetail/f_Album_info.asp?album_id=" + id);
	}
}

function OpenerViewAlbum_Popup(id) {
    try {
        window.open("/AlbumDetail/f_Album_info.asp?album_id=" + id);
    }
    catch (e) {
        window.open("/AlbumDetail/f_Album_info.asp?album_id=" + id);
    }
}

function goCdMall(id) {
	window.open("http://www.sangarecords.co.kr/dosirak.php?gcode="+id);
}

function goEvent(id) {
	document.location.href = "/Event/f_EventView.asp?evid=" + id ;
}

/* PLAY */
function PlayAlbum(id) {
	if(webPlayerPop != null){
		if (!webPlayerPop.closed)
		{
			if (webPlayerPop.name == "webPlayer" )
			{
				webPlayerPop.addAlbumList(id);
				webPlayerPop.focus();
				return;
			}
		}
	}

	openPopupClass.poptype="P";
	openPopupClass.openpop( "" , "webPlayer" , 400 , 610 ) ;
	try	{
		webPlayerPop.addAlbumList(id);
		webPlayerPop.focus();
		return;
	}
	catch (e){
		openPopupClass.poptype="P";
		openPopupClass.openpop( "/DosirakPlayer/webPlayer/pop_MusicPlayer.asp?streamList="+id+"&type_gubun=1" , "webPlayer" , 400 , 610 ) ;
	}
}

function PlaySong(id) {
	if(webPlayerPop != null){
		if (!webPlayerPop.closed)
		{
			if (webPlayerPop.name == "webPlayer" )
			{
				webPlayerPop.addList(id);
				webPlayerPop.focus();
				return;
			}
		}
	}
	openPopupClass.poptype="P";
	openPopupClass.openpop( "" , "webPlayer" , 400 , 610 ) ;
	try	{
		webPlayerPop.addList(id);
		webPlayerPop.focus();
		return;
	}
	catch (e){
		openPopupClass.poptype="P";
		openPopupClass.openpop( "/DosirakPlayer/webPlayer/pop_MusicPlayer.asp?streamList="+id+"&type_gubun=2" , "webPlayer" , 400 , 610 ) ;
	}
}

function PlayMovie(id) {
	if(webMoviePop != null){
		if (!webMoviePop.closed)
		{
			if (webMoviePop.name == "webMoviePlayer" )
			{
				webMoviePop.addList(id);
				webMoviePop.focus();
				return;
			}
		}
	}
	openPopupClass.poptype="M";
	openPopupClass.openpop( "" , "webMoviePlayer" , 702 , 495 ) ;
	try	{
		webMoviePop.addList(id);
		webMoviePop.focus();
	}
	catch (e){
		openPopupClass.poptype="M";
		openPopupClass.openpop( "/DosirakPlayer/webPlayer/pop_MoviePlayer.asp?streamList="+id , "webMoviePlayer" , 702 , 495 ) ;
	}
}

function PlayAlbumAdult(id) {
	if ( checkAdult() )	{
		PlayAlbum(id)
	}
}

function PlaySongAdult(id) {
	if ( checkAdult() )	{
		PlaySong(id)
	}
}

function PlayMovieAdult(id) {
	if ( checkAdult() )	{
		PlayMovie(id)
	}
}

/* DOWN */
function DownAlbum(id) {
	if (isLogin != "true"){
		if (isGuest != "true")
		{
			DownOpenLogin(id,'album');
			return;
		}		
	}
	if(webDownPop != null){
		if (!webDownPop.closed)
		{
			if (webDownPop.name == "Down" )
			{
				if ( webDownPop.document.getElementById("SongLoadingCheck").value != "Y" ){
					webDownPop.fnSongAdd(id,"album");
					webDownPop.focus();
					return ; 
				}else {
					alert("Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
					return;
				}
			}
		}
	}

	openPopupClass.poptype="D";
	openPopupClass.scrollbars = "yes";
	openPopupClass.openpop( "" , "Down" , 618 , 635 ) ;
	try	{
		if ( webDownPop.document.getElementById("SongLoadingCheck").value != "Y" ){
			webDownPop.fnSongAdd(id,"album");
			webDownPop.focus();
		}else {
			alert("Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			return;
		}
	}
	catch (e){
		openPopupClass.poptype="D";
		openPopupClass.scrollbars = "yes";
		openPopupClass.openpop('/bill/buy/pop_f_musicbuy.asp?downType=album&s_downList='+id, 'Down', 618, 635);
	}
}

function DownSong(id) {
	if (isLogin != "true"){
		if (isGuest != "true")
		{
			DownOpenLogin(id,'song');
			return;
		}		
	}
	if(webDownPop != null){
		if (!webDownPop.closed)
		{
			if (webDownPop.name == "Down" )
			{
				if ( webDownPop.document.getElementById("SongLoadingCheck").value != "Y" ){
					webDownPop.fnSongAdd(id,"song");
					webDownPop.focus();
					return;
				}else {
					alert("Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
					return;
				}
			}
		}
	}
	openPopupClass.poptype="D";
	openPopupClass.scrollbars = "yes";
	openPopupClass.openpop( "" , "Down" , 618 , 635 ) ;
	try	{
		if ( webDownPop.document.getElementById("SongLoadingCheck").value != "Y" ){
			webDownPop.fnSongAdd(id,"song");
			webDownPop.focus();
		}else {
			alert("Àá½Ã ÈÄ ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			return;
		}
	}
	catch (e){
		openPopupClass.poptype="D";
		openPopupClass.scrollbars = "yes";
		openPopupClass.openpop('/bill/buy/pop_f_musicbuy.asp?downType=song&s_downList='+id, 'Down', 618, 635);
	}

}

function DownAlbumAdult(id) {
	if ( checkAdult() )	{
		DownAlbum(id)
	}
}

function DownSongAdult(id) {
	if ( checkAdult() )	{
		DownSong(id)
	}
}

/* SCRAP */
function ScrapAlbum(id) {
	if (isLogin != "true"){
		OpenLogin();
		return;
	}
	openPopupClass.openpop('/MyPage/Includes/Popup/f_popMyFolder_put.asp?MyFolderType=1&ContentID='+id+";", 'Scrap', 500, 527);
}

function ScrapSong(id) {
	if (isLogin != "true"){
		OpenLogin();
		return;
	}
	openPopupClass.openpop('/MyPage/Includes/Popup/f_popMyFolder_put.asp?MyFolderType=5&ContentID='+id+";", 'Scrap', 500, 527);
}

function ScrapMovie(id) {
	if (isLogin != "true"){
		OpenLogin();
		return;
	}
	openPopupClass.openpop('/MyPage/Includes/Popup/f_popMyFolder_put.asp?MyFolderType=4&ContentID='+id+";", 'Scrap', 500, 527);
}

function ScrapArtist(id) {
	if (isLogin != "true"){
		OpenLogin();
		return;
	}
	openPopupClass.openpop('/MyPage/Includes/Popup/f_popMyFolder_put.asp?MyFolderType=3&ContentID='+id+";", 'Scrap', 500, 527);
}

function ScrapOpenAlbum(id,Uno) {
	if (isLogin != "true"){
		OpenLogin();
		return;
	}
	openPopupClass.openpop('/MyPage/Includes/Popup/f_popMyFolder_put.asp?MyFolderType=2&MakerUno='+Uno+'&ContentID='+id+";", 'Scrap', 500, 527);
}


function ScrapAlbumAdult(id) {
	if ( checkAdult() )	{
		ScrapAlbum(id)
	}
}

function ScrapSongAdult(id) {
	if ( checkAdult() )	{
		ScrapSong(id)
	}
}

function ScrapMovieAdult(id) {
	if ( checkAdult() )	{
		ScrapMovie(id)
	}
}

/* INNERHTML */
function inHTML(obj,str){
	var strobj = "";
	strobj = "#"+obj;
	$(strobj).html(str);
}

/* APPENDHTML */
function appendHTML(obj,str){
	var strobj = "";
	strobj = "#"+obj;
	$(strobj).append(str);
}

/* REMOVEHTML */
function removeHTML(obj){
	var strobj = "";
	strobj = "#"+obj;
	$(strobj).remove();
}

/* IFRAME INNERHTML */
function inIframeHTML(fobj,obj,str){
	var strfobj = "";
	var strobj = "";
	strfobj = "#"+fobj;
	strobj = "#"+obj;
	$(strfobj).contents().find(strobj).html(str);
}

/* IFRAME APPENDHTML */
function appendIframeHTML(fobj,obj,str){
	var strfobj = "";
	var strobj = "";
	strfobj = "#"+fobj;
	strobj = "#"+obj;
	$(strfobj).contents().find(strobj).append(str);
}

/* IFRAME REMOVEHTML */
function removeIframeHTML(fobj,obj){
	var strfobj = "";
	var strobj = "";
	strfobj = "#"+fobj;
	strobj = "#"+obj;
	$(strfobj).contents().find(strobj).remove();
}

/* ADD CLASS */
function addClassName(obj,str){
	var strobj = "";
	strobj = "#"+obj;
	$(strobj).addClass(str);
}

/* REMOVE CLASS */
function removeClassName(obj){
	var strobj = "";
	strobj = "#"+obj;
	$(strobj).removeClass();
}

/* OBJECT HTML RESPONSE */
function selectHTML(obj){
	var strobj = "";
	strobj = "#"+obj;
	return $(strobj).html();
}

/* URL Encoding */
function URLEncode(txt){
	var SAFECHARS = "0123456789" +     
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + 
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";    
	var HEX = "0123456789ABCDEF";
	var plaintext = txt;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
		if (ch == " ") {
			encoded += ch;    /* x-www-urlencoded, rather than %20 */
		} else if (SAFECHARS.indexOf(ch) != -1) {
			encoded += ch;
		} else {
			var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				encoded += ch;
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	}
	return encoded;
};

/* URL Decoding */
function URLDecode(txt)
{
	if (txt==undefined || txt==null || txt=="")
	{
		return txt;
	}
	var HEXCHARS = "0123456789ABCDEFabcdef"; 
	var encoded = txt;
	var plaintext = "";
	var i = 0;
	while (i < encoded.length) {
		var ch = encoded.charAt(i);
		if (ch == "+") {
			plaintext += " ";
			i++;
		} else if (ch == "%") {
			if (i < (encoded.length-2) && HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 && HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				plaintext += ch;
				i++;
			}
		} else {
			plaintext += ch;
			i++;
		}
	}
	return plaintext;
};

/* Common Ajax List Call ( JSON return ) */
function ajaxList( sendUrl, page , pagesize , fnSuccess , fnError , appendArg) {	
			/* ( Call URL , PAGE , PAGESIZE ,
			   Ajax Success Call Function Name - (JSON obj), Ajax Error Call Function Name ( Error Status ) , Append Argument ( ex : '&a=a&b=b' ... ) */
	var startTime = new Date();
	startTime = startTime.getTime();
	
	var strArg = "";
	if ( appendArg!=undefined && appendArg!=null )
	{
		strArg = appendArg;
	}
	//alert(sendUrl+"?"+"usepage=asp&pageno=" + page + "&pagesize=" + pagesize + strArg);
	$.ajax({
		type: "GET",				/* http Åë½Å ¹æ½Ä */
		url: sendUrl,				/* È£Ãâ ÆäÀÌÁö URL */
		contentType: "application/x-www-form-urlencoded; charset=euc-kr",				/* Content Type ¼³Á¤ */
		data: "usepage=asp&pageno=" + page + "&pagesize=" + pagesize + strArg,			/* ÆÄ¶ó¹ÌÅÍ ¼³Á¤ */
		dataType: "text",																/* ¸®ÅÏ DATA Å¸ÀÔ */
		error:function (xhr, status){ 													/* Ajax È£Ãâ ½ÇÆÐ½Ã ½ÇÇàµÇ´Â ÇÔ¼ö */
					fnError(status);
					jsErrLog(" ÆäÀÌÁö AJAX È£Ãâ ¿¡·¯ errStatus : "+status + " , errURL : " + document.location + " , sendURL : " + sendUrl+"&usepage=asp&pageno=" + page + "&pagesize=" + pagesize + strArg);
				},
		success: function(jsonData){												/* Ajax È£Ãâ ¼º°ø½Ã ½ÇÇàµÇ´Â ÇÔ¼ö */
                    var endTime = new Date();
					endTime = endTime.getTime();
					if ( ( ( endTime - startTime ) / 1000 ) > 3 ){
						jsErrLog(" ajax Process time over  errCount : " + ( endTime - startTime ) / 1000 + " ÃÊ , errURL : " + document.location + " , sendURL : " + sendUrl+"&usepage=asp&pageno=" + page + "&pagesize=" + pagesize + strArg);
					}
					try	{
						var data = JSON.parse( jsonData );								/* JSON Çü½ÄÀÇ text ¸¦ °´Ã¼·Î ÄÁ¹öÆÃ */	
					}
					catch (e){
						/* alert(jsonData+" : JSON °´Ã¼ ÆÄ¼­ ¿¡·¯"); */
						alert("ÇØ´ç ÆäÀÌÁö¿¡ ¹®Á¦°¡ ÀÖ¾î Àá½Ã ÀÌ¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."); 
						jsErrLog(" ÆäÀÌÁö JSON °´Ã¼ ÆÄ¼­ ¿¡·¯ errURL : " + document.location + " , sendURL : " + sendUrl+"&usepage=asp&pageno=" + page + "&pagesize=" + pagesize + strArg);
						return;
					}				
					
					/* RESULT CODE EXCEPT */
					if (data.RESULT.RESULT_CD == "DP000"){
						fnSuccess(data);
						/*window.scrollTo(0,0);												 »ó´ÜÀ¸·Î ÀÌµ¿ */
						rollIcon();															/* Icon rollover ±â´É */
					}else if (data.RESULT.RESULT_CD == "DP002")	{/* ·Î±×ÀÎ ÀÌ ÇÊ¿äÇÑ ÆäÀÌÁö */
						document.location.href = "/Includes/Commons/Auth/f_UserLogin.asp?pageRefer=" + isPage ;					
					}else if (data.RESULT.RESULT_CD == "DP005")	{ /* º¸¾ÈÅ° ½ÇÆÐ */
						alert(data.RESULT.RESULT_MSG);
						document.location.href = "/dosirak_main.asp" ;
					}else if(data.RESULT.RESULT_CD == "DP350" || data.RESULT.RESULT_CD == "DP351" || data.RESULT.RESULT_CD == "DP352"){
						alert(data.RESULT.RESULT_MSG);
						document.location.href = "/dosirak_main.asp" ;
					}else {
						alert(data.RESULT.RESULT_MSG);
					}
					
					/* fnSuccess(data);		By  hano*/											/* ÄÁ¹öÆÃµÈ JSON °´Ã¼¸¦ »ç¿ëÇÏ¿© ±×·ÁÁÖ´Â ÇÔ¼ö È£Ãâ */ 
					
				}
		});		
}

/* Common Ajax Call ( JSON return ) */
function ajaxCall( sendUrl, method , Arg , fnSuccess , fnError) {	
				/* ( Call URL , METHOD TYPE (post,get) , Argument , Ajax Success Call Function , 
				   ajax Success Call Function Name - ( response text ), Ajax Error Call Function Name ( Error Status ) */
	var startTime = new Date();
	startTime = startTime.getTime();
	var strMethod = "";
	strMethod = method.toLowerCase();

	if ( strMethod != "post" && strMethod != "get" )
	{
		strMethod = "get";
	}
	$.ajax({
		type: strMethod,				/* http Åë½Å ¹æ½Ä */
		url: sendUrl,					/* È£Ãâ ÆäÀÌÁö URL */
		contentType: "application/x-www-form-urlencoded; charset=euc-kr",				
		data: Arg,																		
		dataType: "text",								
		error:function (xhr, status){
					fnError(status);
					jsErrLog(" ÆäÀÌÁö AJAX È£Ãâ ¿¡·¯ errStatus : "+status + " , errURL : " + document.location + " , sendURL : " + sendUrl+ "?" +Arg);
				},
		success: function(jsonData){		
					var endTime = new Date();
					endTime = endTime.getTime();
					if ( ( ( endTime - startTime ) / 1000 ) > 3 ){
						jsErrLog(" ajax Process time over  errCount : " + ( endTime - startTime ) / 1000 + " ÃÊ , errURL : " + document.location + " , sendURL : " + sendUrl+ "?" + Arg);
					}
					try	{
						var data = JSON.parse( jsonData );								/* JSON Çü½ÄÀÇ text ¸¦ °´Ã¼·Î ÄÁ¹öÆÃ */	
					}
					catch (e){
						/* alert(jsonData+" : JSON °´Ã¼ ÆÄ¼­ ¿¡·¯"); */
						alert("ÇØ´ç ÆäÀÌÁö¿¡ ¹®Á¦°¡ ÀÖ¾î Àá½Ã ÀÌ¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."); 
						jsErrLog(" ÆäÀÌÁö JSON °´Ã¼ ÆÄ¼­ ¿¡·¯ errURL : " + document.location + " , sendURL : " + sendUrl+ "?" + Arg);
						return;
					}


					/* RESULT CODE EXCEPT */
					if (data.RESULT.RESULT_CD == "DP000"){
						fnSuccess(data);
					}else if (data.RESULT.RESULT_CD == "DP002")	{/* ·Î±×ÀÎ ÀÌ ÇÊ¿äÇÑ ÆäÀÌÁö */
						document.location.href = "/Includes/Commons/Auth/f_UserLogin.asp?pageRefer=" + isPage ;					
					}else if (data.RESULT.RESULT_CD == "DP005")	{ /* º¸¾ÈÅ° ½ÇÆÐ */
						if (isGateType=="web")
						{
							alert(data.RESULT.RESULT_MSG);
							document.location.href = "/dosirak_main.asp" ;
						}
						else
						{
							location.href='MusicPortal:MsgBox|Msg:'+data.RESULT.RESULT_MSG+'|MsgResult:N';
						}						
					}else if (data.RESULT.RESULT_CD == "DP391"){/* ÈÞ´ëÆù ÀÎÁõ¹øÈ£ Àü¼Û ½ÇÆÐ: ETC.RETURN_CODE, ETC.RETURN_MSG*/
						fnSuccess(data);
					}else if (data.RESULT.RESULT_CD == "DP392"){/* ÈÞ´ëÆù ÀÎÁõ ½ÇÆÐ: ETC.RETURN_CODE, ETC.RETURN_MSG*/
						fnSuccess(data);
					}else if (data.RESULT.RESULT_CD == "DP210")	{ /* °ú±Ý ÆË¾÷ °ü·Ã */
						alert(data.RESULT.RESULT_MSG);
						fnSuccess(data);	
					}else {
						if (isGateType=="web")
						{
							alert(data.RESULT.RESULT_MSG);
						}
						else
						{
							location.href='MusicPortal:MsgBox|Msg:'+data.RESULT.RESULT_MSG+'|MsgResult:N';
						}						
					}
				}
		});		
}

/* Common Ajax Call ( JSON return ) */
function ajaxCallAsync( sendUrl, method , Arg , fnSuccess , fnError) {	
				/* ( Call URL , METHOD TYPE (post,get) , Argument , Ajax Success Call Function , 
				   ajax Success Call Function Name - ( response text ), Ajax Error Call Function Name ( Error Status ) */
	var startTime = new Date();
	startTime = startTime.getTime();
	var strMethod = "";
	strMethod = method.toLowerCase();

	if ( strMethod != "post" && strMethod != "get" )
	{
		strMethod = "get";
	}
	$.ajax({
		type: strMethod,				/* http Åë½Å ¹æ½Ä */
		url: sendUrl,					/* È£Ãâ ÆäÀÌÁö URL */
		contentType: "application/x-www-form-urlencoded; charset=euc-kr",				
		data: Arg,				
		async: false,									
		dataType: "text",	
		error:function (xhr, status){
					fnError(status);
					jsErrLog(" ÆäÀÌÁö AJAX È£Ãâ ¿¡·¯ errStatus : "+status + " , errURL : " + document.location + " , sendURL : " + sendUrl+ "?" +Arg);
				},
		success: function(jsonData){		
					var endTime = new Date();
					endTime = endTime.getTime();
					if ( ( ( endTime - startTime ) / 1000 ) > 3 ){
						jsErrLog(" ajax Process time over  errCount : " + ( endTime - startTime ) / 1000 + " ÃÊ , errURL : " + document.location + " , sendURL : " + sendUrl+ "?" + Arg);
					}
					try	{
						var data = JSON.parse( jsonData );								/* JSON Çü½ÄÀÇ text ¸¦ °´Ã¼·Î ÄÁ¹öÆÃ */	
					}
					catch (e){
						/* alert(jsonData+" : JSON °´Ã¼ ÆÄ¼­ ¿¡·¯"); */
						alert("ÇØ´ç ÆäÀÌÁö¿¡ ¹®Á¦°¡ ÀÖ¾î Àá½Ã ÀÌ¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."); 
						jsErrLog(" ÆäÀÌÁö JSON °´Ã¼ ÆÄ¼­ ¿¡·¯ errURL : " + document.location + " , sendURL : " + sendUrl+ "?" + Arg);
						return;
					}


					/* RESULT CODE EXCEPT */
					if (data.RESULT.RESULT_CD == "DP000"){
						fnSuccess(data);
					}else if (data.RESULT.RESULT_CD == "DP002")	{/* ·Î±×ÀÎ ÀÌ ÇÊ¿äÇÑ ÆäÀÌÁö */
						document.location.href = "/Includes/Commons/Auth/f_UserLogin.asp?pageRefer=" + isPage ;					
					}else if (data.RESULT.RESULT_CD == "DP005")	{ /* º¸¾ÈÅ° ½ÇÆÐ */
						if (isGateType=="web")
						{
							alert(data.RESULT.RESULT_MSG);
							document.location.href = "/dosirak_main.asp" ;
						}
						else
						{
							location.href='MusicPortal:MsgBox|Msg:'+data.RESULT.RESULT_MSG+'|MsgResult:N';
						}						
					}else if (data.RESULT.RESULT_CD == "DP391"){/* ÈÞ´ëÆù ÀÎÁõ¹øÈ£ Àü¼Û ½ÇÆÐ: ETC.RETURN_CODE, ETC.RETURN_MSG*/
						fnSuccess(data);
					}else if (data.RESULT.RESULT_CD == "DP392"){/* ÈÞ´ëÆù ÀÎÁõ ½ÇÆÐ: ETC.RETURN_CODE, ETC.RETURN_MSG*/
						fnSuccess(data);
					}else if (data.RESULT.RESULT_CD == "DP210")	{ /* °ú±Ý ÆË¾÷ °ü·Ã */
						alert(data.RESULT.RESULT_MSG);
						fnSuccess(data);	
					}else {
						if (isGateType=="web")
						{
							alert(data.RESULT.RESULT_MSG);
						}
						else
						{
							location.href='MusicPortal:MsgBox|Msg:'+data.RESULT.RESULT_MSG+'|MsgResult:N';
						}						
					}
				}
		});		
}
/* Common Ajax Call ( TEXT return ) */
function ajaxCallSimple( sendUrl, method , Arg , fnSuccess , fnError) {	
				/* ( Call URL , METHOD TYPE (post,get) , Argument , Ajax Success Call Function , 
				   ajax Success Call Function Name - ( response text ), Ajax Error Call Function Name ( Error Status ) */
	var startTime = new Date();
	startTime = startTime.getTime();

	var strMethod = "";
	strMethod = method.toLowerCase();

	if ( strMethod != "post" && strMethod != "get" )
	{
		strMethod = "get";
	}
	$.ajax({
		type: strMethod,				/* http Åë½Å ¹æ½Ä */
		url: sendUrl,					/* È£Ãâ ÆäÀÌÁö URL */
		contentType: "application/x-www-form-urlencoded; charset=euc-kr",				
		data: Arg,																		
		dataType: "text",																
		error:function (xhr, status){ 	
					fnError(status);
					jsErrLog(" ÆäÀÌÁö AJAX È£Ãâ ¿¡·¯ errStatus : "+status + " , errURL : " + document.location + " , sendURL : " + sendUrl+ "?" + Arg);
				},
		success: function(data){														
					var endTime = new Date();
					endTime = endTime.getTime();
					if ( ( ( endTime - startTime ) / 1000 ) > 3 )
					{
						jsErrLog(" ajax Process time over  errCount : " + ( endTime - startTime ) / 1000 + " ÃÊ , errURL : " + document.location + " , sendURL : " + sendUrl+  "?" + Arg);
					}
					fnSuccess(data);
				}
		});		
}

/* Common Ajax Call ( TEXT return ) */
function ajaxCallSimpleAsync( sendUrl, method , Arg , fnSuccess , fnError, Async) {	
				/* ( Call URL , METHOD TYPE (post,get) , Argument , Ajax Success Call Function , 
				   ajax Success Call Function Name - ( response text ), Ajax Error Call Function Name ( Error Status ) */
	var startTime = new Date();
	startTime = startTime.getTime();

	var strMethod = "";
	strMethod = method.toLowerCase();

	if ( strMethod != "post" && strMethod != "get" )
	{
		strMethod = "get";
	}
	$.ajax({
		type: strMethod,				/* http Åë½Å ¹æ½Ä */
		url: sendUrl,						/* È£Ãâ ÆäÀÌÁö URL */
		contentType: "application/x-www-form-urlencoded; charset=euc-kr",				
		data: Arg,
		async: Async,			
		dataType: "text",																
		error:function (xhr, status){ 	
					fnError(status);
					jsErrLog(" ÆäÀÌÁö AJAX È£Ãâ ¿¡·¯ errStatus : "+status + " , errURL : " + document.location + " , sendURL : " + sendUrl+ "?" + Arg);
				},
		success: function(data){														
					var endTime = new Date();
					endTime = endTime.getTime();
					if ( ( ( endTime - startTime ) / 1000 ) > 3 )
					{
						jsErrLog(" ajax Process time over  errCount : " + ( endTime - startTime ) / 1000 + " ÃÊ , errURL : " + document.location + " , sendURL : " + sendUrl+  "?" + Arg);
					}
					fnSuccess(data);
				}
		});		
}
function jqueryForm(thisUrl,formName,FnSuccess,FnError){		/* js fileupload/form ajax submit	04/21 by ±è¼º¿¬ */
	var startTime = new Date();
	startTime = startTime.getTime();

	var form;
		form = '#'+formName;
		 var options = { 
				 error:			FnError,
				 success:		FnSuccess, 		
				 url:       thisUrl , 
				 type:      'post',
				error:function (xhr, status){ 
							FnError(status);
							jsErrLog(" ÆäÀÌÁö AJAX È£Ãâ ¿¡·¯ errStatus : "+status + " , errURL : " + document.location + " , sendURL : " + sendUrl);
						},
				success: function(data){	
							var endTime = new Date();
							endTime = endTime.getTime();
							if ( ( ( endTime - startTime ) / 1000 ) > 3 )
							{
								jsErrLog(" ajax Process time over  errCount : " + ( endTime - startTime ) / 1000 + " ÃÊ , errURL : " + document.location + " , sendURL : " + sendUrl);
							}
							FnSuccess(data);
						}
			 }; 
					 $(form).ajaxSubmit(options); 
}


/* javascript error log ajax with j-query */
function jsErrLog(err){				
	var errmsg = broserCheck() + " browser , " +err;

	broserCheck()
	var sendUrl		= "/Includes/Commons/Log/jsErrLog.asp";
	var ErrPageUrl = location.pathname;
	$(document).ready(function() 
	{
		ajax_js_err_log(ErrPageUrl ,err , errmsg );
	});

	function ajax_js_err_log(ErrPageUrl, err , errmsg  ) {
		$.ajax({
			type: "POST",
			url: sendUrl,
			contentType: "application/x-www-form-urlencoded; charset=euc-kr",  
			data: "ErrPageUrl="+  escape(ErrPageUrl)  +"&err=" + escape(err)  +"&errmsg=" + escape(errmsg)   ,
			dataType: "text",
			success: function(data){
					}
			});
	}
} 

/* LAYER SCROLL FIX */
function layerFix(){
	var scrollTop	= document.documentElement.scrollTop;
	var bodyHeight	= document.getElementsByTagName("body")[0].offsetHeight;

	var objfix = document.all? document.all["popup_layerS"]:document.getElementById( "popup_layerS");

	if ( objfix != null ) {
		document.getElementById("popup_layerS").style.top = ( bodyHeight / 2 ) + scrollTop - ( objfix.offsetHeight / 2 );
	}
}

/* ALERT MSG LAYER */
function alertLayer(msg,frameType) {
/*	if (frameType == "iframe")
	{
		parent.document.documentElement?parent.alertLayerDecoration(msg):alertLayerDecoration(msg)
	} else {
		alertLayerDecoration(msg);
	}	*/
	alertLayerDecoration(msg,"",frameType);
}

/* ALERT MSG LAYER */
function alertLayerOK(msg,fnSuccess,layertype) {
	alertLayerDecoration(msg,fnSuccess,layertype);
}

function alertLayerDecoration(msg,fnSuccess,layertype) {
	if (layertype == "layer") {
		var obj = document.all? document.all["popup_layerS"]:document.getElementById("popup_layerS");
		if ( obj == null ) {

			var mybody = document.getElementsByTagName("body")[0];
			var divElement = document.createElement ( "div");

			divElement.setAttribute ( "id", "popup_layerS");
			divElement.setAttribute ( "align", "left");
			divElement.style.display = 'none';
			divElement.style.width = '257px';
			divElement.style.zIndex = '300';
			divElement.style.position="absolute";

			mybody.appendChild ( divElement );
		}
		
		var div_result = document.getElementById ('popup_layerS');

		var clientHeight= document.documentElement.clientHeight;
		var clientWidth = document.documentElement.clientWidth;	
		var bodyWidth	= $("body").width();
		var bodyHeight	= $("body").height();
		var scrollTop	= document.documentElement.scrollTop;
		var scrollLeft	= document.documentElement.scrollLeft;
		var layerTop	=( bodyHeight / 2 ) + scrollTop - ( $("#popup_layerS").height() / 2 ) ;
		var layerLeft	=( bodyWidth / 2 ) + scrollLeft - ( $("#popup_layerS").width() / 2 ) ;
		var strHTML = "";
		if ( bodyHeight < div_result.offsetHeight || bodyWidth < $("#popup_layerS").width() )
		{
			alert(msg);
			if (fnSuccess != undefined)	{
				fnSuccess();
			}
			return;
		}

		if (fnSuccess != undefined && fnSuccess != "" )	{
			confirmSuccess.success = fnSuccess ;
		}

		div_result.style.top	= layerTop + "px" ;
		div_result.style.left	= layerLeft + "px" ;

		div_result.style.display = "block";

		strHTML += "<div class=\"lay_con png24\">";
		strHTML += "<div class=\"lay_head\">";
		strHTML += "<h1><img src=\""+imgServer+"/Images/Commons/popupLay_h1_notice.gif\" alt=\"¾Ë¸²\" /></h1>";
		if (fnSuccess != undefined && fnSuccess != "" )	{
			strHTML += "<div class=\"btn_close\"><a href=\"javascript:;\" onclick=\"confirmTrue();alertLayerClose();return false;\">";
		}else {
			strHTML += "<div class=\"btn_close\"><a href=\"javascript:;\" onclick=\"alertLayerClose();return false;\">";
		}
		strHTML += "<img src=\""+imgServer+"/Images/Commons/btn_laypopCloseS_off.gif\" alt=\"close\" /></a></div>";
		strHTML += "</div>";
		strHTML += "<div class=\"lay_body\" style=\"height:80px;\">";
		strHTML += msg;
		strHTML += "</div></div><div class=\"lay_btm png24\"></div>";

		window.onscroll=layerFix;

		inHTML("popup_layerS",strHTML);	
	} else {
		alert(msg.replace(/<br[^>]+>/g, "\n").RemoveTag());
		if (fnSuccess != undefined && fnSuccess != "")	{
			fnSuccess();
		}
	}
}

function alertLayerOpen() {
	document.getElementById ('popup_layer').style.display = "block";
}

function alertLayerClose() {
	document.getElementById ('popup_layerS').style.display = "none";
}


/* CONFIRM MSG LAYER */
function confirmLayer(msg,fnSuccess) {
/*	var obj = document.all? document.all["popup_layerS"]:document.getElementById("popup_layerS");
	if ( obj == null ) {

		var mybody = document.getElementsByTagName("body")[0];
		var divElement = document.createElement ( "div");


		divElement.setAttribute ( "id", "popup_layerS");
		divElement.setAttribute ( "align", "left");
		divElement.style.display = 'none';
		divElement.style.width = '257px';
		divElement.style.zIndex = '300';
		divElement.style.position="absolute";

		mybody.appendChild ( divElement );
	}
	
	var div_result = document.getElementById ('popup_layerS');

	var clientHeight= document.documentElement.clientHeight;
	var clientWidth = document.documentElement.clientWidth;	
	var bodyWidth	= document.getElementsByTagName("body")[0].offsetWidth;
	var bodyHeight	= document.getElementsByTagName("body")[0].offsetHeight;
	var scrollTop	= document.documentElement.scrollTop;
	var scrollLeft	= document.documentElement.scrollLeft;
	var layerTop	=( bodyHeight / 2 ) + scrollTop - ( div_result.offsetHeight / 2 ) ;
	var layerLeft	=( bodyWidth / 2 ) + scrollLeft - ( $("#popup_layerS").width() / 2 ) ;
	var strHTML = "";

	if ( bodyHeight < div_result.offsetHeight || bodyWidth < $("#popup_layerS").width() )
	{
		alert(msg);
		return;
	}
	confirmSuccess.success = fnSuccess ;

	div_result.style.top	= layerTop + "px" ;
	div_result.style.left	= layerLeft + "px" ;

	div_result.style.display = "block";

	strHTML += "<div class=\"lay_con png24\">";
	strHTML += "<div class=\"lay_head\">";
	strHTML += "<h1><img src=\""+imgServer+"/Images/Commons/popupLay_h1_notice.gif\" alt=\"¾Ë¸²\" /></h1>";
	strHTML += "<div class=\"btn_close\"><a href=\"javascript:;\" onclick=\"confirmTrue();confirmLayerClose();return false;\">";
	strHTML += "È®ÀÎ</a>&nbsp;|&nbsp;"
	strHTML += "<a href=\"javascript:;\" onclick=\"confirmLayerClose();return false;\">Ãë¼Ò</a></div>";
	strHTML += "</div>";
	strHTML += "<div class=\"lay_body\" style=\"height:80px;\">";
	strHTML += msg;
	strHTML += "</div></div><div class=\"lay_btm png24\"></div>";

	window.onscroll=layerFix;

	inHTML("popup_layerS",strHTML);	*/

	if(confirm(msg.replace(/<br[^>]+>/g, "\n").RemoveTag())) {
		fnSuccess();
	}
}

function confirmLayerClose() {
	document.getElementById ('popup_layerS').style.display = "none";
}

function confirmTrue() {
	confirmSuccess.success();
}
var confirmSuccess = {
	success:function(){}
}


/***********************************************************************************/
var idMessage="¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!"
var pwMessage="ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!"
function UserLoginDefuelt()
{
	if (document.g_loginFrm.g_UserId.value.isBlank())
	{
		alert(idMessage);
		document.g_loginFrm.g_UserId.focus();
		return ;
	}

	if (document.g_loginFrm.g_siteDomain2)
	{
		for(var i=0; i<document.g_loginFrm.g_siteDomain2.length;i++) {
		   if(document.g_loginFrm.g_siteDomain2[i].checked) 
			   document.g_loginFrm.g_siteDomain.value=i+1;
		}
	}

	if(document.g_loginFrm.g_UserId.value.LoginCheckCharId()){	// 12°³ Æ¯¼ö¹®ÀÚ ·Î±×ÀÎ ºÒ°¡
		if(document.g_loginFrm.g_siteDomain.value=='2'){
			var inputUserId = document.g_loginFrm.g_UserId.value;
			var popup = window.open('/Includes/Commons/Auth/f_BadId.asp?inputUserId='+inputUserId,'Badid',"width=425, height=600, scrollbars=no");
			popup.focus();
			return;
		}
	}
	if (document.g_loginFrm.g_UserPw.value.isBlank())
	{
		alert(pwMessage);
		document.g_loginFrm.g_UserPw.focus();
		return ;
	}

	

	if (pageRefer=="")
		document.g_loginFrm.g_pageRefer.value= isPage;
	else
		document.g_loginFrm.g_pageRefer.value= pageRefer;


	document.g_loginFrm.action = '/Includes/Commons/Auth/b_UserLogin.asp';
	document.g_loginFrm.submit();
}


function loginKeyPress()
{          
           var agt=navigator.userAgent.toLowerCase();
           if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) ) {
                     if(event.keyCode == 13){
                                UserLoginDefuelt();
                     }                    
           }          
}



function UserLogout()
{
	/*g_loginFrm.g_pageRefer.value= isPage;*/
	location.href = '/Includes/Commons/Auth/b_UserLogout.asp';
}

/*Login*/
function OPenerChk(){
	return 2;
}

function OpenLogin() {
	var sLoginType
	try
	{
		sLoginType=opener.OPenerChk()
	}
	catch (e)
	{
		sLoginType=1
	}
	openPopupClass.openpop('/Includes/Commons/Auth/pop_openLogin.asp?g_LoginOpt='+sLoginType, 'LoginPopUp', 400, 460);
}

function DownOpenLogin(id,type) {
	var sLoginType
	try
	{
		sLoginType=opener.OPenerChk()
	}
	catch (e)
	{
		sLoginType=1
	}
	openPopupClass.openpop('/Includes/Commons/Auth/pop_DownLogin.asp?g_LoginOpt='+sLoginType+'&downType='+type+'&s_downList='+id, 'DownLoginPopUp', 400, 270);
}


function OpeenSearchPop(iMaxCount) {
	if (iMaxCount == undefined)
	{
		iMaxCount = 0
	}
	openPopupClass.openpop('/Global/SearchPop/pop_SearchPop.asp?maxcount='+iMaxCount, 'SearchPop', 500, 590);
}

function userJoin() {

	try
	{
		opener.opener.opener.document.location.href ='/Member/f_agreement.asp';
		window.close();
	}
	catch (e)
	{
	
		try
		{
			opener.opener.document.location.href ='/Member/f_agreement.asp';
			window.close();
		}
		catch (e)
		{
			try
			{
				opener.document.location.href ='/Member/f_agreement.asp';
				window.close();
			}
			catch (e)
			{
				if (window.name=='LoginPopUp' || window.name=='DownLoginPopUp')
				{
					openPopupClass.openpop('/Member/f_agreement.asp', '_blank' , 400, 400);
					window.close();
				}
				else
				{
					location.href='/Member/f_agreement.asp';
				}				
			}
		}
	}
}

function userFindIDPW() {
	try
	{
		opener.opener.opener.document.location.href ='/CustomerCenter/Forgot/f_ForgotRoot.asp';
		window.close();
	}
	catch (e)
	{
	
		try
		{
			opener.opener.document.location.href ='/CustomerCenter/Forgot/f_ForgotRoot.asp';
			window.close();
		}
		catch (e)
		{
			try
			{
				opener.document.location.href ='/CustomerCenter/Forgot/f_ForgotRoot.asp';
				window.close();
			}
			catch (e)
			{
				if (window.name=='LoginPopUp' || window.name=='DownLoginPopUp')
				{
					openPopupClass.openpop('/CustomerCenter/Forgot/f_ForgotRoot.asp', '_blank' , 400, 400);
					window.close();
				}
				else
				{
					location.href='/CustomerCenter/Forgot/f_ForgotRoot.asp';
				}				
			}
		}
	}
}

/* ================================ FLASH Layer ==================================== */

function flashPlaySong( songid, Adult ) {
	if (Adult=='Y')
		PlaySongAdult(songid)
	else
		PlaySong(songid) 
}

function flashScrapSong(songid) {
	ScrapSong(songid);
}
/*======  °ø°³¾Ù¹ü °ø¿ë (wisecart Æ÷ÇÔ)*/
function goListenAll(idx){
	var sendU="/OpenAlbum/json/j_SongLisPlay.asp";

	var sendArg = "&idx="+idx;

	ajaxList(sendU,1,100, successGolisten , FailList , sendArg);
}

var FailList = function(){
	alert('Àá½Ã ÈÄ ÀÌ¿ëÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.');
}

function goDownAll(idx){
	var sendU="/OpenAlbum/json/j_SongLisPlay.asp";

	var sendArg = "&idx="+idx;

	ajaxList(sendU,1,100, successGoDown , FailList , sendArg);
}	

var successGolisten = function(DATA){
	var form = document.frmList;
	var strAlbum_id		 = "";
	var strAlbum_name	 = "";
	if (DATA.SONG_LIST){
		$.each(DATA.SONG_LIST.SONG,function(i){
			strAlbum_id += this.SONG_ID+";";
		});
	}
	PlaySong(strAlbum_id);
}

var successGoDown = function(DATA){
	var form = document.frmList;
	var strAlbum_id		 = "";
	var strAlbum_name	 = "";
	if (DATA.SONG_LIST){
		$.each(DATA.SONG_LIST.SONG,function(i){
			strAlbum_id += this.SONG_ID+";";
		});
	}
	DownSong(strAlbum_id);
}

function onSongListen(ArtistID)
{
	var strSongID;
	var arrSongIDInfo;
	var arrSongID;
	var i;

	strSongID = "";

	var ajaxSuccess = function(text) 
	{
		arrSongIDInfo = text.split("|");
		for(i=0;i<arrSongIDInfo.length-1;i++)
		{
			arrSongID = arrSongIDInfo[i].split("@");
			strSongID = strSongID + arrSongID[1] + ";";
		}

		PlaySong(strSongID);
	}

	var ajaxError = function(error) 
	{
		alert("ÀúÀå¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.");
	}

	//»èÁ¦
	var sendUrl		= "/MyPage/MyMusic/MyArtist/j_MyArtistList.asp";
	var strParam;

	strParam = "";
	strParam = strParam + "uno=" + isUno;
	strParam = strParam + "&FlagType=GetSong";
	strParam = strParam + "&ArtistID="+ArtistID;

	ajaxCallSimple(sendUrl,"get",strParam,ajaxSuccess,ajaxError);	
}
/*===================================================*/

/* ================================ DEGIN Layer ==================================== */
// show, hide
function show_con(id) {
	var id_obj = document.getElementById(id);
	id_obj.style.display = 'block';
}

function hide_con(id) {
	var id_obj = document.getElementById(id);
	id_obj.style.display = 'none';
}

/* ´Ü¼ø rollover Á¦¾î jquery-1.3.2.min.js ¿Í ¿¬µ¿*/
function rollIcon() {
	$('a.BasicOver img').hover(
		function() {
			this.src = this.src.replace( /_off\.gif$/, '_over.gif' );
		},
		function() {
			this.src = this.src.replace( /_over\.gif$/, '_off.gif' );
		}
	);
}
function rollIcon2() {
	$('a.BasicOver2 img').hover(
		function() {
			this.src = this.src.replace( /_off\.gif$/, '_on.gif' );
		},
		function() {
			this.src = this.src.replace( /_on\.gif$/, '_off.gif' );
		}
	);
}
$(function() {
	rollIcon();
	rollIcon2();
});

var overShow = function (clsName) {
	var classes = getElementsByClass(clsName);
	for(var i = 0; i < classes.length; i++) {
		classes[i].onmouseover = function () {
			this.className = clsName + ' on';
		}
		classes[i].onmouseout = function () {
			this.className = this.className.replace(/\son/,'');
		}
	}
};

var getElementsByClass = function (searchClass ,node, tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}


function conExpend(n)	{
	obj = document.getElementById(n);
	obj_img = document.getElementById(n + '_btn');

	document.getElementById("tmpTag").value="";

	if (obj.style.display == "none" ) {
		obj.style.display = "block";
		obj_img.src=imgServer+"/Images/Commons/btn_tagClose.gif";
	}
	else {
	obj.style.display = "none";
	obj_img.src=imgServer+"/Images/Commons/btn_tagOpen.gif";
	}
}

function conStyle(n)	{
	obj = document.getElementById(n);
	obj_img = document.getElementById(n + '_btn');

	if (obj.style.display == "none" ) {
		obj.style.display = "block";
		obj_img.src=imgServer+"/Images/GenreMusic/btn_styleType_close.gif";
	}
	else {
	obj.style.display = "none";
	obj_img.src=imgServer+"/Images/GenreMusic/btn_styleType_open.gif";
	}
}

function conRecmd(n)	{
	obj = document.getElementById(n);
	obj_img = document.getElementById(n + '_btn');

	if (obj.style.display == "none" ) {
		obj.style.display = "block";
		obj_img.src=imgServer+"/Images/Commons/btn_recmdMusic_close.gif";
	}
	else {
	obj.style.display = "none";
	obj_img.src=imgServer+"/Images/Commons/btn_recmdMusic_open.gif";
	}
}



/* gnb ÅëÇÕ°Ë»ö*/
if (document.addEventListener) {
    document.addEventListener('click', function (event) {
        check_stHidden(event);
    }, false);
} else {
    document.attachEvent('onclick', function (event) {
        check_stHidden(event);
    });
}

var check_stHidden = function (event) {

    if (!document.getElementById('st') || !document.getElementById('layPop_sb'))
    {
        return;
    }

    event = event || window.event;
    if (event.stopPropagation) {
        event.stopPropagation();

        if (event && event.target && event.target.id)
        {
            switch (event.target.id)
            {
                case 'm_brunch1' : return;
                    break;
                case 'm_brunch2' : return;
                    break;
                case 'layPop_1' : return;
                    break;
            }
        }
    } else {
        event.cancelBubble = true;

        if (event && event.srcElement && event.srcElement.id)
        {
            switch (event.srcElement.id)
            {
                case 'm_brunch1' : return;
                    break;
                case 'm_brunch2' : return;
                    break;
                case 'layPop_1' : return;
                    break;
            }
        }
    }

    stHidden('st');
    sbHidden('layPop_sb');
};

/* gnb type select */
function stView(idName)
{
	arrowBtn_obj = document.getElementById("arrowBtn");
	var	obj_lay	= document.getElementById("" + idName + "");

    if (obj_lay && arrowBtn_obj)
    {
        obj_lay.style.display="block";
	    obj_lay.style.zIndex="10";
	    arrowBtn_obj.className="btnUp"
    }
}

function stHidden(idName)
{
	arrowBtn_obj = document.getElementById("arrowBtn");
	var	obj_lay	= document.getElementById(idName);

    if (obj_lay && arrowBtn_obj) {
        setTimeout("document.getElementById('" + idName + "').style.display = 'none';" , 150);
        obj_lay.style.zIndex="1";
        arrowBtn_obj.className="btnDown";
    }
}

function sbView(idName)
{
	arrowBtn_obj = document.getElementById("arrowBtn2");
	var	obj_lay	= document.getElementById(idName);

	obj_lay.style.display = "block";

	obj_lay.style.zIndex="10";
	arrowBtn_obj.className="btnUp";
}

function sbHidden(idName)
{
	arrowBtn_obj = document.getElementById("arrowBtn2");
	var	obj_lay	= document.getElementById("" + idName + "");

	setTimeout("document.getElementById('" + idName + "').style.display = 'none';" , 150);
	obj_lay.style.zIndex="1";
	arrowBtn_obj.className="btnDown";
}

function toggle_class(obj,classname){
	obj.className==classname?obj.className='':obj.className=classname;
}

function toggle_p(obj,classname){
	toggle_class(obj,classname);
	var obj_li = obj.parentNode.getElementsByTagName('li');
	for	(i=0; i<obj_li.length; i++ )	{
		if (obj_li[i]==obj){
			obj_li[i].className=classname;
		}else {
			if (obj_li[i].className==classname){
				obj_li[i].className='';
			}
		}
	}
}

/* ·Î±×ÀÎ µµ½Ã¶ô¸Ó´Ï layPop */
function conMony(n)	{

	obj = document.getElementById(n);
	obj_img = document.getElementById(n + '_btn');
	
	if (obj.style.display == "none" ) {
		obj.style.display = "block";
		obj_img.src=imgServer+"/Images/Commons/ico_darrow_close.gif";
		loadUserProductInfo();
	}else{
	obj.style.display = "none";
	obj_img.src=imgServer+"/Images/Commons/ico_darrow_open.gif";
	//loginHeightJs('40');
	}
}

/* »ó´Ü ³×ÀÌ°ÔÀÌ¼Ç  by ±è¼º¿¬&*/
function navi_Write(targetName,targetNameAction,targetName2){
	strHTML="";
	strHTML+="<span class='home'><a href='javascript:;' onClick=\"location.href='../dosirak_main.asp';return false;\">È¨</a></span>";				
	strHTML+="<span style='margin:0 4;'><img src='"+imgServer+"/Images/Commons/ico_location_01.gif' alt='&gt;' /></span>";
	if(targetName==undefined){
		strHTML+="<strong>"+thisMainName+"</strong>";
	}else if(targetNameAction==undefined){
		strHTML+="<span><a href='javascript:;' onClick='"+thisMainAction+"'>"+thisMainName+"</a></span>";
		strHTML+="<span style='margin:0 4;'><img src='"+imgServer+"/Images/Commons/ico_location_01.gif' alt='&gt;' /></span>";
		strHTML+="<strong>"+targetName+"</strong>";
	}else if(targetNameAction!=undefined){
		strHTML+="<span><a href='javascript:;' onClick='"+thisMainAction+"'>"+thisMainName+"</a></span>";
		strHTML+="<span style='margin:0 4;'><img src='"+imgServer+"/Images/Commons/ico_location_01.gif' alt='&gt;' /></span>";
		strHTML+="<span><a href='javascript:;' onClick='"+targetNameAction+"'>"+targetName+"</a></span>";
		strHTML+="<span style='margin:0 4;'><img src='"+imgServer+"/Images/Commons/ico_location_01.gif' alt='&gt;' /></span>";
		strHTML+="<strong>"+targetName2+"</strong>";
	}
	inHTML('navi_location',strHTML);
}

function broserCheck() {

	if ($.browser.msie)
	{
		return ("IE " + $.browser.version );
	}else if ($.browser.safari)
	{
		return ("safari " + $.browser.version );
	}else if ($.browser.opera)
	{
		return ("opera " + $.browser.version );
	}else if ($.browser.mozilla)
	{
		return ("mozilla " + $.browser.version );
	}

}


function CheckRealMem(MemUno,isClient)
{
	/*state : 0 ºñ°ø°³, state : 1 °ø°³*/
	var ajaxSuccess = function(text) 
	{	
		if(text == "N")
		{
			setCookie("realmemcookies",'N',1);
			openwin("/Popup/main/poprealmember.asp","event0717","450","482");
		}
	}

	var ajaxError = function(error) 
	{
		//´ë»óÀ¯Àú°¡ ¾Æ´Ò°æ¿ì
	}

	var sendUrl		= "/Popup/main/b_poprealmember.asp";
	var strParam;

	strParam = "";
	strParam = strParam + "MemUno="+MemUno;
	strParam = strParam + "&ClientYn="+isClient;
	strParam = strParam + "&ProcessType=1";

	sendUrl = sendUrl + "?" +strParam;
	
	ajaxCallSimple(sendUrl,"get","",ajaxSuccess,ajaxError);	

}

/*
    Ajax¿¡¼­ µÚ·Î°¡±â ¹öÆ° È°¼ºÈ­ - 2009.08.26 KT¹ÂÁ÷ ÀÌ°­ÁØ
*/

function init() {
		dhtmlHistory.initialize();
		dhtmlHistory.addListener(historyChange);
}

function historyChange(newLocation, historyData) {
    var historyMsg = (typeof historyData == "object" && historyData != null
		    ? historyStorage.toJSON(historyData)
		    : historyData
	    );
	if (callFuncName != null)
        callFuncName(newLocation);
};

addHistoryEvent = function(hsName, hsVal) {
    dhtmlHistory.add(hsName, hsVal);
}
/*¹ÂÁ÷ºñµð¿À ÆäÀÌÁö ½ºÅ©·Ñ top ¹öÆ° ½ÃÀÛ*/
function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.getElementById("contenWrap")
}

function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) {
			offset += search.length
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}
function staticbar(){

    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var d = document;
    function ml(id){
        var el=d.getElementById(id);
        if (!persistclose || persistclose && get_cookie("remainclosed")=="")
        el.style.visibility="visible"
        if(d.layers)el.style=el;
        el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
        el.x = startX;
        if (verticalpos=="fromtop")
        el.y = startY;
        else{
        el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
        el.y -= startY;
        }
        return el;
    }
    window.stayTopLeft=function(){
        if (verticalpos=="fromtop"){
        var pY = ns ? pageYOffset : iecompattest().scrollTop;
        ftlObj.y += (pY + startY - ftlObj.y)/15;
        }
        else{
        var pY = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
        ftlObj.y += (pY - startY - ftlObj.y)/15;
        }
        ftlObj.sP(ftlObj.x, ftlObj.y);
        setTimeout("stayTopLeft()", 2);
    }
    ftlObj = ml("topbar");
    stayTopLeft();
}
/*¹ÂÁ÷ºñµð¿À ÆäÀÌÁö ½ºÅ©·Ñ top ¹öÆ° ³¡*/