<!--
/**
 * (@)common.js
 * °øÅë ÀÚ¹Ù ½ºÅ©¸³Æ®
 *
 * @version	1.0, 2005-06-11
 * @Designer		¹Ú¼±ÇÏ
 * @programmer		±Çº´Áø(bubble74@empas.com)
*/
function fnOnLoad() {
	var BROWER_TITLE = "::: µµ¼­ÃâÆÇ ´ë¸² :::";
//	if (self == top) {
//		alert("º» ÆäÀÌÁö¿¡ Á÷Á¢ Á¢±Ù ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
//		top.location.replace ("../index.asp");
//	}
	try {
		if (PageTitle != "") {
			top.document.title = PageTitle + " " + BROWER_TITLE;
		}
	} catch (e) {
		top.document.title = BROWER_TITLE;
	}
}

function Home() {
	top.location.replace("../index.asp");
}

function fnReloadSelf() {
	var currentURL = window.document.URL;
	var queryString = (currentURL.indexOf("?"))>0? currentURL.substring(currentURL.indexOf("?")+1, currentURL.length) : "";
	var currentPath = window.document.location.pathname;
	if (queryString != "") {
		currentPath += "?" + queryString;
	}
	location.replace(currentPath);
}

function fnLinkOnline(goURL) {
	if (goURL != "") {
		oWindow = window.open (goURL,"","");
	}
}

function fnGoMenu(MenuID) {
	var goURL = "/";
	switch (MenuID)	{
		case "HOME":
			//¸ÞÀÎ(È¨)
			goURL = "../main/";
			break;
		case "AB01":
			//È¸»ç¼Ò°³ > È¸»ç°³¿ä
			goURL = "../about/about_01.asp";
			break;
		case "AB02":
			//È¸»ç¼Ò°³ > È¸»ç¿¬Çõ
			goURL = "../about/about_02.asp";
			break;
		case "AB03":
			//È¸»ç¼Ò°³ > À§Ä¡ ¹× ¿¬¶ôÃ³
			goURL = "../about/about_03.asp";
			break;
		case "BK01":
			//µµ¼­¾È³» > ½Å°£µµ¼­
			goURL = "../books/book_01.asp";
			break;
		case "BK02":
			//µµ¼­¾È³» > º£½ºÆ® ¼¿·¯
			goURL = "../books/book_02.asp";
			break;
		case "BK03":
			//µµ¼­¾È³» > ÃßÃµµµ¼­
			goURL = "../books/book_03.asp";
			break;
		case "BK04":
			//µµ¼­¾È³» > Ãâ°£¿¹Á¤ µµ¼­
			goURL = "../books/book_04_list.asp";
			break;
		case "MS01":
			//¸â¹ö½± > ±³¼ö´Ô
			goURL = "../membership/membership_03.asp";
			break;
		case "MS02":
			//¸â¹ö½± > °­ÀÇµµ¼­ ÁõÁ¤½ÅÃ»
			goURL = "../membership/membership_02.asp";
			break;
		case "MS03":
			//¸â¹ö½± > °­ÀÇ(P.T) ÀÚ·á
			goURL = "../membership/membership_01.asp";
			break;
		case "CU01":
			//°í°´¼¾ÅÍ > ÀÚÀ¯ °Ô½ÃÆÇ
			goURL = "../customer/freeboard.asp";
			break;
		case "CU02":
			//°í°´¼¾ÅÍ > ¹¯°í ´äÇÏ±â
			//goURL = "../customer/faq.asp";
			goURL = "../books/qna_list.asp";
			break;
		case "CU03":
			//°í°´¼¾ÅÍ > ¼Ò½º ÀÚ·á½Ç
			goURL = "../customer/bookboard.asp";
			break;
		case "CU04":
			//°í°´¼¾ÅÍ > ¿ÀÅ»ÀÚ
			goURL = "../customer/errorboard.asp";
			break;
		case "ET01":
			//ÀúÀÚ¸ðÁý
			goURL = "../etc/work.asp";
			break;
		case "ET02":
			//°³ÀÎÁ¤º¸ º¸È£ Á¤Ã¥
			goURL = "../etc/policy.asp";
			break;
		case "ET03":
			//ÀÌ¿ë¾à°ü
			goURL = "../etc/stipul.asp";
			break;
		case "ET04":
			//»çÀÌÆ® ¸Ê
			goURL = "../etc/map.asp";
			break;
		case "ET05":
			//ÀÌ¸ÞÀÏ ¹«´Ü ¼öÁý °ÅºÎ
			openWinCenter("../etc/email.asp","email","width=300, height=370")
			break;
	}
	if (MenuID != "ET05") {
		location.href = goURL;
	}
}
window.onLoad = fnOnLoad();

