var CYWORLD_WEB_DOMAIN = 'www.cyworld.com';

/**
 * ÆË¾÷À» ¶ç¿î´Ù.
 * PopUp(url, name, w, h, l, t, s)
 */
function PopUp(url, name, w, h, l, t, s) {
	var windowprops = 'location=no,scrollbars=' + s + ',menubars=no,toolbars=no,resizable=no' + ',left=' + l + ',top=' + t + ',width=' + w + ',height=' + h;
	popup = window.open( url, name, windowprops);
	popup.focus();
}

/**
 * À©µµ¿ì ¸®»çÀÌÁî - ±âº»ÀûÀ¸·Î w, h°ªÀ» ³ÖÁö¾Ê¾Æµµ µÊ!!
 * PopUpResize()
 */
function PopUpResize(w, h){
	if(w == "" || w == undefined) w = 0;
	if(h == "" || h == undefined) h = 0;

	if(w==0 && h==0){
		if (document.all)
		{
			if (navigator.appVersion.indexOf('MSIE 5')>0) self.resizeTo(10, 10);
			var elm = document.body;
			w = elm.scrollWidth  + parseInt(elm.leftMargin) + parseInt(elm.rightMargin)*2;
			h= elm.scrollHeight + parseInt(elm.topMargin) + parseInt(elm.bottomMargin)*2;
		}
		else if(document.layers)
		{
			self.resizeTo(10, 10);
			w = document.width;
			h= document.height;
		}
	}
	self.resizeTo(w, h);
}


/**
 * resizePopup()
 * ÆË¾÷ ¸®»çÀÌÁî
 */
function resizePopup(w, h){
	var UA = navigator.userAgent;
	var IE6 = UA.indexOf('MSIE 6.0') > 0;
	var IE7 = UA.indexOf('MSIE 7.0') > 0;
	var IE8 = UA.indexOf('MSIE 8.0') > 0;
	var FF = UA.indexOf('Firefox') > 0;
	var addH = 0;
	if (FF) {
		addH = 85;
	} else if (IE8) {
		addH = 84;
	} else if (IE7) {
		addH = 80;
	} else {
		addH = 58;
	}
	var maxH = 650;	//popup max height
	var resizeH = (h > maxH) ? maxH : h+addH;
	window.resizeTo(w, resizeH);
}


/**
 * ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿.
 * ·Î±×ÀÎ ÆäÀÌÁö¿¡¼­ ·Î±×ÀÎÈÄ ¿øÆäÀÌÁö·Î ´Ù½Ã º¹±Í
 */
function cylogin() {
	document.location.href = 'http://'+CYWORLD_WEB_DOMAIN+'/main2/login.asp?loginstr=direct&redirection='+escape(document.location.href);
}

/**
 * ¼­ºñ½º ¾Ë¸®¹Ì ½ÅÃ»ÇÏ±â
 * service_alarm_request(pEd, pEId)
 */
function service_alarm_request(pEd, pEId) {
    //alert("¼­ºñ½º °³¼±À» À§ÇØ ÀÛ¾÷ÁßÀÔ´Ï´Ù. 7/1ÀÏ ¿ÀÀü 5½ÃºÎÅÍ »ç¿ëÀÌ °¡´ÉÇÕ´Ï´Ù.");
	PopUp('/serviceAlarm/service_alarm_insert.asp?pType='+pEd+'&pEid='+pEId, 'service_alarm_request', 350, 290, 50, 50, 'no');
}

/**
 * ¼­ºñ½º ¾Ë¸®¹Ì »èÁ¦ÇÏ±â
 * service_alarm_remove(pEd, pEId)
 */
function service_alarm_remove(pEd, pEId){
	PopUp('/serviceAlarm/service_alarm_remove.asp?pType='+pEd+'&pEid='+pEId, 'service_alarm_remove', 350, 290, 50, 50, 'no');
}

/**
 * ¼­ºñ½º ¾Ë¸®¹Ì ¾È³»Ã¢
 * service_alarm_remove(pEd, pEId)
 */
