
classNateGNB = function(arrNateGnbRSInfo)
{
	var self=this;
	var bAllListOpen = false;//default : false = closed
	this.AllListOpen =function(){return bAllListOpen}
	function init()	{writeGnb();}
	init();
	function getCookie(name)
	{
	  var cname = name + "=";
	  var dc = document.cookie;
	  if (dc.length > 0) {
			begin = dc.indexOf(cname);
		 if (begin != -1) {
			   begin += cname.length;end = dc.indexOf(";", begin);
			 if (end == -1)
				end = dc.length;
			return unescape(dc.substring(begin, end));
			 }
		  }
		return null;
	}

	this.showMoreLayer = function()
	{
		self.nc('NGA09');
		if(!bAllListOpen)
		{
			document.getElementById("btnNateGnbAllListLi").className = "view_more open";
			document.getElementById("nateGnbAllList").style.display = "block";
			bAllListOpen = true;
		}
		else
		{
			document.getElementById("btnNateGnbAllListLi").className = "view_more";
			document.getElementById("nateGnbAllList").style.display = "none";
			bAllListOpen = false;
		}
	}
	this.closeMoreLayer = function()
	{
			document.getElementById("btnNateGnbAllListLi").className = "view_more";
			document.getElementById("nateGnbAllList").style.display = "none";
			bAllListOpen = false;
	}

	this.nc = function ( regionId, redirectUrl, target, option )
	{
		var img = new Image();
		img.src = 'http://statclick.nate.com/stat/statclick.tiff?cp_url=[click_ndr.nate.com/??ndrpageid=na1&ndrregionid=' + regionId + ']';
		if( redirectUrl == null ) return;
		if( target != null )
		{
			if( option != null )
				window.open( redirectUrl, target, option );
			else
				window.open( redirectUrl, target );
		}
		else
			location.href = redirectUrl;
	}

	function writeGnb()
	{
		var nRsLength = 0;
		//RS±æÀÌ °ËÁõ
		if(arrNateGnbRSInfo == null || arrNateGnbRSInfo == undefined)
		{
			arrNateGnbRSInfo = [];//°­Á¦ ÃÊ±âÈ­
			nRsLength = 0;
		}

		if(arrNateGnbRSInfo.length>3)
			nRsLength = 3;//3°³º¸´Ù ¸¹À¸¸é Ã³À½ 3°³¸¸ ÇÁ¸°Æ®
		else
			nRsLength = arrNateGnbRSInfo.length;

		var NAME=getCookie("n_");

		//CSS
		var style = '<style type="text/css">';
		style += '#txt_GNB { position:relative; float:right; margin-top:1px; word-wrap:normal !important; }';
		style += '#textGnb p, #textGnb ul, #textGnb li, #textGnb dl, #textGnb dd { margin:0; padding:0; font-family:µ¸¿ò, Dotum, AppleGothic, sans-serif; }';
		style += '#txt_GNB ul.menu_gnb { float:right; margin:1px 0 0 0; padding:0; }';
		style += '#txt_GNB ul.menu_gnb li { float:left; list-style:none; padding:3px 5px 0 5px; height:auto; background:url(http://tapa.cygo.net/talkbox/images/img_txtgnb1.gif) no-repeat right -53px; letter-spacing:-1px; font-size:10pt; font-family:"µ¸¿ò",Dotum, AppleGothic, sans-serif; line-height:11px; }';
		style += '#txt_GNB ul.menu_gnb li.rs_end { font-size:11pt; padding:3px 9px 0 4px; background-position: right -39px; }';
		style += '#txt_GNB ul.menu_gnb li.view_more { padding:3px 15px 0 4px; background:url(http://tapa.cygo.net/talkbox/images/img_txtgnb.gif) no-repeat -5px -20px; cursor:pointer; color:#464646 !important; }';
		style += '#txt_GNB ul.menu_gnb li.open { background-position:-5px 0; }';
		style += '#txt_GNB ul.menu_gnb li.log_status a { text-indent:-9999px; }';
		style += '#txt_GNB ul.menu_gnb li a { font-family:"µ¸¿ò",Dotum, AppleGothic, sans-serif; font-size:10pt !important; color:#464646 !important; text-decoration:none; text-align:left; overflow:hidden; }';
		style += '#txt_GNB ul.menu_gnb li a:hover { font-size:10pt !important; color:#54C1C8 !important; text-decoration:underline; }';
		style += '#txt_GNB div.log_status { float:left; }';
		style += '#txt_GNB div.log_status a.login { display:block; width:38px; height:17px; background:url(http://natesf.kr/img_v2/gnb/img_txtgnb.gif) no-repeat 0 -71px; text-indent:-9999px; text-align:left; overflow:hidden; }';
		style += '#txt_GNB div.log_status a.logout { display:block; width:48px; height:17px; background:url(http://natesf.kr/img_v2/gnb/img_txtgnb.gif) no-repeat 0 -90px; text-indent:-9999px; text-align:left; overflow:hidden; }';
		style += '#txt_GNB .gnbAllList { position:absolute; top:18px; right:0; padding:0; width:100px; height:100px; background:#FFF; border:2px solid #c6c6c6; }';
		style += '*html #txt_GNB .gnbAllList { position:absolute; top:18px; right:0; padding:0; width:125px; height:35px; }';
		style += '#txt_GNB ul.service_list { float:left; margin:9px 6px 2px 10px; padding:0; width:70px; display:inline; }';
		style += 'html>body #txt_GNB ul.service_list { float:left; margin:8px 15px 0 10px; padding:0; width:70px; height:22px; }';
		style += '#txt_GNB ul.service_list li { float:left; padding:0; list-style:none; height:19px; background:none; text-align:left; letter-spacing:-1px; line-height:14px; font-size:8pt; }';
		style += '#txt_GNB ul.service_list li.col_01 { width:70px; }';
		style += '#txt_GNB ul.service_list li.col_02 { width:38px; }';
		style += '#txt_GNB ul.service_list li.col_03 { width:38px; }';
		style += '#txt_GNB ul.service_list li.col_04 { width:53px; }';
		style += '#txt_GNB ul.service_list li.link_egloos { height:19px; background:url(http://natesf.kr/img_v2/gnb/img_txtgnb.gif) no-repeat -2px -111px; }';
		style += '#txt_GNB ul.service_list li.view_all { background:url(http://natesf.kr/img_v2/gnb/img_txtgnb.gif) no-repeat 42px -136px; }';
		style += '#txt_GNB ul.service_list li.view_all a { color:#4488ee !important; }';
		style += '#txt_GNB ul.service_list li a { font-family:"µ¸¿ò",Dotum, AppleGothic, sans-serif; font-size:10pt !important; text-decoration:none; color:#555 !important; }';
		style += '#txt_GNB ul.service_list li a:hover { color:#54C1C8 !important; text-decoration:underline; }';
		style += '* html #txt_GNB ul.menu_gnb li, * html #txt_GNB ul.menu_gnb li a { line-height:normal; }';
		style += '*:first-child+html #txt_GNB ul.menu_gnb li, *:first-child+html #txt_GNB ul.menu_gnb li a { line-height:normal; }';
		style += '</style>';
		document.write( style );
		document.write( style );
		var strHtml = "";
		var strLoginUrl="";
		strHtml += '<div id="txt_GNB">';
		strHtml += '	<ul class="menu_gnb">';
		for(var i=0;i<nRsLength;i++)
		{
			if((i+1) == nRsLength)
				strHtml += '		<li class="rs_end"><a target="_top" href="'+arrNateGnbRSInfo[i].url+'">'+arrNateGnbRSInfo[i].title+'</a></li>';
			else
				strHtml += '		<li><a target="_top" href="'+arrNateGnbRSInfo[i].url+'">'+arrNateGnbRSInfo[i].title+'</a></li>';
		}
		
		strHtml += '		<li><a target="_top" href="http://www.cygo.net/man/" >³²¼ºÆ÷·³</a></li>';
		strHtml += '		<li><a target="_top" href="http://tapa.cygo.net/talkbox/" >ÅäÅ©¹Ú½º</a></li>';
		strHtml += '		<li><a target="_top" href="http://tapa.cygo.net/" >Æø¼ÒÅ¸ÆÄ</a></li>';
		strHtml += '		<li><a target="_top" href="http://tapa.cygo.net/racing_girl/">·¹ÀÌ½Ì¸ðµ¨</a></li>';
		strHtml += '		<li><a target="_top" href="http://four.cygo.net/" >º¸µå°ÔÀÓ</a></li>';
		strHtml += '		<li><a target="_top" href="http://tapa.cygo.net/flash/" >ÇÃ·¡½Ã°ÔÀÓ</a></li>';
		strHtml += '		<li><a target="_top" href="http://tapa.cygo.net/batang/" >¹ÙÅÁÈ­¸é</a></li>';
		strHtml += '		<li><a target="_top" href="http://tapa.cygo.net/moazine/" >UCC</a></li>';
		strHtml += '		<li><a target="_top" href="http://tapa.cygo.net/dream/" >²ÞÇØ¸ù</a></li>';
		strHtml += '		<li><a target="_top" href="http://www.cygo.net/dbfile/" >°øÀ¯Å¸ÆÄ</a></li>';
		strHtml += '		<li><a target="_top" href="http://aclub.cygo.net/" >¼ºÀÎÅ¬·´</a> <img src="http://tapa.cygo.net/talkbox/images/o19.gif" width="12" height="11" border="0" style="vertical-align:middle;padding-bottom:2px;"></li>';
		strHtml += '		<li id="btnNateGnbAllListLi" class="view_more">´õº¸±â</li>';
		strHtml += '	</ul>';
		strHtml += '	<div id="nateGnbAllList" class="gnbAllList" style="display:none;">';
		strHtml += '		<ul class="service_list">';
		strHtml += '			<li class="col_01"><a target="_top" title="ÀÌº¥Æ® ¹Ù·Î°¡±â" href="http://pds.cygo.net/pds_list.php?table=event_1" >ÀÌº¥Æ®</a></li>';
		strHtml += '			<li class="col_01"><a target="_top" title="PX ¹Ù·Î°¡±â" href="http://tapa.cygo.net/px/" >PX</a></li>';
		strHtml += '			<li class="col_01"><a target="_top" title="Â«¹äÃæÀü ¹Ù·Î°¡±â" href="http://tapa.cygo.net/free/charge_2.php" >Â«¹äÃæÀü</a></li>';
		strHtml += '			<li class="col_01"><a target="_top" title="ÈÄÀÓº´¸ðÁý ¹Ù·Î°¡±â" href="http://tapa.cygo.net/event/successor/" >ÈÄÀÓº´¸ðÁý</a></li>';
		strHtml += '			<li class="col_01"><a target="_top" title="¿µÃ¢°ßÇÐ ¹Ù·Î°¡±â" href="http://tapa.cygo.net/prison.php" >¿µÃ¢°ßÇÐ</a></li>';
		strHtml += '		</ul>';
		strHtml += '	</div>';
		strHtml += '</div>';
		document.write( strHtml );
	}

	function r_urlFilter(targetText)
	{
		var description = targetText;
		description .replace(/</g, "&lt;").replace(/>/g, "&gt;");
		description.replace(/[\"\'][\s]*javascript:(.*)[\"\']/g, "\"\"");
   		description = description.replace(/script(.*)/g, "");
	    description = description.replace(/eval\((.*)\)/g, "");
		return description;
	}
}

if (document.addEventListener)
	document.addEventListener('click', mouseDownNateGNBEventHandler, false);
else if (document.attachEvent)
	document.attachEvent('onclick', mouseDownNateGNBEventHandler);
	
function mouseDownNateGNBEventHandler(e) {
	try
	{
		var target = (e.srcElement || e.target);
		if (target.id == 'btnNateGnbAllListLi')
			NateGNB.showMoreLayer();
		else
			NateGNB.closeMoreLayer();
	}catch(e){}
}



