function require_login(bjoin, site, musicid, mid, cid, sid, tid, gid, acid, bid, cno, cs, ce, mcid)
{
	if (bjoin == true && typeof(opener) == "undefined") {
		if (confirm("º» ¼­ºñ½º´Â È¸¿ø Àü¿ë ¸Þ´ºÀÔ´Ï´Ù.\n\nÁö±Ý ·Î±×ÀÎÀ» ÇÏ½Ã¸é ¼­ºñ½º¸¦\nÁ¤»óÀûÀ¸·Î ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.")) {
			try {
				location = "/member/login.asp?site="+site+"&musicid="+musicid+"&mid="+mid+"&cid="+cid+"&gid="+gid+"&acid="+acid+"&mcid="+mcid;
			} catch(e) {
			}
		}
	} else {
		alert("È¸¿ø¸Þ´ºÀÔ´Ï´Ù");
	}
}

function gongsa()
{
	alert("¼­ºñ½º ÁØºñÁßÀÔ´Ï´Ù.");
}

// ------------------------------------------------------------------------

function sendmail(musicid)
{
	self.location = "/mobile/mailshot.asp?sid=&tid=&gid=&cid=&mid=&type=pop&musicid=" + musicid + "&uri=" + escape(location.pathname + location.search);
}
function open_sendmail(mid)
{
	var url = "/mobile/mailshot.asp?type=pop&musicid=" + mid;

	openwin(url, "sendmail", 600, 620, "scrollbars=no");
}

function open_sendmail1(from_name, from, to_name, to)
{
	var url = "/mobile/mailshot.asp?type=pop&from_name=" + from_name + "&from=" + from + "&to_name=" + to_name + "&to=" + to;

	openwin(url, "sendmail", 600, 620, "scrollbars=no");
}

// ------------------------------------------------------------------------

function myhomepy(userid, target)
{
	var url = "/myhome/myhome_index.asp?userid="+userid;
	openwin(url, target, 700, 550, "");
}

function goMemberOff(userid)
{
	var w = 300;
	var h = 188; 
	if(screen.height > 300)	{ 
		var winl = (screen.width - w) / 2; 
		var wint = (screen.height - h) / 2; 
	}
	else	{
		var winl = 10; 
		var wint = 10; 		
	}			
	
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl;	
	
	var url = "/p_member/popup_member_off.asp?userid="+userid;
	win = window.open(url, "memberoff",'toolbar=0,location=0,directories=0, scrollbars=no, status=0,menubar=0,alwaysRaised=0,resizable=0,'+winprops);
}

function userinfo(userid, target)
{
	var url = "/myhome/userinfo.asp?userid="+userid+"&gubunCode=1";
	openwin(url, target, 700, 550, "");
}

function validateWindow(target_window) {
    if (target_window == null) {
       // À©µµ¿ì°¡ Á¸ÀçÇÏÁö ¾Ê´Â´Ù.
       return false;
    }
    else {
       target_window.focus(); // -- À©µµ¿ì¿¡ Æ÷Ä¿½º¸¦ ÁØ´Ù.
       // À©µµ¿ì°¡ Á¸ÀçÇÏ°í ÀÖ´Ù. 
       return true;
    }
}


function modifyUserInfo(userid, gubunCode)
{
	var url = "/myhome/userinfo.asp?userid="+userid+"&gubunCODE="+gubunCode;
	openwin(url, "mymusicshot", 700, 550, "");
}


function memo(userid, code)
{
	var url = "/myhome/myhome_memo.asp?userid="+userid+"&gubunCode="+code;
	openwin(url, "mymusicshot", 700, 550, "");
}

function directory(userid, code)
{
	var url = "/myhome/myhome_directory.asp?userid="+userid+"&gubunCODE="+code;
	openwin(url, "mymusicshot", 700, 550, "");
}

function diary(userid, code)
{
	var url = "/myhome/diary.asp?userid="+userid+"&gubunCODE="+code;
	openwin(url, "mymusicshot", 700, 550, "");
}

// ------------------------------------------------------------------------


// ------------------------------------------------------------------------

