function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Win_pop(newwin,w,h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,status=no,menu=no';
win = window.open(newwin, "new1", winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// ÆäÀÌÁö focus blur
function bluring(){
	if (event.srcElement!=null) {
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}
}
document.onfocusin=bluring;

/* ÇÃ·¡½Ã */
function ObjFlash(src, width, height, param, addParam) {
	param = param || "";
	addParam = addParam || "";
	document.writeln("<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=\"" + width + "\" height=\"" + height + "\">");
	document.writeln("	<param name=\"movie\" value=\"" + src + "\">");
	document.writeln("	<param name=\"flashVars\" value=\"" + param + "\">");
	document.writeln("  <param name='allowScriptAccess' value='always' />");
	document.writeln("	<param name='quality' value='high' />");
	document.writeln("	<param name='scale' value='noscale' />");
	document.writeln("	<param name='salign' value='lt' />");
	document.writeln("	<param name='menu' value='false' />");
	document.writeln("	<param name='wmode' value='opaque' />");
	document.writeln("	<embed  bgcolor='#000000' wmode='opaque' src=\"" + src + "?" + param + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed>");
	document.writeln("</object>");
}

/*¸ÞÀÎ*/
function Tab_Action(no) { 
	if(no=="1") {
		document.getElementById('MainClub01').style.display = "block";
		document.getElementById('MainClub02').style.display = "none";
		document.getElementById('MainClub03').style.display = "none";
		document.getElementById('MainClub04').style.display = "none";
		document.getElementById('MainClub05').style.display = "none";
	}
	else if (no=="2")
	{
		document.getElementById('MainClub01').style.display = "none";
		document.getElementById('MainClub02').style.display = "block";
		document.getElementById('MainClub03').style.display = "none";
		document.getElementById('MainClub04').style.display = "none";
		document.getElementById('MainClub05').style.display = "none";
	}
	else if (no=="3")
	{
		document.getElementById('MainClub01').style.display = "none";
		document.getElementById('MainClub02').style.display = "none";
		document.getElementById('MainClub03').style.display = "block";
		document.getElementById('MainClub04').style.display = "none";
		document.getElementById('MainClub05').style.display = "none";
	}
	else if (no=="4")
	{
		document.getElementById('MainClub01').style.display = "none";
		document.getElementById('MainClub02').style.display = "none";
		document.getElementById('MainClub03').style.display = "none";
		document.getElementById('MainClub04').style.display = "block";
		document.getElementById('MainClub05').style.display = "none";
	}		
	else
	{
		document.getElementById('MainClub01').style.display = "none";
		document.getElementById('MainClub02').style.display = "none";
		document.getElementById('MainClub03').style.display = "none";
		document.getElementById('MainClub04').style.display = "none";
		document.getElementById('MainClub05').style.display = "block";		
	}
}	
	
function Tab_ItemAction(no) { 
	if(no=="1") {
		document.getElementById('ItemCashBox01').style.display = "block";
		document.getElementById('ItemCashBox02').style.display = "none";
	}
	else
	{
		document.getElementById('ItemCashBox01').style.display = "none";
		document.getElementById('ItemCashBox02').style.display = "block";
	}
}		

function nextContent1() {
	if ( document.getElementById('hitBBS1_1').style.display == "block" ) {
		document.getElementById('hitBBS1_1').style.display = "none";
		document.getElementById('hitBBS1_2').style.display = "block";
	} else {
		document.getElementById('hitBBS1_2').style.display = "none";
		document.getElementById('hitBBS1_1').style.display = "block";
	}
}

function nextContent2() {
	if ( document.getElementById('hitBBS2_1').style.display == "block" ) {
		document.getElementById('hitBBS2_1').style.display = "none";
		document.getElementById('hitBBS2_2').style.display = "block";
	} else {
		document.getElementById('hitBBS2_2').style.display = "none";
		document.getElementById('hitBBS2_1').style.display = "block";
	}
}

function nextContent3() {
	if ( document.getElementById('hitBBS3_1').style.display == "block" ) {
		document.getElementById('hitBBS3_1').style.display = "none";
		document.getElementById('hitBBS3_2').style.display = "block";
	} else {
		document.getElementById('hitBBS3_2').style.display = "none";
		document.getElementById('hitBBS3_1').style.display = "block";
	}
}

function changeZzangList() {
	if ( document.getElementById('zzangList1').style.display == "block" ) {
		document.getElementById('zzangList1').style.display = "none";
		document.getElementById('zzangList2').style.display = "block";
	} else {
		document.getElementById('zzangList2').style.display = "none";
		document.getElementById('zzangList1').style.display = "block";
	}
}

function nextBestImg() {
	if ( document.getElementById('bestImgLayer1').style.display == "block" ) {
		document.getElementById('bestImgLayer1').style.display = "none";
		document.getElementById('bestImgLayer2').style.display = "block";
	} else {
		document.getElementById('bestImgLayer2').style.display = "none";
		document.getElementById('bestImgLayer1').style.display = "block";
	}
}


function calView(selT, nowM) {									
	document.getElementById('Calender_'+nowM).style.display = "none";
	if (selT == "before" ) {
		document.getElementById('Calender_'+eval(nowM-1)).style.display = "block";	
	} else {
		document.getElementById('Calender_'+eval(nowM+1)).style.display = "block";	
	}
}


/* ·¹ÀÌ¾î º¸ÀÌ±â */
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

/* FAQ °ü·Ã */
var old_menu = '';
function menuclick(menu) 
{
	if( old_menu != menu ) 
	{
		if( old_menu !='' ) 
		{
			old_menu.style.display = 'none';
		}
		menu.style.display = '';
		old_menu = menu;
	} 
	else 
	{
		menu.style.display = 'none';
		old_menu = '';
	}
}

function goEventUrl(url, sOption) {
   window.open(url,'FileGuriEvent','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=0,top=0,' + sOption);
}

function vodAlert() {
	alert("VOD(ÀÎÅÍ³Ý ¿µÈ­°ü) ¼­ºñ½º °³ÆíÀ¸·Î ÀÎÇÏ¿©\n2007³â 3¿ù 6ÀÏ 7½Ã¿¡ ¿ÀÇÂ ÇÒ ¿¹Á¤ÀÔ´Ï´Ù.\nÇ×»ó ÃÖ¼±À» ´ÙÇÏ´Â ÆÄÀÏ±¸¸®°¡ µÇµµ·Ï ³ë·ÂÇÏ°Ú½À´Ï´Ù.\n°¨»çÇÕ´Ï´Ù.\n");
	return;
}


function FGHTMLencode(strHtml) {
	var strRtnHtml = "";

	strRtnHtml = strHtml.replace("<", "&#60;");
	strRtnHtml = strRtnHtml.replace(">","&#62;" );
	strRtnHtml = strRtnHtml.replace("/","&#47;" );

	return strRtnHtml;
}


/* °Ô½ÃÆÇÁñ°ÜÃ£±â - S */
function BBSFavoriteListLayer() {
	if ( document.getElementById('bbsFavoriteList').style.display == "none" ) {
		document.getElementById('bbsFavoriteList').style.display = "block";
	} else {
		document.getElementById('bbsFavoriteList').style.display = "none";
	}
}

function viewBBSFavoriteList() {
	BBSFavoriteListLayer();
	favoriteList();
}

function favoriteList() {
	sendRequest(viewFavoriteList , '', 'GET' , '/bbs/FgBBSFavoriteList.asp' , true , true)
}

function viewFavoriteList(obj)
{
	var res  = obj.responseXML
	var FAVORITECNT = res.getElementsByTagName("FAVORITECNT")
	
	if (eval(FAVORITECNT[0].firstChild.nodeValue) > 0 ) {
		resHTML = FavoriteHTML(res)
	} else {
		resHTML = '<li>µî·ÏµÈ Áñ°ÜÃ£±â°¡ ¾ø½À´Ï´Ù.</li>'
	}
	document.getElementById("favoriteList").innerHTML = resHTML
}	

function FavoriteHTML(xdoc)
{
	var FAVORITE		= xdoc.getElementsByTagName("FAVORITE")
	var GRPID 		= xdoc.getElementsByTagName("GRPID")
	var OBJSEQ 		= xdoc.getElementsByTagName("OBJSEQ")
	var OBJSUBSEQ 	= xdoc.getElementsByTagName("OBJSUBSEQ")
	var BBSTITLE 		= xdoc.getElementsByTagName("BBSTITLE")

	html = ''
	for (i=0 ; i < FAVORITE.length; i++)
	{
		html += '<li>'
		html += '<a href="'+g_fgsvr+'/bbs/FgBBSList.asp?grpid='+GRPID[i].firstChild.nodeValue+'&objseq='+OBJSEQ[i].firstChild.nodeValue+'&objsubseq='+OBJSUBSEQ[i].firstChild.nodeValue+'">'
		html += BBSTITLE[i].firstChild.nodeValue+'</a>'
		html += '<a href="javascript:favoriteDel('+GRPID[i].firstChild.nodeValue+','+OBJSEQ[i].firstChild.nodeValue+','+OBJSUBSEQ[i].firstChild.nodeValue+')"><img src="' + g_imgsvr + '/fileguri/061016/btn_board_del.gif" width="11px" height="11px" vspace="3" alt="»èÁ¦"></a>'
		html += '</li>'
	}
	return html
}	

function favoriteDel(grpid, objseq, objsubseq) {
	if (confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
		sendRequest(fDelResult , '&grpid='+grpid+'&objseq='+objseq+'&objsubseq='+objsubseq, 'GET' , '/bbs/FgBBSFavoriteDel.asp' , true , true)
	}
}			

function fDelResult(obj)
{
	var res  = obj.responseText
	if (res == "False" ) {
		alert("Áñ°ÜÃ£±â »èÁ¦°¡ ºÒ°¡´É ÇÕ´Ï´Ù.")
	} else if (res == "True") {
		favoriteList()
		alert("Áñ°ÜÃ£±â¸¦ »èÁ¦ÇÏ¿´½À´Ï´Ù.")
	}
	favoriteList()
}
/* °Ô½ÃÆÇÁñ°ÜÃ£±â - E */


function FgSMS() {
	window.open(g_fgsvr+'/sms/', "FgSMS","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, copyhistory=0, width=760,height=530,left=300,top=100");
}



function numCheck(obj)
{
	if(((event.keyCode < 37) || (event.keyCode >40 && event.keyCode < 48) || (event.keyCode >57 && event.keyCode < 96) || (event.keyCode > 105)) && (event.keyCode != 46) && (event.keyCode != 8))
	{
		event.returnValue = false;
	}
	
	var temp = ""; 

	if(obj.value.search(/[^0-9]/) != -1) 
		obj.value = temp; 
	else 
		temp = obj.value; 	
}


function checkPhoneNum(strPhoneNum) 
{  
	/*ÇÚµåÆù ¹øÈ£ ¾ÕÀÚ¸®*/
	var strPhoneNum3
	strPhoneNum3 = "010/011/016/017/018/019/"
                
	/*¼ýÀÚÀÎÁö È®ÀÎ*/
	if (isNaN(strPhoneNum) == false) {
		if (strPhoneNum.length == 10 || strPhoneNum.length == 11) {
			if (InStr( strPhoneNum3, strPhoneNum.substring(0, 3)) == 0) {
				return false;
			} else {
				return true;
			}
		} else {
			return false;
		}
	}
	else {
		return false;
	}
}

function InStr(strSrc, strFind) {
	return strSrc.indexOf(strFind,-1)+1;
}

function FgCookieGet (name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return FgCookieGetVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

function FgCookieGetVal (offset)
{
	var endstr = document.cookie.indexOf (";", offset);

	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function fullWinClose() {
	if (/MSIE/.test(navigator.userAgent)) { 
		if(navigator.appVersion.indexOf("MSIE 7.0")>=0) {
			top.window.open('about:blank','_self').close();
		} else { 
			top.window.opener = self; 
			top.self.close(); 
		}                       
	} 			
}

function fgHelp(strvhelp) {
	if (strvhelp != null)
	{
		window.open(g_fgsvr+'/help/FgHelp.asp?vhelp='+strvhelp, "FgHelp","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, copyhistory=0, width=870,height=540,left=0,top=0");
	}
	else
	{
		window.open(g_fgsvr+'/help/FgHelp.asp', "FgHelp","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, copyhistory=0, width=870,height=540,left=0,top=0");
	}

}

function fgObjFlash(src, width, height, param, addParam) {
	param = param || "";
	addParam = addParam || "";
	document.writeln("<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=\"" + width + "\" height=\"" + height + "\">");
	document.writeln("	<param name=\"movie\" value=\"" + src + "\">");
	document.writeln("	<param name=\"flashVars\" value=\"" + param + "\">");
	document.writeln("  <param name='allowScriptAccess' value='always' />");
	document.writeln("	<param name='quality' value='high' />");
//	document.writeln("	<param name='scale' value='noscale' />");
	document.writeln("	<param name='salign' value='lt' />");
	document.writeln("	<param name='bgcolor' value='#000000' />");
	document.writeln("	<param name='menu' value='false' />");
	document.writeln("	<param name='wmode' value='opaque' />");
	document.writeln("	<embed  bgcolor='#000000' wmode='opaque' src=\"" + src + "?" + param + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed>");
	document.writeln("</object>");
}

function miniHiLow(blnLogIn) {
		if (blnLogIn)
		{
			window.open(g_fgsvr+'/Game/HiLow/miniHiLow.asp', "FgMiniHiLow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, copyhistory=0, width=710,height=580,left=0,top=0");
		} else {
			alert('·Î±×ÀÎ ÈÄ ÀÌ¿ëÇÏ¼¼¿ä.')
		}
}

function fgTotalWindowOpen(strUrl, strWinName, blnPop, lngWidth, lngHeight, lngLeft, lngTop, strScrollbars, strResizable) {
	//strScrollbars, strResizable : yes / no
	if (blnPop)
	{
	   window.open(strUrl,strWinName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+strScrollbars+",resizable="+strResizable+",width="+lngWidth+",height="+lngHeight+",left="+lngLeft+",top="+lngTop);
	} else {
	   window.open(strUrl,strWinName);
	}
}



function boardNext(name,way){
	var area = document.getElementById(name);
	var tab = area.getElementsByTagName('ul');

	for(var i=0; i<tab.length; i++){
		if(tab[i].style.display == 'none') continue;
		var tab_name = tab[i].className;
		var tab_num = tab_name.split('_');
		var tab_no = tab_num[tab_num.length - 1];
	}

	if(way == 'next') tab_no++;
	if(way == 'prev') tab_no--;
	tab_no = (tab_no + tab.length) % tab.length;

	for(var i=0; i<tab.length; i++){
		tab[i].style.display = 'none';
	}
	tab[tab_no].style.display = 'block';
}