function gotoBoardWritePage(objFrm, strGotoPage){
	objFrm.action = strGotoPage;
	objFrm.submit();
}

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();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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];}
}

function setCookie(__strCookieName, __strCookieValue, __intDay, __strPath, __strDomain, __strSecure)
{
	var objToday = new Date();
	var objExpires = new Date();
	if (__intDay==null || __intDay==0) __intDay=1;

	objExpires.setTime(objToday.getTime() + 3600000*24*__intDay);

	var strExpires = (objExpires) ? ";expires=" + objExpires.toGMTString() : "";
	var strPath = (__strPath) ? ";path=/" : "";
	var strDomain = (__strDomain) ? ";domain=" + __strDomain : "";
	var strSecure = (__strSecure) ? ";secure" : "";
	var strCookie = __strCookieName + "=" +escape(__strCookieValue) + strExpires + strPath + strDomain + strSecure;

    document.cookie = strCookie;
}

function getCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}

function getOptionValue( strObjName )
{
	var objValue = document.getElementById(strObjName);
	if ( objValue.selectedIndex > -1 ){
		return objValue.options[objValue.selectedIndex].value;
	}else{
		return "";
	}
}

function doPopup( sLink, sFName, iWidth, iHeight, bScroll, iInit )
{
	var scrX = screen.width;
	var scrY = screen.height;
	if ( iInit == null ) iInit = -1;
	if ( iInit >= 0 )
	{
		var intTop = window.screenTop;
		var intLeft = window.screenLeft + iInit;
	} else {
		var intLeft = (scrX / 2) - (iWidth / 2);
		var intTop = (scrY / 2) - (iHeight / 2);
	}

	window.open( sLink, sFName, 'left=' + intLeft + ', top=' + intTop + ', width=' + iWidth + ', height=' + iHeight + ',scrollbars=' + bScroll + ',resizable=' + bScroll + ', status=no');
}

function doPopupFULL( sLink, sFName )
{
	var scrX = screen.width;
	var scrY = screen.height;

	window.open( sLink, sFName, 'left=0, top=0, width=' + scrX + ', height=' + scrY + ',scrollbars=no,resizable=no, status=no');
}

function doZipcodePopup( sLink, sPopupName )
{
	var scrX = screen.width;
	var scrY = screen.height;
	var iWidth = 400;
	var iHeight = 220;

	var intLeft = (scrX / 2) - (iWidth / 2);
	var intTop = (scrY / 2) - (iHeight / 2);

	window.open( sLink, sPopupName, 'left=' + intLeft + ', top=' + intTop + ', width=' + iWidth + ', height=' + iHeight + ',scrollbars=no,resizable=no, status=no');
	return false;
}
function doIDCheckPopup( sLink, sPopupName )
{
	var scrX = screen.width;
	var scrY = screen.height;
	var iWidth = 10;
	var iHeight = 10;

	var intLeft = (scrX / 2) - (iWidth / 2);
	var intTop = (scrY / 2) - (iHeight / 2);

	window.open( sLink, sPopupName, 'left=' + intLeft + ', top=' + intTop + ', width=' + iWidth + ', height=' + iHeight + ',scrollbars=no,resizable=no, status=no');
	return false;
}

function doManageIDCheckPopup( sLink, sPopupName )
{
	var scrX = screen.width;
	var scrY = screen.height;
	var iWidth = 10;
	var iHeight = 10;

	var intLeft = (scrX / 2) - (iWidth / 2);
	var intTop = (scrY / 2) - (iHeight / 2);

	window.open( sLink, sPopupName, 'left=' + intLeft + ', top=' + intTop + ', width=' + iWidth + ', height=' + iHeight + ',scrollbars=no,resizable=no, status=no');
	return false;
}

function doCheckIntegerMIN( strObjName, strMSG, intMIN ){
	var objValue = document.getElementById(strObjName);
	if ( parseInt(objValue.value) < parseInt(intMIN) ){
		alert(strMSG);
		objValue.value = "";
		objValue.focus();
		return false;
	}else{
		return true;
	}
}

function doConfirm( strMSG ){
	return confirm(strMSG);
}

function doAlert( strMSG ){
	alert(strMSG);
}
function doAlertFalse( strMSG ){
	alert(strMSG);
	return false;
}

function doCheckNULL( strObjName, strMSG ){
	var objValue = document.getElementById(strObjName);
	if ( Trim(objValue.value) == "" ){
		alert(strMSG);
		objValue.focus();
		return false;
	}else{
		return true;
	}
}

