function pressEnter(e,f) {
        if(e.keyCode == 13) {
                kwdSearch(f);
                return false;
        } 
     return false;//Ãß°¡µÊ. ¹«Á¶°Ç false ¸¦ ¸®ÅÏ.
}

// Enter KeyPress
function keyPressTop(e,f) { 
	if(e.keyCode == 13) {
		kwdSearchTop(f);
		return false;
	} 
	//return false;//Ãß°¡µÊ. ¹«Á¶°Ç false ¸¦ ¸®ÅÏ.
}


function kwdSearchTop(f)
{ 
	if( f.kwd.value == "" || f.kwd.value == "enter the keyword") 
	{
		alert("enter the keyword");
		f.kwd.focus();
		return;
	}
	else
	{	
	//	f.pageNum.value = 1;
		f.submit();
	}
}


function kwdSearch(f)
{
	if( f.kwd.value == "" ) {
		alert("please enter your keyword");
		f.kwd.focus();
	}else{
	
//	if(f.site_info.options[f.site_info.selectedIndex].value == 0)
//	 {
//	 	f.scope.value = 0;
//	 }
//	 else if(f.site_info.options[f.site_info.selectedIndex].value == 1)
//	 {
//	 	f.scope.value = 1;
//	 }
//	 else
//	 {
//	 	f.scope.value = 2;
//	 }
	
//		if(f.reSrch.checked==true) f.reSrch.value="on";
//		else f.reSrch.value="";
		f.pageNum.value = 1;
		f.submit();
	}
}

function reSearch(f)
{
	f.kwd.value='';
	f.kwd.select();
}

function init() {
	window.parent.up.document.all.q.value = "";
	window.parent.up.document.all.q.focus();
}

function gotoEntry(e) {
	document.f2.pageNum.value = 1;
	document.f2.entryNm.value = e;
	document.f2.action = "/util/search/" +e +"_list.jsp";
	document.f2.submit();
}

function gotoPage(n) {
	document.f2.pageNum.value = n;
	document.f2.submit();
}

function showDetail(n) {
	var url, feature;
    url = "news.cgi?action=detail&id=" + n;
    feature = "height=650, width=600, location=no, menubar=no, scrollbars=yes";
    window.open( url, "detail_win", feature );
}

function buildPageNav( pageNum, pageSize, total )
{
	var totalPages;

	totalPages = Math.floor((total-1)/pageSize) + 1

	if( totalPages < 1 )
		return "";

	var ret, PAGEBLOCK;

	ret = "";
	PAGEBLOCK=10;

	var i, firstPage, lastPage;

	firstPage = Math.floor((pageNum-1)/PAGEBLOCK) * PAGEBLOCK + 1;
	if( firstPage <= 0 ) // ?
		firstPage = 1;

	lastPage = firstPage-1 + PAGEBLOCK;
	if( lastPage > totalPages )
		lastPage = totalPages;

	if( firstPage >= PAGEBLOCK )
	{
		ret = ret + "<a href='javascript:gotoPage(1)'><IMG src='/kosearch/images/btn/list_first.gif' ALT='first' ALIGN='absmiddle'></a>&nbsp;\n";
		ret = ret + "<a href='javascript:gotoPage(" + (firstPage-1) + ")'><IMG src='/kosearch/images/btn/list_back.gif' ALT='pre' ALIGN='absmiddle'></a>&nbsp;&nbsp;\n";
	}

	i = firstPage;
	while( i <= lastPage && (i-1)*pageSize <= total )

	for( i=firstPage; i<=lastPage; i++ )
	{
		if( (i-1)*pageSize > total ) break;
		if( pageNum == i ){
			if( i < lastPage )
				ret = ret + "<b>" + i + "</b>&nbsp;/\n";
			else
				ret = ret + "<b>" + i + "</b>&nbsp;\n";
		}else{
			if( i < lastPage )
				ret = ret + "<a href='javascript:gotoPage(" + i + ")'>" + i + "</a>&nbsp;/\n";
			else
				ret = ret + "<a href='javascript:gotoPage(" + i + ")'>" + i + "</a>&nbsp;\n";
		}
	}

	if( (lastPage+1)*pageSize < total )
	{
		ret = ret + "&nbsp;&nbsp;<a href='javascript:gotoPage(" + (lastPage+1) + ")'><IMG src='/kosearch/images/btn/list_next.gif' ALT='next' ALIGN='absmiddle'></a>\n";
		ret = ret + "&nbsp;<a href='javascript:gotoPage(" + (totalPages) + ")'><IMG src='/kosearch/images/btn/list_end.gif' ALT='last' ALIGN='absmiddle'></a>\n";
	}

	return ret;
}

