//-----------------------------------------------------------------------------------
// ÇÃ·¡½Ã Å×µÎ¸®¾øÀÌ º¸ÀÌ´Â ÀÚ¹Ù½ºÅ©¸³Æ®
//-----------------------------------------------------------------------------------

function playflash(file,width,height,bgcolor,quality,name){
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'">');
        document.write('<param name="movie" value="'+file+'" />');
        document.write('<param name="quality" value="'+quality+'" />');
        document.write('<param name="wmode" value="transparent" />');
        document.write('<param name="bgcolor" value="'+bgcolor+'" />');
        document.write('<embed src="'+file+'" quality="'+quality+'" wmode="transparent" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
        document.write('</object>')
}


//-----------------------------------------------------------------------------------
// ¸ÞÀÎÆäÀÌÁö ·Ñ¿À¹ö ÀÚ¹Ù½ºÅ©¸³Æ®_1
//-----------------------------------------------------------------------------------
bbsclicknum2 = 1;
imgarray2 = new Array();
imgarray_r2 = new Array();
for(i=1; i<4; i++){
    imgarray2[i-1] = new Image();
    imgarray2[i-1].src = "/images/main_data_tab_"+i+"_off.gif";
    imgarray_r2[i-1] = new Image();
    imgarray_r2[i-1].src = "/images/main_data_tab_"+i+"_on.gif";
}

function bbsOver2(num){

	if(bbsclicknum2 != num){
		try{
			var cnt2 = 0;
			var noticea2 = document.getElementById("noticea");
			cnt2++;
			eval("document.getElementById('ndiv_"+num+"').style.display = '';");
			cnt2++;
			eval("document.getElementById('ndiv_"+bbsclicknum2+"').style.display = 'none';");
			cnt2++;
			eval("document.getElementById('fourthbox_tab_img"+(num)+"').src = '"+imgarray_r2[num-1].src+"'");
			cnt2++;
			eval("document.getElementById('fourthbox_tab_img"+(bbsclicknum2)+"').src = '"+imgarray2[bbsclicknum2-1].src+"'");
			cnt2++;
        bbsclicknum2 = num;
		}catch(e){ alert(e.message+":"+cnt2); }
    }
    return;
}


//-----------------------------------------------------------------------------------
// ¸ÞÀÎÆäÀÌÁö ·Ñ¿À¹ö ÀÚ¹Ù½ºÅ©¸³Æ®_2
//-----------------------------------------------------------------------------------

			function topOn(tabid,a) {
        var ID = document.getElementById(tabid,a);

				for (i=1;i<=10;i++) {
					if(i<10){inn="0"+i;} else {inn=""+i;}
					topMenu = document.getElementById("top"+tabid+"m"+i);
					topContent = document.getElementById("top"+tabid+"c"+i);
					if (topMenu) { //°´Ã¼°¡Á¸ÀçÇÏ¸é
						if (topMenu.tagName=="IMG") { topMenu.src = topMenu.src.replace("on0" + i + ".gif", "off0" + i + ".gif");} //ÀÌ¹ÌÁöÀÏ¶§
						if (topMenu.tagName=="A") { topMenu.className=""; } //¾ÞÄ¿ÀÏ¶§
					}
					if (topContent) { topContent.style.display="none"; }
				}

				if(a<10){ann="0"+a;} else {ann=""+a;}
				topMenu = document.getElementById("top"+tabid+"m"+a);
				topContent = document.getElementById("top"+tabid+"c"+a);
				//alert(topMenu.tagName);
				if (topMenu) { //°´Ã¼°¡Á¸ÀçÇÏ¸é
					if (topMenu.tagName=="IMG") { topMenu.src = topMenu.src.replace("off0" + a + ".gif", "on0" + a + ".gif"); } //ÀÌ¹ÌÁöÀÏ¶§
					if (topMenu.tagName=="A") { topMenu.className="on"; } //¾ÞÄ¿ÀÏ¶§
				}
				if (topContent) { topContent.style.display="block"; }
				topMore = document.getElementById("top"+tabid+"more");
				}

//-----------------------------------------------------------------------------------
// ¼­ºêÆäÀÌÁö ¿ÞÂÊ ¸Þ´º ·Ñ¿À¹ö ÀÚ¹Ù½ºÅ©¸³Æ®
//-----------------------------------------------------------------------------------

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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}