function service_alarm_info_pop() {
	PopUp('/serviceAlarm/service_alarm_pop.asp', 'service_alarm_info', 510, 715, 100, 10, 'no');
}

/**
 * °¡»ç µî·Ï/¼öÁ¤¿äÃ»ÇÏ±â
 * request_lyric_modify()
 * pType : pType 0:µî·Ï, 1:¼öÁ¤
 * pEId : element_id
 * location : pl:ÇÃ·¹ÀÌ¾î, mu:¹ÂÁ÷
 * pSeq	: °¡»ç seq
 * gb	: ³ëÆ®/·¹ÀÌºí ±¸ºÐ
 */
function request_lyric_modify(pType, pEId, location,pSeq,gb){
	if(!gb){gb='note'};
	if(!pSeq){pSeq=0};
	PopUp('/info/popup/request/lyric.asp?pType='+pType+'&elementId='+pEId+'&location='+location+'&seq='+pSeq+'&gb='+gb, 'request_lyric_modify', 520, 540, 100, 100, 'no');
}

/**
 * Á¤º¸¼öÁ¤¿äÃ»ÇÏ±â
 * request_modify_info()
 * pEd : ar->¾ÆÆ¼½ºÆ®,al->¾Ù¹ü,sn->°î
 * pEId : element_id
 * pSong_b : 0:°¡»ç¾øÀ½, 1:°¡»çÁ¸Àç
 */
function request_modify_info(pEd, pEId,pSong_b,pSeq){
	if(!pSeq){pSeq=0}
	PopUp('/info/popup/request/request_info_modify.asp?ed='+pEd+'&ei='+pEId+'&song_b='+pSong_b+'&seq='+pSeq, 'request_modify_info', 521, 726, 100, 10, 'no');
}


/**
 * À½¾Ç°ø°¨ ÃßÃµ
 * - (À½¾Ç°ø°¨¸®½ºÆ®,À½¾Ç°ø°¨³»¿ëº¸±â)
 * @author ±è»ó¼ö
 * @date 2008-11-05
 * @param seq ±Û¹øÈ£
 */
function recom (seq){
	if (confirm('ÃßÃµ ÇÏ½Ã°Ú½À´Ï±î?')){
		$.getJSON('/common/action/recom_save.asp?pSeq='+seq+'&ts='+new Date().getTime(), function(data){
			if (data[0].recomNum == -1) {
				if (confirm('·Î±×ÀÎ ÇÏ¼Å¾ß ÃßÃµÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù\n·Î±×ÀÎ Ã¢À¸·Î ÀÌµ¿ÇÏ½Ã°Ú½À´Ï±î?')){
					cylogin();
					return;
				}
			}else{
				alert(data[0].msg);
				$("#recom_ajax_"+seq).html('<strong>'+data[0].recomNum+'</strong>');
			}
		});
		return;
	}
}

/**
 * wishid °¡Á®¿À±â
 * getWishId()
 */
function getWishId(){
	var wishid = "";
	try{
		if( typeof(window.parent.frames["musicmain"]) == 'object') {
			wishid = parent.document.frames["musicwish"].document.wish_form.wish_id.value;
		}
	}catch(e){
	}finally{
		return wishid;
	}
}

/**
 * µµÅä¸®ÃæÀü
 * fillCharge()
 */
function fillCharge() {
	PopUp('https://'+CYBILLING_DOMAIN+'/dotori/filling/start.sc', 'fillupDotori', 550, 640, 100, 100, 0);
}

/**
 * ÇÑ°î ±¸ÀÔ
 * buy_item()
 */
function buy_item(seq, thanks, strKind, menuid) {
	if( thanks=='undefined' || thanks == null){
		thanks = '';
	}
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_itembuy.asp?product_seq='+seq+'&cymusic='+thanks+'::MS'+etc_param, 'music_buy', 423, 500, 50, 50, 'yes');
}

/**
 * ´Ù¼ö°î ±¸ÀÔ
 * buy_item_all()
 */
function buy_item_all(seq,thanks, strKind, menuid) {
	if( thanks=='undefined' || thanks == null){
		thanks = '';
	}
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_itembuyall.asp?seq='+seq+'&cymusic='+thanks+'::MS'+etc_param, 'music_buy', 417, 320, 50, 50, 'yes');
}