function fnViewImage(oImg){
	var imgURL = oImg.src;
	var x,y,w,h,loadingMsg;
	w = 300;
	h = 100;
	x = Math.floor( (screen.availWidth-(w+12))/2 );
	y = Math.floor( (screen.availHeight-(h+30))/2 );
	loadingMsg="<table width=100% height=100%><tr><td valign=center align=center><font size='2' color='#ff6600' face='termanal'>Now Loading...</font></td></tr></table>";
	with( window.open("","",'height=' + h + ',width=' + w + ',top=' + y + ',left=' + x + ',scrollbars=no,resizable=no') ) {
		document.write(
		"<html><head><title>Ç¥Áö È®´ë º¸±â</title></head><body style='margin:20px'>",
		loadingMsg,
		"<img src=\"" + imgURL + "\" width=358 height=436 hspace=0 vspace=0 border=0 style=\"border:1px solid #666666; filter:Alpha(opacity=85) progid:DXImageTransform.Microsoft.Shadow(color=#666666,strength=5,direction=125);\" onload=\"document.body.removeChild(document.body.children[0]);window.resizeTo(this.width+52,this.height+70);window.moveTo(Math.floor( (screen.availWidth-(this.width+12))/2),Math.floor( (screen.availHeight-(this.height+30))/2 ));\">",
		"</body></html>");
		focus();
	}
}

function fnViewImage2(imgURL){
	var x,y,w,h,loadingMsg;
	w = 300;
	h = 100;
	x = Math.floor( (screen.availWidth-(w+12))/2 );
	y = Math.floor( (screen.availHeight-(h+30))/2 );
	loadingMsg="<table width=100% height=100%><tr><td valign=center align=center><font size='2' color='#ff6600' face='termanal'>Now Loading...</font></td></tr></table>";
	with( window.open("","",'height=' + h + ',width=' + w + ',top=' + y + ',left=' + x + ',scrollbars=no,resizable=no') ) {
		document.write(
		"<html><head><title>Ç¥Áö È®´ë º¸±â</title></head><body style='margin:20px'>",
		loadingMsg,
		"<img src=\"" + imgURL + "\" hspace=0 vspace=0 border=0 style=\"border:1px solid #666666; filter:Alpha(opacity=85) progid:DXImageTransform.Microsoft.Shadow(color=#666666,strength=5,direction=125);\" onload=\"document.body.removeChild(document.body.children[0]);window.resizeTo(this.width+52,this.height+70);window.moveTo(Math.floor( (screen.availWidth-(this.width+12))/2),Math.floor( (screen.availHeight-(this.height+30))/2 ));\">",
		"</body></html>");
		focus();
	}
}


function openWinCenter(url, wname, wopt) {
	var newopt = "", wHeight = 0, wWidth = 0;
	if (wopt != undefined) {
		var woptlist = wopt.replace(/ /g, "").split(",");
		for (var i in woptlist) {
			if (woptlist[i].match(/^height=/i)) {
				wHeight = parseInt(woptlist[i].substr(7),10);
				if (!isNaN(wHeight)) newopt += "top=" + Math.floor((screen.availHeight - wHeight) / 2) + ",";
			}
			if (woptlist[i].match(/^width=/i)) {
				wWidth = parseInt(woptlist[i].substr(6),10);
				if (!isNaN(wWidth)) newopt += "left=" + Math.floor((screen.availWidth - wWidth) / 2) + ",";
			}
		}
	}
	return window.open(url, wname, newopt + wopt);
}

function fnDownload(formName) {
	var f=window.document.forms[formName];
	if (f.DownLoadFileName.value == ""){
		alert("ÆÄÀÏÀÌ ¾ø½À´Ï´Ù.");
	} else {
		//f.target = "down";
		//f.action = "../_include/download.asp";
		//oWin = openWinCenter ("","down","scrollbars=no,resizable=no,width=320,height=220");
		//f.action = "/new_20050605/_include/_download.asp";
		//f.submit();
		location.href = f.DownLoadFolder.value + f.DownLoadFileName.value;
	}
}

function fnViewBook(idx) {
    	location.href = "../books/view.asp?ISBN=" + idx;
}

function fnViewSeries(oSelect) {
	if ( oSelect.value != "" ) {
    	location.href = "../books/series.asp?series=" + oSelect.value;
	}
}
function setCookie (name, value, expires) {
	var cookieName	= name;
	var cookieValue	= value;
	var settingCookie = cookieName + "=" + escape (cookieValue) + "; path=/; expires=";
	if ( expires != "" ) {
		settingCookie += expires.toGMTString();
	}
	document.cookie = settingCookie;
}
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 "";
}
/**
 * Null Ã¼Å© ÇÔ¼ö (Null ÀÌ°Å³ª "" ÀÌ¸é true)
 */
function fnCheckNull(inputString) {
	if (inputString == null || inputString == "") {
		return true;
	}
	return false;
}

/**
 * Æ¯Á¤ ¹®ÀÚ¸¸À¸·Î ÀÌ·ç¾îÁø ÀÔ·ÂÀÎÁö Ã¼Å© ÇÔ¼ö
 */
function fnContainsCharsOnly(inputString,chars) {
	for (var inx = 0; inx < inputString.length; inx++) {
		if (chars.indexOf(inputString.charAt(inx)) == -1)
			return false;
	}
	return true;
}