// Familysite
function show_con(idName)	{
	var obj = document.getElementById(idName);
	obj.style.top = "-64px";
}

function hide_con(idName)	{
	var obj = document.getElementById(idName);
	obj.style.top = "-9000px";
}


//-----------------------------------------------------------------------------------
// »õÃ¢¶ç¿ì´Â ¼Ò½º
//-----------------------------------------------------------------------------------
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}


//-----------------------------------------------------------------------------------
// È­¸éÈ®´ëÃà¼Ò
//-----------------------------------------------------------------------------------
var KeyEvent_F		= "1";							// ¹öÆ° ÀÌº¥Æ® È°¼ºÈ­(1:È°¼ºÈ­, 0:ºñÈ°¼ºÈ­)
var Otder_browser	= "F";			/* !IE È°¼ºÈ­ ¿©ºÎ(T:È°¼ºÈ­, F:ºñÈ°¼ºÈ­) */

var FrameLength;
var FrameTopName;
var FrameMainName;

//FrameLength = parent.frames.length;
FrameLength = document.getElementsByTagName("frame").length;
if( FrameLength == 2  || FrameLength == 3 ){
	FrameTopName = "parent.frames[0].";
	FrameMainName = "parent.frames[1].";
}

function NetReader(Code){

	if (!window.ActiveXObject) {
	/*}
	else{*/

		if ( Otder_browser == "F" ){	//!IEÀÏ°æ¿ì ºñÈ°¼ºÈ­ÀÌ¸é ¸®ÅÏ
			alert("NetLight´Â Internet  Explorer ¿¡¼­¸¸ Áö¿øÇÕ´Ï´Ù.");
			if (!window.ActiveXObject) return;
		}
	}

	var value = NetReader.arguments;

	//ÃÊ±âÈ­
	if( Code == "ReSet" ){
		if(ReadCookie("VoiceStart") == "start"){
			setCookie("VoiceSpeed", "3", 1);
			NetLightCOM.VoiceSpeed="3";
			setCookie("VoiceVolum", "3", 1);
			NetLightCOM.VoiceVolume="3";
		}
			setCookie("bgColorIndex", 0, 1);
			f_setBgColor("0");
			setCookie("fontColorIndex", 0, 1);
			f_setFontColor("0");
			setCookie("zoomVal", "100%", 7);
			zoomInOut("");
			//setCookie("fontSize", "9", 1);
			//f_fontreset("9");
	}

	if(KeyEvent_F == 1){ //»çÀÌÆ® ÆøÁÖ µî ÀÓ½Ã·Î ÀÌº¥Æ®¸¦ ¸·°í ½ÍÀ»¶§ »ç¿ë

		//È­¸éÅ©±â Å©°Ô
		if( Code == "ZoomUp" ){
			if( FrameLength == 2 ){
				eval(FrameMainName +"zoomInOut('in');");
			}else{
				zoomInOut('in');
			}
		}

		//È­¸éÅ©±â ÀÛ°Ô
		if( Code == "ZoomDown" ){
			if( FrameLength == 2 ){
				eval(FrameMainName +"zoomInOut('out');");
			}else{
				zoomInOut('out');
			}
		}

	}else{
		if(KeyEvent_F_F == 1){
		alert(KeyEvent_F_M);
		}
	}

}

var zoomRate = 20;			// È®´ë/Ãà¼Ò½Ã Áõ°¨·ü
var maxRate = 200;			//ÃÖ´ëÈ®´ë·ü
var minRate = 100;			//ÃÖ¼ÒÃà¼Ò·ü
var ScreenSize = 100;		//ScreenSize Default


var beforeBgColor;
var beforeTag;
var beforeTableTag;


/*****************************************************************/
//ÄíÅ°°ª ÀÐ±â
/*****************************************************************/