/**
 * ¼±È£°î ¹­À½°î ±¸ÀÔ
 * buy_item_prefer()
 */
function buy_item_prefer(key, seq, thanks, strKind, menuid) {
	if( thanks=='undefined' || thanks == null){
		thanks = '';
	}
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_preferitembuy.asp?key='+key+'&seq='+seq+'&cymusic='+thanks+'::MS'+etc_param, 'music_buy', 417, 320, 50, 50, 'yes');
}

/**
 * ¿¡¼¾¼È ¹­À½°î ±¸ÀÔ
 * buy_item_essential()
 */
function buy_item_essential(key, seq, thanks, strKind, menuid) {
	if( thanks=='undefined' || thanks == null){
		thanks = '';
	}
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_essentialitembuy.asp?key='+key+'&seq='+seq+'&cymusic='+thanks+'::MS'+etc_param, 'music_buy', 417, 320, 50, 50, 'yes');
}

/**
 * ¾Ù¹ü ±¸ÀÔ
 * buy_item_album()
 */
function buy_item_album(seq, strKind, menuid) {
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_albumbuy.asp?product_seq='+seq+'&cymusic=::MS'+etc_param, 'music_buy', 418, 550, 50, 50, 'yes');
}

/**
 * °î, ¾Ù¹ü ¼±¹°ÇÏ±â
 * buy_item_album()
 */
function send_item(product_seq, thanks, strKind, menuid) {
	if( thanks=='undefined' || thanks == null){
		thanks = '';
	}
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_itemsend.asp?wishid='+getWishId()+'&product_seq='+product_seq+'&cymusic='+thanks+'::MS'+etc_param, 'music_buy', 417, 500, 50, 50, 'yes');
}

/**
 * ¼Ò¸Á»óÀÚ ¾ÆÀÌÅÛ(°î, ¾Ù¹ü) ¼±¹°ÇÏ±â
 * send_wish_item()
 */
function send_wish_item(product_seq, wishid, strKind, menuid) {
	if( wishid=='undefined' || wishid == null){
		wishid = '';
	}
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_itemsend.asp?wishid='+wishid+'&product_seq='+product_seq+'&cymusic=::MS'+etc_param, 'music_buy', 417, 500, 50, 50, 'yes');
}

/**
 * ´Ù¼ö°î ¼±¹°
 * buy_item_album()
 */
function send_item_all(seq,thanks, strKind, menuid) {
	if( thanks=='undefined' || thanks == null){
		thanks = '';
	}
	var etc_param = '';
	if( strKind == 'undefined' || strKind == null || menuid == 'undefined' || menuid == null){
	}else{
		etc_param = '&pers=cfilter&menuid=|'+menuid+'|'+strKind+'|3|1';
	}
	PopUp('http://'+SHOPMUSIC_DOMAIN+'/music_itemsendall.asp?wishid='+getWishId()+'&product_seq='+seq+'&cymusic='+thanks+'::MS'+etc_param, 'music_buy', 417, 500, 50, 50, 'yes');
}

/**
 * ¼Ò¸Á»óÀÚ
 * wish_item()
 */
function wish_item(seq) {
	window.open('http://'+CYMUSIC_DOMAIN+'/util/wish/wish.asp?wpath=MS&itemlist='+seq,'wish','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=360,height=470');
}

/**
 * ÂÉ¸£±â
 * appeal_item()
 */
function appeal_item(seq) {
	window.open('http://'+CYMUSIC_DOMAIN+'/util/appeal/appeal.asp?wpath=MS&itemlist='+seq,'appeal','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=360,height=470');
}

/**
 * ¹Ì´ÏÈ¨ÇÇ ¹Ù·Î°¡±â1
 * showBoard(contest_seq, tid, url, urlstrsub)
 */
function showBoard(contest_seq, tid, url, urlstrsub) {
	window.open('http://'+MINIHP_DOMAIN+'/pims/mhsection/mh_today_contest_redirect.asp?contest_seq='+contest_seq+'&tid='+tid+'&rkey=&urlstr='+url+'&urlstrsub='+urlstrsub, 'person_info', 'height=538,width=932,scrollbars=no,resizable=yes');
	return;
}