/**
 * ¿µ¹® ´ë,¼Ò¹®ÀÚ ÀÌ¿ÜÀÇ ÀÔ·ÂÀÌ ÀÖ´ÂÁö Ã¼Å© ÇÔ¼ö
 */
function fnCheckAlpha(inputString) {
	var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	return fnContainsCharsOnly(inputString,chars);
}

/**
 * ¿µ¹® ´ë,¼Ò¹®ÀÚ,¼ýÀÚ ÀÌ¿ÜÀÇ ÀÔ·ÂÀÌ ÀÖ´ÂÁö Ã¼Å© ÇÔ¼ö
 */
function fnCheckAlphaNum(inputString) {
	var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	return fnContainsCharsOnly(inputString,chars);
}

/**
 * ¼ýÀÚ Ã¼Å© ÇÔ¼ö (¼ýÀÚ ÀÌ¿ÜÀÇ ¹®ÀÚ Æ÷ÇÔ½Ã false)
 */
function fnCheckNumber(inputString){
	var numPattern = /([^0-9])/;
	numPattern = inputString.match(numPattern);
	if(numPattern != null){
		return false;
	}
	return true;
}

/**
 * °ø¹é Ã¼Å© ÇÔ¼ö (°ø¹é Æ÷ÇÔ½Ã true)
 */
function fnCheckSpace(inputString){
	if (inputString.indexOf(" ")>=0) {
		return true;
	}
	return false;
}

/**
 * ÀÔ·Â°ªÀÇ ¹ÙÀÌÆ® ±æÀÌ ¹ÝÈ¯ ÇÔ¼ö (¿µ¹®¼ýÀÚ-1¹ÙÀÌÆ®, ÇÑ±Û-2¹ÙÀÌÆ®)
 */
function fnGetByteLength(inputString) {
	var byteLength = 0;
	for (var inx = 0; inx < inputString.length; inx++) {
		var oneChar = escape(inputString.charAt(inx));
		if ( oneChar.length == 1 ) {
			byteLength ++;
		} else if (oneChar.indexOf("%u") != -1) {
			byteLength += 2;
		} else if (oneChar.indexOf("%") != -1) {
			byteLength += oneChar.length/3;
		}
	}
	return byteLength;
}

/**
 * keyPress ÀÌº¥Æ®½Ã ÇÑ±Û ÀÌ¿ÜÀÇ Å°°¡ ´­·È´ÂÁö °Ë»ç
 */
function fnInputHangulOnly() {
	if((event.keyCode < 12592) || (event.keyCode > 12687)) {
		alert("ÇÑ±Û¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		event.returnValue = false;
		event.srcElement.focus();
	}
}

/**
 * ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å© ÇÔ¼ö (ÀÔ·Â°ª : nnnnnn-nnnnnnn)
 */
function fnCheckSN(SN) {
	var fmt = /^\d{6}-[1234]\d{6}$/;
	if (!fmt.test(SN)) {
		return false;
	}
	var birthYear = (SN.charAt(7) <= "2") ? "19" : "20";
	birthYear += SN.substr(0, 2);
	var birthMonth = SN.substr(2, 2) - 1;
	var birthDate = SN.substr(4, 2);
	var birth = new Date(birthYear, birthMonth, birthDate);
	if ( birth.getYear() % 100 != SN.substr(0, 2) || birth.getMonth() != birthMonth || birth.getDate() != birthDate) {
		return false;
	}
	var buf = new Array(13);
	for (var i = 0; i < 6; i++) buf[i] = parseInt(SN.charAt(i));
	for (var i = 6; i < 13; i++) buf[i] = parseInt(SN.charAt(i + 1));
	multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
	for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);
	if ((11 - (sum % 11)) % 10 != buf[12]) {
		return false;
	}
	return true;
}

/**
 * ÀÔ·ÂÇÑ Á¤±Ô½Ä°ú ÀÏÄ¡ÇÏ´Â Æ÷¸ËÀÎÁö Ã¼Å© ÇÔ¼ö
 */
function fnCheckFormat(inputString,format) {
	if (inputString.search(format) != -1) {
		return true;
	}
	return false;
}

/**
 * ¿Ã¹Ù¸¥ ÀÌ¸ÞÀÏ Çü½ÄÀÎÁö Ã¼Å© ÇÔ¼ö
 */
function fnCheckEmail(inputString) {
	var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
	return fnCheckFormat(inputString,format);
}

function fnReSizeFrame() {
	divContent=document.all? document.all.ContentFrame : document.getElementById("ContentFrame");

	divContent.style.top=0;
	divContent.style.left=0;

	iPageHeight=divContent.offsetHeight;
	iPageWidth=divContent.offsetWidth;
	
	if ( parent.document.all["frameBoard"] ) {
		parent.document.all["frameBoard"].height=iPageHeight;
		parent.document.all["frameBoard"].width=583;
	}
}
function fnSearchID() {
	oWin = window.open ("../membership/idsearch.asp","SearchID","width=450, height=262, resize=no");
	oWin.focus();
}
function fnSearchPwd() {
	oWin = window.open ("../membership/pwsearch.asp","SearchPwd","width=450, height=313, resize=no");
	oWin.focus();
}
//-->