function ReadCookie( str )
{
  var key = str + "=";
  var key_len = key.length;
  var cookie_len = document.cookie.length;

  var i = 0;
  while ( i <= cookie_len ){
    var j = i + key_len;
    if ( document.cookie.substring( i, j ) == key ){
		var cookie_end = document.cookie.indexOf( ";", j );
		if ( cookie_end == -1 )
			cookie_end = document.cookie.length;
		return unescape( document.cookie.substring( j, cookie_end ) );
    }
    i = document.cookie.indexOf( " ", i ) + 1;

    if ( i == 0 )  break;
  }
  return "";
}

/*****************************************************************/
//ÄíÅ°°ª ¾²±â
/*****************************************************************/
function setCookie( key, value, term ){
	var expire = new Date();
	expire.setDate( expire.getDate() + term );
	document.cookie = key + "=" + escape( value ) + "; path=/; expires=" + expire.toGMTString() + ";";
}


/*****************************************************************/
/*Init()*/
/*****************************************************************/
function f_FontInit(){

	if ( ReadCookie("zoomVal").length == 0 ){
		setCookie("zoomVal", "100%", 7);
	}else currZoom = ReadCookie("zoomVal")+"%";		//È­¸éÅ©±â
	zoomInOut("");

	f_setFace();

}

/*********************************************************/
//È­¸éÈ®´ë
/*********************************************************/

function zoomInOut(how){
var sValue;

	if(ReadCookie("zoomVal") != null && ReadCookie("zoomVal") != "" && ReadCookie("zoomVal") != "NaN"){
		if( FrameLength == 2  ){
			eval(FrameMainName +"document.getElementById('wrap')").style.zoom = ReadCookie("zoomVal")+"%";
		}else{
			document.getElementById("wrap").style.zoom = ReadCookie("zoomVal")+"%";
		}
		currZoom=ReadCookie("zoomVal");
	}else{
		if( FrameLength == 2 ){
			eval(FrameMainName +"document.getElementById('wrap')").style.zoom = "100%";
		}else{
			document.getElementById("wrap").style.zoom = "100%";
		}
		currZoom = "100%";
	}

	if ( ((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) {
		return;
	}

	if (how == "in") {
		if( FrameLength == 2 )
			eval(FrameMainName +"document.getElementById('wrap')").style.zoom = parseInt(eval(FrameMainName +"document.getElementById('wrap')").style.zoom)+zoomRate+"%";
		else
			document.getElementById("wrap").style.zoom = parseInt(document.getElementById("wrap").style.zoom)+zoomRate+"%";
	}else if( how == "out" ){
		if( FrameLength == 2 )
			eval(FrameMainName +"document.getElementById('wrap')").style.zoom = parseInt(eval(FrameMainName +"document.getElementById('wrap')").style.zoom)-zoomRate+"%";
		else
			document.getElementById("wrap").style.zoom = parseInt(document.getElementById("wrap").style.zoom)-zoomRate+"%";
	}

	if( FrameLength == 2 ){
			sValue = parseInt(eval(FrameMainName +"document.getElementById('wrap')").style.zoom);
	}else{
			sValue = parseInt(document.getElementById("wrap").style.zoom);
	}
 setCookie("zoomVal", sValue, 1);
}

/*********************************************************/
//Object À¯/¹«
/*********************************************************/
function NetlightObjectType(netlight){
	if(netlight.object){
		return true;
	}else{
		return false;
	}
}


//-----------------------------------------------------------------------------------
// °Ë»ö¹Ú½º
//-----------------------------------------------------------------------------------
function fsearchbox_submit(f)
{
	if (f.stx.value == '')
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		f.stx.select();
		f.stx.focus();
		return;
	}

	f.action = "/gboard/bbs/search.php";
	f.submit();
}

function sFocus(vari) {
	(vari).style.border='1px solid #de5f97';
	(vari).style.background='#fff none';
	(vari).style.letterSpacing='normal';
}
function sBlur(vari) {
	(vari).style.border='1px solid #de5f97';
}


//-----------------------------------------------------------------------------------
// top_menu
//-----------------------------------------------------------------------------------
function initNavigation(seq) {
	nav = document.getElementById("topmenu");
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;

	allA = nav.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq])
						nav.menu[seq].onmouseover();
					else if(nav.current) {
						menuImg = nav.current.childNodes.item(0);
						menuImg.src = menuImg.src.replace("_on.gif", ".gif");
						if (nav.current.submenu)
							nav.current.submenu.style.display = "none";
						nav.current = null;
					}
				}
			}, 500);
		}
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);

		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav.current) {
				menuImg = nav.current.childNodes.item(0);
				menuImg.src = menuImg.src.replace("_on.gif", ".gif");
				if (nav.current.submenu)
					nav.current.submenu.style.display = "none";
				nav.current = null;
			}
			if (nav.current != this) {
				menuImg = this.childNodes.item(0);
				menuImg.src = menuImg.src.replace(".gif", "_on.gif");
				if (this.submenu)
					this.submenu.style.display = "block";
				nav.current = this;
			}
			nav.isOver = true;
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	}
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();
}