/**
 * ¹Ì´ÏÈ¨ÇÇ ¹Ù·Î°¡±â2
 * showBoard2(tid, url, urlstrsub)
 */
function showBoard2(tid, url, urlstrsub)
{
	window.open('http://'+MINIHP_DOMAIN+'/pims/mhsection/mh_theme_Board_redirect.asp?tid='+tid+'&rkey=&urlstr='+url+'&urlstrsub='+urlstrsub, 'person_info', 'height=538,width=932,scrollbars=no,resizable=yes');
	return;
}

/**
 * ¹ÂÁ÷ ÇÃ·¹ÀÌ¾î ¼±ÅÃ µè±â
 * checkbox ¿¡ linkCode È¤Àº productSeq ¼Ó¼ºÀÌ Á¸ÀçÇØ¾ß ÇÑ´Ù.
 * @author °­µ¿Çõ
 * @date 2008-10-15
 * @param type ÀÛ¾÷±¸ºÐ
 * @param checkboxName Ã¼Å©¹Ú½º name
 * @param thanks ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 * @param strKind ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 * @param menuid ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 */
function checkSongList( type, checkboxName, thanks, strKind, menuid ) {
	var list = '';
	var obj_chk = document.getElementsByName(checkboxName);
	var num = 0;

	//¼±ÅÃÇ×¸ñÀÌ ¾øÀ»°æ¿ì
	if (obj_chk.length == 0 ) {
		alert('°îÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.');
		return;
	}

	//¼±ÅÃÇ×¸ñ¸®½ºÆ®
	var is_exception = false;
	var attribute = '', i, value;
	for (i = 0; i < obj_chk.length; i++) {
		if (!obj_chk[i].checked)
			continue;

		if ((value = obj_chk[i].getAttribute('productSeq')) != null && value != '') {
			attribute = 'productSeq';
			list += value + '.';
			num++;
		}else if ((value = obj_chk[i].getAttribute('linkCode')) != null && value != '')  {
			attribute = 'linkCode';
			list += value + '.';
			num++;
		}

		//¹ÂÁ÷½¦ÀÌÅ©, ³ë·¡¹æ°î Ã¼Å©Á¦ÇÑ
		if(is_exception == false){
			if(obj_chk[i].value>50000000){
				is_exception = true;
			}
		}
	}

	if(is_exception){
		alert('ÁË¼ÛÇÕ´Ï´Ù. ¹ÂÁ÷½¦ÀÌÅ©, ³ë·¡¹æ°îÀº ¾ÆÁ÷ ÅÂ±×´ã±â ±â´ÉÀÌ Áö¿øµÇÁö ¾Ê½À´Ï´Ù.');
	}

	if(list == ''){
		alert('°îÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.');
		return;
	} else {
		list = list.substring(0,(list.length)-1);

		if (type == 'ALBUM') {
			playMusicALBUM(list);
		} else if (type == 'SONG') {
			if (attribute == 'productSeq') {
				playMusicSong(list);
			}else if (attribute == 'linkCode') {
				playMusicLinkCode(list);
			}
		} else if (type == 'WISH') {
			wish_item(list);
		} else if (type == 'HOPE') {
			appeal_item(list);
		} else if (type == 'BUY') {
			(num==1) ? buy_item(list,thanks,strKind,menuid) : buy_item_all(list,thanks,strKind,menuid);
		} else if (type == 'PUTSONG') {	//TAG
			tag_put('sn', list);
		} else if (type == 'SEND') {
			if (num==1) {
				send_item(list,thanks,strKind,menuid);
			} else {
				if (num > 50) {
					alert('¼±¹°Àº ÃÖ´ë 50°î±îÁö ÀÔ´Ï´Ù.');
					return;
				} else {
					send_item_all(list,thanks,strKind,menuid);
				}
			}
		}
	}
}