function sendgift()
{
	var url = "/mobile/p_mail.asp?type=pop&musicid=";
	openwin(url, "sendgift", 600, 620, "scrollbars=no");
}
function open_sendgift(mid)
{
	var url = "/mobile/p_mail.asp?type=pop&musicid=" + mid;
	openwin(url, "sendgift", 600, 620, "scrollbars=no");
}

// ------------------------------------------------------------------------

function open_shotmoney(id)
{
	var url = "/mobile/shotmoney.asp?type=pop&id=" + id;

	openwin(url, "sendmail", 600, 620, "scrollbars=no");
}


function payfirst(mid)
{
	openwin("/member/pay/ppay.asp?mid=" + mid, "payfirst", 330, 430, "");
}
function insert_giftbox(form, name, mid)
{
	var mid = getmids(form, name, mid);
	if (mid == "") return;
	alert("¼±ÅÃÇÏ½Å À½¾ÇÀº ÁÂÃøÀÇ [My Mysic Box]¿¡ ÀÓ½Ã ÀúÀåµË´Ï´Ù\n[¾Ù¹ü¿¡ ÀúÀåÇÏ±â] ¹öÆ°À» ´©¸£¸é ½ÇÁ¦ ¸¶ÀÌ¾Ù¹ü¿¡ ÀúÀåÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù\n\nÀ½¾ÇÀÌ Áßº¹µÈ °æ¿ì¿¡´Â ÇÑ°î¸¸ ÀúÀåÀÌ °¡´ÉÇÕ´Ï´Ù");
        myMusicBox.location.href = "/common/myMusicUse.asp?mid=" + mid;
}



function open_giftbox()
{
	openwin("/member/giftbox/", "", 550, 540, "")
}
function set_menu(mnu)
{
	if (parent.left != null) {
		if (parent.left.location.pathname + parent.left.location.search == mnu) return;
		parent.left.location = mnu;
	}
}
function set_main_menu(mnu)
{
	if (parent.up != null) {
		if (parent.up.location.pathname + parent.up.location.search == mnu) return;
		parent.up.location = mnu;
	}
}
function set_music_menu(mnu)
{
	if (parent.center != null) {
		if (parent.center.location.pathname + parent.center.location.search == mnu) return;
		parent.center.location = mnu;
	}
}