/////////////////////////////////////////////////////////
// °øÅë ÆäÀÌÁöÇÁ¸°Æ® ÇÔ¼ö
// ¹æ¹ý : ÀÎ¼âÇÏ°íÀÚ ÇÏ´Â ¿µ¿ªÀ» <print> </print>·Î °¨½ÎÁÜ
// ÀÚ¹Ù½ºÅ©¸³Æ®¸¸À¸·Î ÀÎ¼âÇÏ´Â ±â´É
function ps_page_print(){
	popup('/inc/print.html', 600, 500);
}

function ps_page_print2(){
	popup('/inc/print_2.html', 600, 500);
}

//¼­ºêÇÁ¸°Æ®
function contentPrint(){
	window.open("/gboard/skin/n_print.html", "printPage", "scrollbars=yes width=662 height=600");
}


//¸ÞÀÎÇÁ¸°Æ®
function contentPrint2(){
	window.open("/n_print2.html", "printPage", "scrollbars=yes width=862 height=600");
}


//¼­ºêÇÁ¸°Æ®_¾àµµ
function contentPrint3(){
	window.open("/gboard/skin/n_print2.html", "printPage", "scrollbars=yes width=642 height=700");
}

//¼­ºêÇÁ¸°Æ®_¾àµµ
function contentPrint4(){
	window.open("/gboard/skin/n_print3.html", "printPage", "scrollbars=yes width=642 height=450");
}

///////////////////////////////////////////////////////////
// ÆË¾÷ ±â´É°ü·Ã
// @url URL
// @w Æø
// @h ³Êºñ
// @s ½ºÅ©·Ñ¹Ù ¿©ºÎ 1, 'Y'ÀÌ¸é º¸¿©ÁÜ, 0, '', 'N'ÀÌ¸é ¼û±è
function popup(url,w,h,s){
	var l, t, objPopup;
	l = (screen.width-w)/2;
	t = (screen.height-h)/2;
	if(s==1 || s=="Y")
		objPopup  = window.open(url,'','width='+w+',height='+h+',left='+l+',top='+t+',resizable=0,scrollbars=1');
	else if (s=="" || s==0 || s=="N" || !s)
		objPopup = window.open(url,'','width='+w+',height='+h+',left='+l+',top='+t+',resizable=0,scrollbars=0,status=0');
	else
		objPopup = window.open(url,'','width='+w+',height='+h+',left='+l+',top='+t+',resizable=1,menubar=1,toolbar=1,scrollbars=1,status=1');
	if (objPopup == null) {
		alert("Â÷´ÜµÈ ÆË¾÷Ã¢À» Çã¿ëÇØ ÁÖ½Ê½Ã¿À.");
	}
	return objPopup;

}


function popupEx(url,w,h,s){
	var objPopup;

	if(s==1 || s=="Y")
		objPopup  = window.open(url,'','width='+w+',height='+h+',resizable=0,scrollbars=1');
	else if (s=="" || s==0 || s=="N" || !s)
		objPopup = window.open(url,'','width='+w+',height='+h+',resizable=0,scrollbars=0,status=0');
	else
		objPopup = window.open(url,'','width='+w+',height='+h+',resizable=1,menubar=1,toolbar=1,scrollbars=1,status=1');
	if (objPopup == null) {
		alert("Â÷´ÜµÈ ÆË¾÷Ã¢À» Çã¿ëÇØ ÁÖ½Ê½Ã¿À.");
	}
	return objPopup;

}

function openWin(url,w,h){
	window.open(url,"",'width='+w+',height='+h+',resizable=0,scrollbars=0,status=0');
}