/**
 * ¼±È£°î ¹­À½°î ±¸¸Å
 * checkbox ¿¡ productSeq ¼Ó¼ºÀÌ Á¸ÀçÇØ¾ß ÇÑ´Ù.
 * @author Á¤ÀÎÃ¤
 * @date 2009-07-14
 * @param type ÀÛ¾÷±¸ºÐ
 * @param checkboxName Ã¼Å©¹Ú½º name
 * @param product_seq seed°î product_seq
 * @param cy_service_b seed°î ÆÇ¸Å¿©ºÎ
 * @param thanks ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 * @param strKind ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 * @param menuid ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 */
function checkPreferSongBuy(type, product_seq, cy_service_b, checkboxName, thanks, strKind, menuid) {
	var list = '';
	var obj_chk = document.getElementsByName(checkboxName);
	var num = 0;

	//¼±ÅÃÇ×¸ñÀÌ ¾øÀ»°æ¿ì
	if (obj_chk.length == 0 ) {
		alert('°îÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.');
		return;
	}

	//ÆÇ¸ÅÁßÁöÀÏ °æ¿ì
	if (cy_service_b == 'False' ) {
		alert('¿ø°îÀÌ ÆÇ¸ÅÁßÁö »óÅÂÀÎ °æ¿ì\n¹­À½°î ÇÒÀÎ ±¸ÀÔÀ» ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.');
		return;
	}


	//¼±ÅÃÇ×¸ñ¸®½ºÆ®
	var is_exception = false;
	var attribute = '', i, value;
	for (i = 0; i < obj_chk.length; i++) {
		if (!obj_chk[i].checked)
			continue;

		if ((value = obj_chk[i].getAttribute('productSeq')) != null && value != '') {
			attribute = 'productSeq';
			list += value + '.';
			num++;
		}else if ((value = obj_chk[i].getAttribute('linkCode')) != null && value != '')  {
			attribute = 'linkCode';
			list += value + '.';
			num++;
		}

		//¹ÂÁ÷½¦ÀÌÅ©, ³ë·¡¹æ°î Ã¼Å©Á¦ÇÑ
		if(is_exception == false){
			if(obj_chk[i].value>50000000){
				is_exception = true;
			}
		}
	}

	if(is_exception){
		alert('ÁË¼ÛÇÕ´Ï´Ù. ¹ÂÁ÷½¦ÀÌÅ©, ³ë·¡¹æ°îÀº ¾ÆÁ÷ ÅÂ±×´ã±â ±â´ÉÀÌ Áö¿øµÇÁö ¾Ê½À´Ï´Ù.');
	}

	if(list == ''){
		alert('°îÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.');
		return;
	} else {
		list = list.substring(0,(list.length)-1);

		if (type == 'ALBUM') {
			playMusicALBUM(list);
		} else if (type == 'SONG') {
			if (attribute == 'productSeq') {
				playMusicSong(list);
			}else if (attribute == 'linkCode') {
				playMusicLinkCode(list);
			}
		} else if (type == 'WISH') {
			wish_item(list);
		} else if (type == 'HOPE') {
			appeal_item(list);
		} else if (type == 'BUY') {
			(num==1) ? buy_item(list,thanks,strKind,menuid) : buy_item_all(list,thanks,strKind,menuid);
		} else if (type == 'Prefer') {
			buy_item_prefer(product_seq, list,thanks,strKind,menuid);
		} else if (type == 'PUTSONG') {	//TAG
			tag_put('sn', list);
		} else if (type == 'SEND') {
			if (num==1) {
				send_item(list,thanks,strKind,menuid);
			} else {
				if (num > 50) {
					alert('¼±¹°Àº ÃÖ´ë 50°î±îÁö ÀÔ´Ï´Ù.');
					return;
				} else {
					send_item_all(list,thanks,strKind,menuid);
				}
			}
		}
	}
}

/**
 * ¿¡¼¾¼È ¹­À½°î ±¸¸Å
 * checkbox ¿¡ productSeq ¼Ó¼ºÀÌ Á¸ÀçÇØ¾ß ÇÑ´Ù.
 * @author Á¤ÀÎÃ¤
 * @date 2009-07-14
 * @param type ÀÛ¾÷±¸ºÐ
 * @param checkboxName Ã¼Å©¹Ú½º name
 * @param thanks ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 * @param strKind ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 * @param menuid ±¸¸Å ÆÄ¶ó¸ÞÅÍ
 */
