// ÆË¾÷¶ç¿ì±â
function openPopup(strwinName,strUrl,intWidth,intHeight,ynResize)
{
	var left = (window.screen.availWidth-intWidth) >> 1;
	var top = (window.screen.availHeight-intHeight) >> 1;
	var opt = "left=" + left + ",top=" + top + ",width=" + intWidth + ",height=" + intHeight + ",resizable=" + ynResize;

	return GFcOpenWindow(strUrl, strwinName, opt);
}

function login(qid) {
	if(arguments.length==0 || qid=="") qid = GFcGetCookie("que");
	try {
		top.login_main(qid);
	}
	catch(e) {
		top.GFcOpenWindow("/Service/Login/Login.asp?nexturl=" + escape(g_qsvr + "/service/default.asp?id="+qid+"&qnexturl=" + document.location.href), "__QLOGIN__", "width=310,height=259,left="+(screen.width-310)/2+",top="+(screen.height-259)/2, "Q");
	}
}
function loginPopForSection() {
	top.GFcOpenWindow("/Service/Login/Login.asp?nexturl=" + document.location.href, "__QLOGIN__", "width=310,height=259,left="+(screen.width-310)/2+",top="+(screen.height-259)/2, "Q");
}
/**
 * ÆË¾÷Ã¢ ¸®»çÀÌÂ¡ ¹× Áß¾ÓÁ¤·Ä: 2006.03.31. by Jihun Cho
 */
function resizePopup( iWidth, iHeight, bIsAlignCenter ) {

	if ( (window.screen.availWidth-iWidth < iWidth) || (window.screen.availWidth-iWidth < iHeight) ) {
		window.moveTo( 0 ,0 );
	}

	resizeToBody( iWidth, iHeight );

	if ( bIsAlignCenter ) {
		window.moveTo( (window.screen.availWidth-iWidth) >> 1, (window.screen.availHeight-iHeight) >> 1);
	}
}

/**
 * ÆË¾÷Ã¢ ¸®»çÀÌÂ¡ ¹× Áß¾ÓÁ¤·Ä: 2006.03.31. by Jihun Cho
 * À¥Ç¥ÁØÈ­ ÄÚµù¿¡ µû¸¥ ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö º¯°æ: 2007.05.25. by ÁöÇý¼÷
 */
function resizePopupNew( iWidth, iHeight, bIsAlignCenter ) {

	if ( (window.screen.availWidth-iWidth < iWidth) || (window.screen.availWidth-iWidth < iHeight) ) {
		window.moveTo( 0 ,0 );
	}

	resizeToBodyNew( iWidth, iHeight );

	if ( bIsAlignCenter ) {
		window.moveTo( (window.screen.availWidth-iWidth) >> 1, (window.screen.availHeight-iHeight) >> 1);
	}
}
function openFriendPop(fromid,toid) {
	openPopup("__QSRELATION__", g_qsvr + "/service/Manage/Buddy/QsFamilyAddContactForm.asp?id=" + fromid + "&buddyid=" + toid + "&dontreload=Y",400,250,"no");
}

function openFriendListPop(myUserid) {
	openPopup("__QSRELATION__", g_qsvr + "/service/Manage/Buddy/QsPopFriendList.asp?id=" + myUserid ,400,250,"no");
}

function CopyURL(strURL){
	if (window.clipboardData) 
	{
		clipboardData.setData('TEXT', strURL);
		var msg = "°Ô½Ã¹°ÀÇ ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù. <br> ¸ÞÀÏÀÌ³ª, ¸Þ½ÅÀú Ã¤ÆÃÃ¢, ÂÊÁö µî¿¡ <br> ºÙ¿©³Ö±â(ctrl+v)ÇÏ¼¼¿ä!<br><br>"
		if(strURL.indexOf("<embed src=") < 0) msg += strURL;
		var url = g_qsvr + "/Service/QsMsg.asp?msg=" + escape(msg);
		openPopup("winMovieCopyMsg", url, 355, 180, "no");
	}
	else if (window.netscape) 
	{
		try
		{
			netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
			var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
			if (!clip) return;
	
			var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
			if (!trans) return;
	
			trans.addDataFlavor('text/unicode');
			var str = new Object();
			var len = new Object();
			var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
	
			var copytext="°Ô½Ã¹°ÀÇ ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù. <br> ¸ÞÀÏÀÌ³ª, ¸Þ½ÅÀú Ã¤ÆÃÃ¢, ÂÊÁö µî¿¡ <br> ºÙ¿©³Ö±â(ctrl+v)ÇÏ¼¼¿ä!<br><br>"
			if(strURL.indexOf("<embed src=") < 0) copytext += strURL;
			str.data=copytext;
			trans.setTransferData("text/unicode",str,copytext.length*2);
	
			var clipid=Components.interfaces.nsIClipboard;
			if (!clipid) return false;
			clip.setData(trans,null,clipid.kGlobalClipboard);

			var url = g_qsvr + "/Service/QsMsg.asp?msg=" + escape(msg);
			openPopup("winMovieCopyMsg", url, 355, 180, "no");
		}
		catch(e)
		{
			alert("ÁÖ¼Ò¸¦ º¹»çÇÒ ¼ö ¾ø½À´Ï´Ù")
			return;
		}
	}
}

function ReplceURLForQ(strUrl, strSection) {
	return g_gatesvr + "/common/FcCommonLogGate.asp?gbn=Q&RedirUrl=" + escape(strUrl) + "&section=" + escape(strSection)
}