var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements()
{
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

        if ( bNetscape4plus ) { // ³×Ã÷ÄÉÀÌÇÁ ¿ë ¼³Á¤
                yMenuFrom   = document["musicbest"].top;
                yMenuTo     = top.pageYOffset + 120;   // À§ÂÊ À§Ä¡ 91
        }
        else if ( bExplorer4plus ) {  // IE ¿ë ¼³Á¤
                yMenuFrom   = parseInt (musicbest.style.top, 10);
                yMenuTo     = document.body.scrollTop + 120; // À§ÂÊ À§Ä¡ 91
        }

        timeoutNextCheck = 100;

        if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
                setTimeout ("CheckUIElements()", timeoutNextCheck);
                return;
        }


        if ( yButtonFrom != yButtonTo ) {
                yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
                if ( yButtonTo < yButtonFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divLinkButton"].top += yOffset;
                else if ( bExplorer4plus )
                        divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["musicbest"].top += yOffset;
                else if ( bExplorer4plus )
                        musicbest.style.top = parseInt (musicbest.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }

        setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function Slide()
{
        var y;

        // ÆäÀÌÁö ·Îµù½Ã Æ÷Áö¼Ç
        if ( bNetscape4plus ) {
                document["musicbest"].top = top.pageYOffset + 120;
                document["musicbest"].visibility = "visible";
        }
        else if ( bExplorer4plus ) {
                musicbest.style.top = document.body.scrollTop + 120;
                musicbest.style.visibility = "visible";
        }

        // initializing UI update timer
        CheckUIElements();
        return true;
}
var g_Status = 0;
var g_Click = 0; 
function OpenUser(p_sUserID, leftPos, TopPos)
{

	l_sUserBoxContent =
	"<table width=160 height=76 border=0 cellspacing=0 cellpadding=1 bgcolor=#000000>\n" +
	"<tr><td align=center bgcolor=#000000>\n" +
			"<table width=100% height=60 border=0 cellspacing=0 cellpadding=0 bgcolor=#FFFFFF>\n" +
			"<tr>\n" +
				"<td>\n" +
					"<table width=100% border=0 cellspacing=0 cellpadding=2>\n" +
					"<tr><td colspan=4 height=2 bgcolor=#333333></td></tr>\n" +
					"<tr> \n" +
						"<td width=2 bgcolor=#333333></td>\n" +
						"<td width=20 bgcolor=#333333><font color=#FFFFFF><b>ID : </b></font></td>\n" +						
						"<td width=125 valign=bottom bgcolor=#333333><font color=#FFFFFF><b>"+ p_sUserID +"</b></FONT></td>\n" +
						"<td width=13 align=left bgcolor=#333333><img src=/p_board/images/icon_close.gif border=0 onClick=HideUserInfo() style=cursor:hand></td>\n" +						
					 "</tr>\n" +
					"<tr bgcolor=686868><td colspan=4 height=4></td></tr>\n" +
					"<tr bgcolor=686868> \n" +
						"<td width=2></td>\n" +
						"<td height=18  align=center bgcolor=686868><img src=/p_board/images/icon_memo.gif border=0></td>\n" +
						"<td colspan=2 ><a href=javascript:SendMessage('" + p_sUserID + "',0,null)><font color=CCCCCC>ÂÊÁö º¸³»±â</font></a></td>\n" +
					 "</tr>\n" +
					"<tr bgcolor=686868><td colspan=4 height=2></td></tr>\n" +
					"<tr bgcolor=686868><td colspan=4 height=1 background=/p_board/images/popup_line.gif border=0></td></tr>\n" +
					"<tr bgcolor=686868><td colspan=4 height=4></td></tr>\n" +
					"<tr bgcolor=686868> \n" +
						"<td width=2></td>\n" +
						"<td height=18 align=center><img src=/p_board/images/icon_myhome.gif border=0></td>\n" +
						"<td colspan=2 height=20><a href=javascript:goMyhomepy('" + p_sUserID + "')><font color=CCCCCC>¸¶ÀÌ È¨ÇÇ</font></a></td>\n" +
					 "</tr>\n" +  
					"<tr bgcolor=686868><td colspan=4 height=3></td></tr>\n" +
					"</table>\n" +
				"</td>\n" +
			"</tr>\n" +
			"</table>\n" +
		"</td>\n" +
	"</tr>\n" +
	"</table>\n";

//+ document.body.scrollTop - 4 event.clientY
// + document.body.scrollLeft - 4 event.clientX
	document.all.mb.style.top = document.body.scrollTop + 20 + parseInt(TopPos) ;
	document.all.mb.style.left = document.body.scrollLeft + parseInt(leftPos);
/*
	if (document.all.mb.style.left > event.screenX - 500)
		document.all.mb.style.left = event.screenX - 500;
	else if (document.all.mb.style.left < "0px")
		document.all.mb.style.left = 0;
*/		
	document.all.mb.innerHTML = l_sUserBoxContent;
	document.all.mb.style.visibility = "visible";
	g_Status = 1;
	g_Click = 1; 	
}

function HideUserInfo() {
	if ( g_Click == 0 ) {
		if ( g_Status == 1 ) {
			document.all.mb.style.visibility = "hidden";
			g_Status = 0;
		}
	}
	g_Click = 0;
}

function SendMessage(p_sUserID)
{ 
	var url = "/myhome/memo_write.asp?ToID="+p_sUserID;
	openwin(url, 'memo', 400, 320, "");	
} 

function MakeFriends(p_sUserID)
{ 
	location.href = "/memo/makeFriends.asp?ToID="+p_sUserID+""
} 

function pop(popID, width, height)
{
	var url = "/market/pop_bigsize.asp?popID="+popID;
	openwin(url, 'pop', width, height, "");
}

function open_photo(album_code, int_code, width, height)
{
	var url = "/photo/photo_bigsize.asp?album_code="+album_code+"&int_code="+int_code;
	openwin(url, 'open_photo', width, height, "");
}

function open_player(int_type)
{
	var url = "/music/music_Player.asp?int_type=" + int_type;
	openwin(url, 'player', 468, 563, "");
}

function goStory()
{
	openwin('/data/goStory.asp', 'story', '800', '600', "");
}


function goPrint(int_code,b01)
{
	url = "/data/talk_print.asp?code=" + int_code + "&b01=" + b01; 
	openwin(url, 'print', '550', '600', "");
}

function goLotto()
{
	url = "/lotto/lotto_frame.asp"; 
	openwin(url, 'lotto', '634', '402', "");
}

function goPhoto(int_s00,int_code,width,height)
{
	url = "/photo/frame_photo.asp?s00=" + int_s00 + "&code=" + int_code; 
	openwin(url, 'photo', width, height, "");
}

function goAlert()
{
	url = "/alert/alert_insert.asp"; 
	openwin(url, 'alert', '400', '400', "");
}

function goMyhomepy(user_id)
{
	url = '/myhome/myhome_index.asp?userid='+user_id;
	openwin(url, "pvs", 700, 500, "");
}

function goPage(cat,menu,c00)
{
	imagePath = "images/body_title_"+menu+".gif";
	document.body_title.src = imagePath;
	sub_frame.location.href = 'content_'+menu+'.asp?cat='+cat+'&menu='+menu+'&c00='+c00;
}

function goSubPage(cat,menu,c00)
{
	top.location.href = 'main.asp?cat='+cat+'&menu='+menu+'&c00='+c00;
}

function goBbsPage(cat,menu,c00)
{
	imagePath = "images/body_title_"+menu+".gif";
	document.body_title.src = imagePath;
	if(cat == 'faq'){
		sub_frame.location.href = '/p_board/faq.asp?cat='+cat+'&menu='+menu+'&c00='+c00;
	}else if(cat == 'free'){
		sub_frame.location.href = '/p_board/content_1.asp?cat='+cat+'&menu='+menu+'&c00='+c00;		
	}else if(cat == 'good'){
		sub_frame.location.href = '/p_board/content_7.asp?cat='+cat+'&menu='+menu+'&c00='+c00;			
	}else{
		sub_frame.location.href = 'bbs.asp?cat='+cat+'&menu='+menu+'&c00='+c00;
	}
}

function goSpecialPage(cat,menu,idx,c00)
{
	imagePath = "images/body_title_"+idx+".gif";
	document.body_title.src = imagePath;
	if(idx == 1){
		sub_frame.location.href = '/p_introduce/sub_7.asp?cat='+cat+'&menu='+menu+'&c00='+c00;
	}else{
		sub_frame.location.href = 'bbs.asp?cat='+cat+'&menu='+menu+'&c00='+c00;		
	}
}

function goMemberPage(cat,menu,code)
{
	top.location.href = '/p_member/main.asp?cat='+cat+'&menu='+menu+'&code='+code;
}

function goClientPage(cat,menu,body_type,subtype,c00)
{
	imagePath = "images/body_title_"+subtype+".gif";
	imageSubPath = "images/body_subtitle_"+subtype+".gif";	
	document.body_title.src = imagePath;
	document.sub_title.src = imageSubPath;		
	sub_frame.location.href = 'content_'+menu+'.asp?cat='+cat+'&menu='+menu+'&type='+body_type+'&c00='+c00;
}
function goButtomPage(cat,menu)
{
	location.href = '/p_relationship/main.asp?cat='+cat+'&menu='+menu;
}

// ·¹ÀÌ¾î Å×ÀÌºí ¿Ü°û¼± Ç¥½Ã
function setBorder(opt, color) {
	opt.style.borderColor = String(color);
}

function embedSWF(swfUrl,swfWidth,swfHeight,useWmode){ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+swfWidth+'" height="'+swfHeight+'" VIEWASTEXT ID="Object1">');
document.write('<param name="movie" value="'+swfUrl+'" />');
document.write('<param name="quality" value="high">');
document.write('<param name="wmode" value="'+useWmode+'">');
document.write('<embed src="'+swfUrl+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+swfWidth+'" height="'+swfHeight+'"></embed>');
document.write('</object>');
}