function checkEssentialSongBuy(type, seq, checkboxName, thanks, strKind, menuid) {
	var list = '';
	var obj_chk = document.getElementsByName(checkboxName);
	var num = 0;

	//¼±ÅÃÇ×¸ñÀÌ ¾øÀ»°æ¿ì
	if (obj_chk.length == 0 ) {
		alert('°îÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.');
		return;
	}

	//¼±ÅÃÇ×¸ñ¸®½ºÆ®
	var is_exception = false;
	var attribute = '', i, value;
	for (i = 0; i < obj_chk.length; i++) {
		if (!obj_chk[i].checked)
			continue;

		if ((value = obj_chk[i].getAttribute('productSeq')) != null && value != '') {
			attribute = 'productSeq';
			list += value + '.';
			num++;
		}else if ((value = obj_chk[i].getAttribute('linkCode')) != null && value != '')  {
			attribute = 'linkCode';
			list += value + '.';
			num++;
		}

		//¹ÂÁ÷½¦ÀÌÅ©, ³ë·¡¹æ°î Ã¼Å©Á¦ÇÑ
		if(is_exception == false){
			if(obj_chk[i].value>50000000){
				is_exception = true;
			}
		}
	}

	if(is_exception){
		alert('ÁË¼ÛÇÕ´Ï´Ù. ¹ÂÁ÷½¦ÀÌÅ©, ³ë·¡¹æ°îÀº ¾ÆÁ÷ ÅÂ±×´ã±â ±â´ÉÀÌ Áö¿øµÇÁö ¾Ê½À´Ï´Ù.');
	}

	if(list == ''){
		alert('°îÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.');
		return;
	} else {
		list = list.substring(0,(list.length)-1);

		if (type == 'ALBUM') {
			playMusicALBUM(list);
		} else if (type == 'SONG') {
			if (attribute == 'productSeq') {
				playMusicSong(list);
			}else if (attribute == 'linkCode') {
				playMusicLinkCode(list);
			}
		} else if (type == 'WISH') {
			wish_item(list);
		} else if (type == 'HOPE') {
			appeal_item(list);
		} else if (type == 'BUY') {
			(num==1) ? buy_item(list,thanks,strKind,menuid) : buy_item_all(list,thanks,strKind,menuid);
		} else if (type == 'Essential') {
			buy_item_essential(seq, list,thanks,strKind,menuid);
		} else if (type == 'PUTSONG') {	//TAG
			tag_put('sn', list);
		} else if (type == 'SEND') {
			if (num==1) {
				send_item(list,thanks,strKind,menuid);
			} else {
				if (num > 50) {
					alert('¼±¹°Àº ÃÖ´ë 50°î±îÁö ÀÔ´Ï´Ù.');
					return;
				} else {
					send_item_all(list,thanks,strKind,menuid);
				}
			}
		}
	}
}

/**
 * Ã¼Å©¹Ú½º - ÀüÃ¼¼±ÅÃ ÀüÃ¼ÇØÁ¦
 *
 */

function CheckAll( chkAll_name, chkBox_name ){
	var obj_box = document.getElementsByName(chkBox_name);
	var is_chkAll = document.getElementsByName(chkAll_name)[0].checked;
	if (obj_box.length == 0) {
		alert('¼±ÅÃ°¡´ÉÇÑ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.')
		return;
	} else {
		for ( i=0; i<obj_box.length; i++) {
			obj_box[i].checked = is_chkAll;
		}
	}
}

/**
 * ¹®ÀÚ¿­ÀÇ ±ÛÀÚ¼ö¸¦ ÇÑ±Û.¿µ¾î¸¦ ±¸ºÐÇÏ¿© ¼¾´Ù.
 *
 */