/*
function scopeClick(f,v)
{
    var scope = f.site_info.options[f.site_info.selectedIndex].value;
	if(scope==2){
		f.site_info.disabled = false;	
	}else{
		f.site_info[0].selected = true;	
		f.site_info.disabled = true;	
	}
}*/
function scopeClick(f,v)
{

	if(v==2){
		f.site_info.disabled = false;	
	}else{
		f.site_info[0].selected = true;	
		f.site_info.disabled = true;	
	}
}
function toggleAdvSearch(){
	var obj = document.getElementById("advSearch");
	
	if (obj) {
		if (obj.style.display == "none") {
			obj.style.display = "block";
		} else {
			obj.style.display = "none";
		}
	}
}
function f_header_top_navigation(){
    document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ID="top_navigation" WIDTH="610" HEIGHT="100%" ALIGN="">');
    document.write ('<PARAM NAME="movie" VALUE="/korean/images/flash/top_navigation_sub_070228.swf">');
    document.write ('<PARAM NAME="quality" VALUE="high">');
    document.write ('<PARAM NAME="scale" VALUE="noscale">');
    document.write ('<PARAM NAME="wmode" VALUE="transparent">');
    document.write ('<PARAM NAME="flashvars" VALUE="mode=<%=f_key%>&subMode=<%=f_subkey%>">');
    document.write ('<EMBED src="/korean/images/flash/top_navigation_sub_070228.swf" quality="high" scale="noscale" wmode="transparent" bgcolor="#FFFFFF" WIDTH="610" HEIGHT="100%" swLiveConnect="true" ID="top_navigation" NAME="top_navigation" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
    document.write ('</OBJECT>');
}
function f_index_top_navigation_main_051230(){
    document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ID="top_navigation" WIDTH="610" HEIGHT="100%" ALIGN="">');
    document.write ('<PARAM NAME="movie" VALUE="/korean/images/flash/top_navigation_main_070228.swf"> ');
    document.write ('<PARAM NAME="quality" VALUE="high"> ');
    document.write ('<PARAM NAME="scale" VALUE="noscale"> ');
    document.write ('<PARAM NAME="wmode" VALUE="transparent"> ');
    document.write ('<PARAM NAME="flashvars" VALUE="mode=0&subMode=0"> ');
    document.write ('<PARAM NAME=menu VALUE=false> ');
    document.write ('<EMBED src="/korean/images/flash/top_navigation_main_070228.swf" wmode="transparent" bgcolor="#FFFFFF" WIDTH="610" HEIGHT="100%" swLiveConnect="true" ID="top_navigation" NAME="top_navigation" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> ');
    document.write ('</OBJECT> ');
}


function no_email()
{
	window.open('/korean/utility/etc/popEmail.jsp','noemail_win',set_center(356,301,1));
}

function set_center(width,height,type)
{
	    nWidth = width;
		nHeight = height;
		nLeft = (window.screen.width - nWidth ) / 2;
		nTop  = (window.screen.height- nHeight) / 2;
		sF = "";
		if(type=="1") sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=no,scrollbars=no";
		else sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=no,scrollbars=yes";
		sF += ",left=" + nLeft;
		sF += ",top=" + nTop;
		sF += ",width=" +  nWidth;
		sF += ",height=" + nHeight;
		return sF;
}


function go_link(url)
{
	var go_url ;
	if(url.indexOf("http://") != -1){
		go_url = url;
	}else{
		go_url = "http://"+url;
	}
	
	window.open(go_url,"new_win","");
}


function go_link(url)
{
	var go_url ;
	if(url.indexOf("http://") != -1){
		go_url = url;
	}else{
		go_url = "http://"+url;
	}
	
	window.open(go_url,"new_win","");
}