function doCheckDefaultNULL( strObjName, strMSG ){
	var objValue = document.getElementById(strObjName);
	if ( objValue.value == objValue.defaultValue || Trim(objValue.value) == "" ){
		alert(strMSG);
		objValue.focus();
		return false;
	}else{
		return true;
	}
}

function doClearText( objTextfield ){
	if ( objTextfield.defaultValue == objTextfield.value )
		objTextfield.value = "";
}

function doFillText( objTextfield ){
	if ( objTextfield.value == "" )
		objTextfield.value = objTextfield.defaultValue;
}

function doGotoCombo(form) {
	switch(form.value) {
		case 'top'		:	top.location=form.options[form.selectedIndex].name;
							break;
		case 'parent'	:	parent.location=form.options[form.selectedIndex].name;
							break;
		case 'blank'	:	window.open(form.options[form.selectedIndex].name);
							break;
        case 'sanha'    :	window.open(form.options[form.selectedIndex].name,"sanha","toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no,left=5000,top=5000,width=10,height=10");
                            break;
//		case 'frame'    :       send1('7','4',form.options[form.selectedIndex].name);
//							break;
//		case 'survey'   :       send1('7','6',form.options[form.selectedIndex].name);
//							break;
//		case 'proposal' :       send1('7','7','');
//							break;
//		case 'card'     :       send1('7','1','');
//							break;
//		case 'praise'   :       send1('7','11','');
//							break;
//		case 'civilservice'    : send1('7','12','');
//							break;
//		case 'culture'    :			send1('3','1',form.options[form.selectedIndex].name);
//							break;
//		case 'law'    :			send1('6','2',form.options[form.selectedIndex].name);
//							break;
//		case 'province'	:		send1('0','1',form.options[form.selectedIndex].name);
//							break;
//		case 'gg'    :			send1('0','0',form.options[form.selectedIndex].name);
//							break;
//		case 'trafic'	:		send1('1','5',form.options[form.selectedIndex].name);
//							break;
//		case 'catalog'    :			send1('2','2',form.options[form.selectedIndex].name);
//							break;
//		case 'human'	:		send1('5','8',form.options[form.selectedIndex].name);
//							break;
//		case 'cartoon'    :			send1('0','6',form.options[form.selectedIndex].name);
//							break;
//		case 'jumin'	:		send1('0','3',form.options[form.selectedIndex].name);
//							break;
//		case 'house'    :			send1('5','7',form.options[form.selectedIndex].name);
//							break;
//		case 'export'    :			send1('2','3',form.options[form.selectedIndex].name);
//							break;
		default			:	self.location="/";

	}
	form.selectedIndex=0;
	form.blur();
	return;
}

function Trim(strValue){
	while( strValue && strValue.indexOf(" ") == 0 ) strValue = strValue.substring(1);
	while( strValue && strValue.lastIndexOf(" ") == strValue.length - 1 ) strValue = strValue.substring( 0, strValue.length - 1 );
	return strValue;
}
function SetImeMode()
{
// TextBox ÇÑ±Û¿ì¼±/¿µ¹®¿ì¼±/ÇÑ±ÛºÒ°¡ ¸ðµå ¼³Á¤
//
// - ±âº»°ª(¾Æ¹«°Íµµ ¼³Á¤ ¾ÈÇßÀ» °æ¿ì) : ÇÑ±Û¿ì¼±ÀÓ!!
//
	for(var e=0 ; e < document.forms[0].elements.length ; e++)
	{
		var ctl = document.forms[0].elements[e];
		if (ctl.type == "text" || ctl.tagName == "TEXTAREA") {
			if ( ctl.imeMode == 'inactive' ){	 // ¿µ¹®¿ì¼±
				ctl.style.imeMode = 'inactive';
			}
			else if ( ctl.imeMode == undefined || ctl.imeMode == 'active' ){	// ÇÑ±Û¿ì¼±
				ctl.style.imeMode = "active";
			}
			else if ( ctl.imeMode == 'auto' ){	// ÀÌÀü ÅØ½ºÆ®¹Ú½º ¼³Á¤ µû¶ó°¨
				ctl.style.imeMode = 'auto';
			}
			else if ( ctl.imeMode == 'disabled' ){	// ÇÑ±ÛºÒ°¡
				ctl.style.imeMode = 'disabled';
			}
		}
	}
}

//[S]Top Button
// ±âº» ÇÔ¼ö
var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function getSty(id) {
	x = getRef(id);
	return (isNS4 ? getRef(id) : getRef(id).style);
}

var scrollerHeight = 88;
var puaseBetweenImages = 3000;
var imageIdx = 0;