function cal_length(val)	{
	// ÀÔ·Â¹ÞÀº ¹®ÀÚ¿­À» escape() ¸¦ ÀÌ¿ëÇÏ¿© º¯È¯ÇÑ´Ù.
	// º¯È¯ÇÑ ¹®ÀÚ¿­ Áß À¯´ÏÄÚµå(ÇÑ±Û µî)´Â °øÅëÀûÀ¸·Î %uxxxx·Î º¯È¯µÈ´Ù.
	var temp_estr = escape(val);
	var s_index = 0;
	var e_index = 0;
	var temp_str = '';
	var cnt = 0;

	// ¹®ÀÚ¿­ Áß¿¡¼­ À¯´ÏÄÚµå¸¦ Ã£¾Æ Á¦°ÅÇÏ¸é¼­ °¹¼ö¸¦ ¼¾´Ù.
	while ((e_index = temp_estr.indexOf('%u', s_index)) >= 0) // Á¦°ÅÇÒ ¹®ÀÚ¿­ÀÌ Á¸ÀçÇÑ´Ù¸é
	{
		temp_str += temp_estr.substring(s_index, e_index);
		s_index = e_index + 6;
		cnt ++;
	}

	temp_str += temp_estr.substring(s_index);

	temp_str = unescape(temp_str); // ¿ø·¡ ¹®ÀÚ¿­·Î ¹Ù²Û´Ù.

	// À¯´ÏÄÚµå´Â 2¹ÙÀÌÆ® ¾¿ °è»êÇÏ°í ³ª¸ÓÁö´Â 1¹ÙÀÌÆ®¾¿ °è»êÇÑ´Ù.
	return ((cnt * 2) + temp_str.length) + '';
};

/**
 * ÃÊ°úÇÑ ¹ÙÀÌÆ®¿¡ ÇØ´çÇÏ´Â ¹®ÀÚ¿­ Á¤¸®
 * getCutMsg(pString, pLastString, pCutBytes)
 */
function getCutMsg(pString, pLastString, pCutBytes){
	var inc = 0;
	var nbytes = 0;
	var msg = '';
	var msglen = pString.length;

	for (i=0; i<msglen; i++) {
		var ch = pString.charAt(i);
		if (escape(ch).length > 4) {
			inc = 2;
		} else if (ch == '\n') {
			if (pString.charAt(i-1) != '\r') {
				inc = 1;
			}
		} else if (ch == '<' || ch == '>') {
			inc = 4;
		} else {
			inc = 1;
		}
		if ((nbytes + inc) > pCutBytes) {
			msg += pLastString
			break;
		}
		nbytes += inc;
		msg += ch;
	}
	return msg;
}

/**
 * ±ÛÀÚ¼öÁ¦ÇÑ ½ºÅ©¸³Æ®
 * textCounter(field, countfield, maxlimit)
 */
function textCounter(field, countfield, maxlimit){
	if (field.value.length > maxlimit) {
		alert('±ÛÀÚ¼ö°¡ ÃÊ°úµÇ¾ú½À´Ï´Ù.');
		field.value = field.value.substring(0, maxlimit);
	}
	else
		countfield.value = maxlimit - field.value.length;
}



/* clipboard */
function copy(inElement) {
	if ($.browser.msie) {
		window.clipboardData.setData("Text", inElement.html());
		if(window.clipboardData.getData("Text")!=''){
			alert('ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù.');
		}
	} else {
		var version = getFlashVersion().split(',').shift();
		if(version < 10){
			var flashcopier = 'flashcopier';
			if(!document.getElementById(flashcopier)) {
				var divholder = document.createElement('div');
				divholder.id = flashcopier;
				document.body.appendChild(divholder);
			}
			document.getElementById(flashcopier).innerHTML = '';
			var divinfo = '<embed src="/include/js/jquery/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.html())+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
			document.getElementById(flashcopier).innerHTML = divinfo;
			alert('ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù.');
		}else{
			alert('ÇöÀç ÁÖ¼Òº¹»ç ±â´ÉÀÌ µ¿ÀÛÇÏÁö ¾Ê´Â È¯°æÀÔ´Ï´Ù.');
		}

	}

}

