tUrl = document.location;
function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
	
	if ((name + "=" + escape(value)).length <= 4000) {
			document.cookie = curCookie;
	} else {
		if (confirm("Cookie exceeds 4KB and will be cut!")) {
			document.cookie = curCookie;
		}
	}
	return true;
}


function SetUrl() 
{
	setCookie("URL",tUrl,null,"/","fgtv.com");
	ID		= escape(GetCookie("User_Id"))
	if (ID == ""){
		location.href="http://www.fgtv.com/login/login.html"
		return;
	}
	location.href=tUrl;	
}


function GetCookie(NameCookie) {
        var i = document.cookie.indexOf(NameCookie + '=' );                                                       
        if (i != -1) { 
                i += NameCookie.length + 1;
                NameEnd = document.cookie.indexOf(';', i); 
                if (NameEnd == -1)
                    {  NameEnd = document.cookie.length; }              
                return  unescape(document.cookie.substring(i, NameEnd));                
        }
        else{
          return ""     
        }       
 }

function SetLogin() {
	
//	Name	= escape(GetCookie("User_Name"))
	ID		= escape(GetCookie("User_Id"))
	if (ID == ""){
//		document.write('<img src="http://www.fgtv.com/image/IG_top_icon_2.gif" width="9" height="28" border="0" align="absmiddle">&nbsp;<a href="http://www.fgtv.com/login/login.html" onClick="SetUrl()">·Î±×ÀÎ</a>&nbsp;&nbsp;<a href="http://www.fgtv.com/login/joinform_01.html" onClick="SetUrl()" onFocus=this.blur()><img src="http://www.fgtv.com/image/IG_top_icon_3.gif" width="10" height="28" border="0" align="absmiddle">&nbsp;È¸¿ø°¡ÀÔ&nbsp;&nbsp;</a>\n')
		document.write('<a href="http://mail.fgtv.com/" target="_blank" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_1.gif" width="4" height="28" border="0" align="absmiddle">&nbsp;e-mail&nbsp;&nbsp;</a>\n'
		
		+'<a href="javascript:SetUrl()" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_4.gif" width="8" height="28" border="0" align="absmiddle">&nbsp;·Î±×ÀÎ&nbsp;&nbsp;</a><a href="http://www.fgtv.com/login/bin/member_info.htm" ><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_3.gif" width="10" height="28" border="0" align="absmiddle">&nbsp;È¸¿ø°¡ÀÔ&nbsp;&nbsp;</a>\n')
	}	
	else{
		var m;
		var n = 1;
		var StrCheckNum = 0;
		var StrtUrl = new String(tUrl);
		for(m=0;m<StrtUrl.length;m++, n++)
		{ 
		CheckStr = StrtUrl.substring(m, n);
		if (CheckStr == "&") 
		StrCheckNum++; 
		}
				
		for(m=0; m<StrCheckNum; m++)
		{
		StrtUrl  = StrtUrl.replace("&", "|");
		}
	//	document.write('<a href="http://www.fgtv.com/login/logout.asp?turl='+StrtUrl+'"><img src="http://www.fgtv.com/image/IG_top_icon_2.gif" width="9" height="28" border="0" align="absmiddle">&nbsp;·Î±×¾Æ¿ô&nbsp;&nbsp;</a><a href="http://www.fgtv.com/login/joinform_memberEdit.asp" onFocus=this.blur()><img src="http://www.fgtv.com/image/IG_top_icon_3.gif" width="10" height="28" border="0" align="absmiddle">&nbsp;È¸¿ø¼öÁ¤&nbsp;&nbsp;</a></td><td width="120" align="right" class="copyright1">\n');
	//	document.write('<a href="http://www.fgtv.com/login/logout.asp?turl='+StrtUrl+'" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_2.gif" width="9" height="28" border="0" align="absmiddle">&nbsp;·Î±×¾Æ¿ô&nbsp;&nbsp;</a><a href="http://www.fgtv.com/login/joinform_memberEdit.asp" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_3.gif" width="10" height="28" border="0" align="absmiddle">&nbsp;È¸¿ø¼öÁ¤&nbsp;&nbsp;</a></td><td width="120" align="right" class="copyright1">\n');

		document.write('<a href="http://mail.fgtv.com/servlet/crinity?paction=login&ptype=SSO" target="_blank" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_1.gif" width="4" height="28" border="0" align="absmiddle">&nbsp;e-mail&nbsp;&nbsp;</a>\n'
		+'<a href="http://www.fgtv.com/login/logout.asp?turl='+StrtUrl+'" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_2.gif" width="9" height="28" border="0" align="absmiddle">&nbsp;·Î±×¾Æ¿ô&nbsp;&nbsp;</a><a href="http://www.fgtv.com/login/bin/member_02modify.asp" onClick="SetUrl()" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_3.gif" width="10" height="28" border="0" align="absmiddle">&nbsp;È¸¿øÁ¤º¸&nbsp;&nbsp;</a></td><td width="120" align="right" class="copyright1">\n');
		MyCafeView();
	}
}


function MyCafeView(){

ID = escape(GetCookie("User_Id"))
if (ID != "")
	document.write('<iframe src="http://nanum.fgtv.com/myCafe.asp" border="0" framespacing="0" frameborder="NO"  scrolling="NO" WIDTH="150%" HEIGHT="20"  name="a"></iframe>\n');
}

function G_menu(){
MM_swapImgRestore();
MM_swapImage();
document.write ('<table width="947" border="0" cellpadding="0" cellspacing="0" align="center>\n'
+'					<tr>\n'
+'					<a name="top"></a>\n'
+'						<td width="140"><a href="http://www.fgtv.com/" onFocus=this.blur()><img src="http://nanum.fgtv.com/image/IG_top_logo.gif" width="134" height="29" border="0"></a></td>\n'
+'						<td align="right" class="copyright1">\n'
+'						<a href="http://www.fgtv.com/fgtv/f2/sitemap.htm" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_1.gif" width="4" height="28" border="0" align="absmiddle">&nbsp;»çÀÌÆ®¸Ê&nbsp;&nbsp;</a>\n'

+'						<a href="http://nanum.fgtv.com/e_card/main.html" onFocus=this.blur()><img src="http://www.fgtv.com/fgtv/image/IG_top_icon_1.gif" width="4" height="28" border="0" align="absmiddle">&nbsp;e-Ä«µå&nbsp;&nbsp;</a>\n');
SetLogin();
document.write ('</td>\n'
+'					</tr>\n'
+'				</table>\n');
}
G_menu();