function moveRightEdge() {
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;

	if (isNS4) {
		yMenuFrom   = divMenu.top;
		yMenuTo     = windows.pageYOffset + 102;   // À§ÂÊ À§Ä¡
	} else if (isDOM) {
		yMenuFrom   = parseInt (divMenu.style.top, 10);
		yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 56; // À§ÂÊ À§Ä¡
	}
	timeoutNextCheck = 40;

	if (yMenuFrom != yMenuTo) {
		yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
		if (yMenuTo < yMenuFrom)
			yOffset = -yOffset;
		if (isNS4)
			divMenu.top += yOffset;
		else if (isDOM)
			divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
			timeoutNextCheck = 10;
	}
	if(document.body.clientWidth <= 600){
		divMenu.style.left = "870px";
	} else {
//		divMenu.style.left = 600+((document.body.clientWidth - 600)/2) + "px";
		divMenu.style.left = "870px";
	}

	//alert("test : " + document.body.clientWidth);
	setTimeout ("moveRightEdge()", timeoutNextCheck);
}


//·¹ÀÌ¾î Æ÷Áö¼Ç
var m_loc = location.href;
var m_img_url = "";
if(m_loc.indexOf("https://") >=0){
	m_img_url = "https://image.interpark.com/image/top_small.gif";
}else{
	m_img_url = "http://image.bookpark.com/image/top_small.gif";
}
//site_posi="<div id='divMenu' style='position: absolute;visibility:visible;top:450px;'><a href='#' onfocus='this.blur();'><img src='"+m_img_url+"' border='0'></a></div>";

//[E]Top Button
function gotoURL( strURL )
{
	if ( strURL == "" ){
		history.back();
	} else {
		window.location = strURL;
	}
}
function gotoCookieURL( strCookName )
{
	var strURL = getCookie( strCookName );

	if ( strURL == "" ){
		history.back();
	} else {
		window.location = strURL;
	}
}

function gotoRegist( strRedirect ) {
	setCookie( 'cookRedirect', strRedirect );
	gotoURL('http://www.ggi1330.net/Member/TInformation/MemberRegist.aspx');
}

function doNOLoginModal(strMsg,strPath)
{
  var args = new Array();
  var winTitle = "Á¢±Ù±ÇÇÑ¿À·ù-GGI1330.";
  var strRefferer = window.location;
//  var strRefferer = "http://www.ggi1330.net/";
  
  strMsg = strMsg.replace("TAGLEFT;","<",strMsg);
  gtaDialog = window.showModalDialog("/Control/ModalMessage.aspx?postSection=loginerr&postURL=" + strRefferer + "&postPath=" + strPath + "&postMSG=" + strMsg + "&postTitle="+winTitle, args, "dialogWidth:360px; dialogHeight:240px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");

  gotoURL( gtaDialog );
}
function doLoginOKModal(strMsg,strPath)
{
  var args = new Array();
  var winTitle = "·Î±×ÀÎ¼º°ø-GGI1330.";
//  var strRefferer = window.location;
  var strRefferer = "http://www.ggi1330.net/";

  strMsg = strMsg.replace("TAGLEFT;","<",strMsg);
  gtaDialog = window.showModalDialog("/Control/ModalMessage.aspx?postSection=loginok&postURL=" + strRefferer + "&postPath=" + strPath + "&postMSG=" + strMsg + "&postTitle="+winTitle, args, "dialogWidth:360px; dialogHeight:240px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");

  gotoURL( gtaDialog );
}

function doAlertModal(strMsg,strPath)
{
  var args = new Array();
  var winTitle = "¿À·ù-GGI1330.";
//  var strRefferer = window.location;
  var strRefferer = "http://www.ggi1330.net/";

  strMsg = strMsg.replace("TAGLEFT;","<",strMsg);
  gtaDialog = window.showModalDialog("/Control/ModalMessage.aspx?postPath=" + strPath + "&postURL=" + strRefferer + "&postMSG=" + strMsg + "&postTitle="+winTitle, args, "dialogWidth:360px; dialogHeight:240px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;");

  gotoURL( gtaDialog );
}

// Äü¸Þ´º ÀÌµ¿ ½ºÅ©¸³Æ®
if (isNS4) {
	var divMenu = document["divQuickMenu"];
	if ( divMenu != null){
		divMenu.top = top.pageYOffset + 50;
		divMenu.visibility = "visible";
		moveRightEdge();
	}
} else if (isDOM) {
	var divMenu = getRef('divQuickMenu');
	if ( divMenu != null ){
		divMenu.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 150;
		divMenu.style.visibility = "visible";
		moveRightEdge();
	}
}