function getFlashVersion(){
  // ie
  try {
    try {
      // avoid fp6 minor version lookup issues
      // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
      var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
      try { axo.AllowScriptAccess = 'always'; }
      catch(e) { return '6,0,0'; }
    } catch(e) {}
    return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
  // other browsers
  } catch(e) {
    try {
      if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
        return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
      }
    } catch(e) {}
  }
  return '0,0,0';
}




/**
 * HashMap()
 */
var HashMap = function() {
	var map = {};
	var arr_pos = new Array();
	this.get = function( key ) {
		return map[ key ];
	}
	this.getPos = function( n ) {
		return map[ arr_pos[n] ];
	}
	this.remove = function( n ) {
		var arr_idx = new Array();
		for( var i=0; i<map.size(); i++ ) {
			if( i != n ) {
				arr_idx.push( arr_pos[i] );
			}
		}
		arr_pos = arr_idx;
	}
	this.put = function( key, val ) {
		map[key] = val;
		arr_pos.push( key );
	}
	this.size = function() {
		return arr_pos.length;
	}
};

/**
 * loginWrite() - ±Û¾²±âÀü ·Î±×ÀÎÃ¼Å©
 */
var loginWrite = function(url) {
	if(confirm('·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?')){
		document.location.href = 'http://'+CYWORLD_WEB_DOMAIN+'/main2/login.asp?loginstr=direct&redirection='+escape(url);
	}
};

/**
 * ¹®ÀÚ¿­ ÀüÃ¼º¯È¯
 */
String.prototype.replaceAll = function(_findValue, _replaceValue) {
 return this.replace(new RegExp(_findValue,"g"), _replaceValue);
};

/*
 * ¹®ÀÚ¿­ trim ÇÔ¼öÀÌ´Ù.
 * white space »Ó¸¸ ¾Æ´Ï¶ó, Æ¯¼ö¹®ÀÚ °ø¹é(ÇÑ±Û ¤¡ ´©¸£°í, ÇÑÀÚ 1 ´©¸£¸é ÀÔ·Â) ±îÁö Á¦°ÅÇÑ´Ù.
 *
 * @author °­µ¿Çõ
 */
String.prototype.cytrim = function () {
	return this.replace(/^[\s¡¡]*/, "").replace(/[\s¡¡]*$/, "");
}

//Hot ¾ÆÀÌÄÜ ¾È³» ÆË¾÷
function hot_icon_info_pop() {
	PopUp('/helpdesk/icon/hot_icon.asp', 'prize_icon', 500, 228, 100, 40, 'no');
}

//Prize ¾ÆÀÌÄÜ ¾È³» ÆË¾÷
function prize_icon_info_pop() {
	PopUp('/helpdesk/icon/prize_icon.asp', 'prize_icon', 500, 350, 100, 40, 'no');
}

//BGM¾Ù¹ü ¾È³» ÆË¾÷
function bgmalbum_info_pop() {
	PopUp('/helpdesk/bgmalbum/info01.asp', 'bgmalbum', 600, 647, 100, 40, 'no');
}

//¼­ºñ½º¾Ë¸®¹Ì ¾È³» ÆË¾÷
function serviceAlarm_pop() {
	PopUp('/helpdesk/serviceAlarm/info01.asp', 'serviceAlarm', 500, 507, 100, 40, 'no');
}

//ÅÂ±× ¾È³» ÆË¾÷
function tag_info_pop() {
	PopUp('/helpdesk/tag/info01.asp', 'tag', 600, 647, 100, 40, 'no');
}

//¸ð¹ÙÀÏ ±¸ÀÔ2
function buy_phonemusic(g_seq, service_type)
{
//window.open("http://musicmobile."+CYWORLD_DOMAIN+"/send/m_index.asp?g_seq="+g_seq+"&g_ptype="+service_type , "CYMUSICWin", "width=400,height=570,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0");
	// fromw = ¼½¼Ç = MS , ¼±¹°°¡°Ô = SH
	window.open("http://mdeco."+CYWORLD_DOMAIN+"/ext/bridge_mdeco.php?type="+service_type+"&product_seq="+g_seq+"&fromw=MS" , "CYMUSICWin", "width=400,height=570,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0");
}