	

if (document.all) {
} 
else alert("[°æ°í] º» »çÀÌÆ®´Â ÀÎÅÍ³ÝÀÍ½ºÇÃ·Î·¯ Àü¿ëÀÔ´Ï´Ù.");
//============================================
// µ¿È­³ª¶ó ÆË¾÷.
//============================================
function openDongWha(status) {
    if (status == "Y") {
        window.open('about:blank', 'edumoaWin', 'height=870,width=1080,status=yes,toolbar=no,menubar=no,location=no,top=0,left=0', false);

        // referer ¸¦ À§ÇØ form.submit() À¸·Î Ã³¸®ÇÔ
        var f = document.createElement('FORM');
        f.action = 'http://static.edumoa.com/study/storyhouse_provider/index.html';
        //f.action = '/c_lib/getparam.asp';

        try {
            var inputEl = document.createElement("INPUT");
            inputEl.type = 'hidden';
            inputEl.name = 'sp_secure_id';
            inputEl.value = '95ea914529e570659251ced95706722f';
        }
        catch (e) { // IE
            var inputEl = document.createElement("<input type='hidden' name='sp_secure_id' value='95ea914529e570659251ced95706722f'/>");
        }

        f.appendChild(inputEl);
        f.target = 'edumoaWin';
        document.body.appendChild(f);
        f.submit();
        return;
    }
    else {
        //alert("·Î±×ÀÎ ÈÄ ÀÌ¿ë °¡´ÉÇÕ´Ï´Ù.");
        document.location = "/login.asp";
        return;
    }
}

//============================================
// String Trim
//============================================
function Trim(source)
{
	var i, j, k;
	var dest = "";
	
	if(source == '') return '';
	
	for(i=0; i<source.length; i++)
	{
	if(source.charAt(i)!=' ' && source.charAt(i)!='\t' && source.charAt(i)!='\n')
	break;
	}
	
	for(j=source.length-1; j>=0; j--)
	{
	if(source.charAt(j)!=' ' && source.charAt(j)!='\t' && source.charAt(j)!='\n')
	break;
	}
	
	if( i > j ) 
	return "";
	
	dest = source.substring(i,j+1);
	
	return dest;
}


//===========================================================
//======    name check function (ÇÑ±Û¸¸ »ç¿ë°¡´É)    ========
//===========================================================	
function IsName(formname) {
	
	var form = formname;
   
	//if(form.length < 2 || form.length > 4) {
	//	return false;
	//}
	
	for (i = 0; i < form.length; i++) {
		var Codenum = form.charCodeAt(i);
		if(Codenum<128){
			return false;
		}	
	}
	return true;
}


//function hcheck {
//  for (i = 0; i < x.hname.value.length; i++) 
//  {
//    var CodeNum = x.hname.value.charCodeAt ;
//    if (CodeNum < 128) {
//    alert("ÇÑ±Û·Î ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.");
//    x.hname.value="";
//    x.hname.focus();
//    return;
//    }
//  }
//alert("Àß ÀÔ·ÂÇÏ¼Ì½À´Ï´Ù.")
//}


//===========================================================
//========= ¾ÆÀÌµð Ã¼Å©
//===========================================================	
function IsID(formname) {
	
   	var form = formname;
   	/*
	if(form.value.length < 4 || form.value.length > 12) {
		return false;
	}
	*/
	for(var i = 0; i < form.value.length; i++) {
		var chr = form.value.substr(i,1);  
		if(chr == "'") {
			return false;
		}
	}
	return true;  
}

//===========================================================
//========= È¸¿ø°¡ÀÔ½Ã ¾ÆÀÌµð Ã¼Å©
//===========================================================	
function IsID_Make(formname) {
   	var form = formname;
   	var pattern = /[^A-Za-z0-9_]/ ; 
	if(form.value.length < 4 || form.value.length > 12) {
		return false;
	}
    if (pattern.test(form.value)) 
    {
        return false 	
    }
	return true ;
}


function IsID_ils(formname) {
	var form = eval("document.idform." + formname);
   
	if(form.value.length < 4 || form.value.length > 12) {
		return false;
	}
	for(var i = 0; i < form.value.length; i++) {
		var chr = form.value.substr(i,1);         
		if((chr < '0' || chr > '9') && (chr < 'a' || chr > 'z') && (chr < 'A' || chr > 'Z') && (chr != '-')) {
			return false;
		}
	}
	return true;   
}





//===========================================================
//========= id( ¿¹Àü ¾ÆÀÌµð º¯°æ±ÇÀå Ã¼Å©
//===========================================================
function Back_ID(formname) {
	var form = eval("document.bookform." + formname);
	
	for(var i = 0; i < form.value.length; i++) {
		var chr = form.value.substr(i,1);         
		if(chr == '_') {
			return false;
		}
	}
	return true;   
}

function IsPW(formname) {
	var form = eval("document.bookform." + formname);
	
	if(form.value.length < 4 || form.value.length > 12) {
		return false;
	}
	for(var i = 0; i < form.value.length; i++) {
		var chr = form.value.substr(i,1);         
		if((chr < '0' || chr > '9') && (chr < 'a' || chr > 'z') && (chr < 'A' || chr > 'Z')) {
			return false;
		}
	}
	return true;   
}

function IsPW_ils(formname) {
	var form = eval("document.ilsform." + formname);
	
	if(form.value.length < 4 || form.value.length > 12) {
		return false;
	}
	for(var i = 0; i < form.value.length; i++) {
		var chr = form.value.substr(i,1);         
		if((chr < '0' || chr > '9') && (chr < 'a' || chr > 'z') && (chr < 'A' || chr > 'Z')) {
			return false;
		}
	}
	return true;   
}

//===========================================================
//========= child id check function          ==================
//===========================================================	
function C_IsID(formname) {
	var form = eval("document.bookform." + formname);
   
	if(form.value.length < 3 || form.value.length > 12) {
		return false;
	}
	for(var i = 0; i < form.value.length; i++) {
		var chr = form.value.substr(i,1);         
		if((chr < '0' || chr > '9') && (chr < 'a' || chr > 'z') && (chr < 'A' || chr > 'Z') && (chr != "-")) {
			return false;
		}
	}
	return true;   
}

//===== ¼ýÀÚ ¿©ºÎ È®ÀÎ
function validatenum(val) 
{
	
	
   for (var i = 0; i < val.length; i++) 
   {   
	if ((val.charAt(i) < "0" || val.charAt(i) > "9") &&( val.charAt(i) != "." ) )
	{
			return false;
	}
   }
   return true;
}


function Sex_chk(theform) {
	if(theform.ssn_2.value == "") {
		return;
	}
	var ssn_chk = theform.ssn_2.value.substr(0,1);
	
	if(ssn_chk == "1" || ssn_chk == "3") {
		theform.sex[0].checked = true;
		return;
	}else if(ssn_chk == "2" || ssn_chk == "4") {
		theform.sex[1].checked = true;
		return;
	}else {
		theform.sex[0].checked = true;
		return;
	}
	
}

//ÀÌ¸ÞÀÏ Ã¼Å©
function email_CHK(emailad) { 
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/; 
	var check=/@[\w\-]+\./; 
	var checkend=/\.[a-zA-Z]{2,3}$/; 

   if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){ 
	   return false; 
   }else { 
  		return true;
   } 
} 

//===========================================================
//======== ÁÖ¹Î¹øÈ£ Ã¼Å©
//===========================================================
function Jumin_chk(reg_no)
{
	buf = new Array(13);
	for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i));	
    
	// buf[6]=="9" || buf[6]=="0" =>¿Ü±¹ÀÎ(1800³â´ë)
	// buf[6]=="5" || buf[6]=="6" =>¿Ü±¹ÀÎ(1900³â´ë)
	// buf[6]=="7" || buf[6]=="8" =>¿Ü±¹ÀÎ(2000³â´ë)
			
	if ((buf[6] == "5")||(buf[6] == "6")||(buf[6] == "7")||(buf[6] == "8")||(buf[6] =="9")||(buf[6] == "0")) 
	{
	 	Chk_Fgn_chk(reg_no);
	}else 
	{
		if (reg_no == "1111111111118") return true;	
		IDtot = 0;
		IDAdd = "234567892345";
		for(i=0; i<12; i++) 
		IDtot = IDtot + parseInt(reg_no.substring(i, i+1)) * parseInt(IDAdd.substring(i, i+1));
		IDtot = 11 - (IDtot%11);
		if (IDtot == 10) IDtot = 0;
		else if (IDtot == 11) IDtot = 1;
		if(parseInt(reg_no.substring(12, 13)) != IDtot) 
			return true;
	}
} 



//=====================================
//¿Ü±¹ÀÎ ÁÖ¹Î¹øÈ£ Ã¼Å©
//=====================================
function Chk_Fgn_chk(reg_no) {
	var sum = 0;
	var odd = 0;
	
	buf = new Array(13);
	for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i));
	
	odd = buf[7]*10 + buf[8];
	
	if (odd%2 != 0) {
	  return true;
	}
		
	if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) {
	  return true;
	}
		
	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]);
	
	
	sum=11-(sum%11);
	
	if (sum>=10) sum-=10;
	
	sum += 2;
	
	if (sum>=10) sum-=10;
	
	if ( sum != buf[12]) {
	    return true;
	}
	else {
	    return false;
	}
}






//½ºÆäÀÌ½º Ã¼Å© ÇÔ¼ö
function CheckSpaces(strValue) {
	var flag=true;

	if (strValue!="") {
		for (var i=0; i < strValue.length; i++) {
			if (strValue.charAt(i) != " ") {
				flag=false;
				break;
			}
		}
	}
	return flag;
}


//============================================
// ÇÊ¼öÀÔ·Â Ã¼Å© ¹× ±æÀÌ Ã¼Å© ÇÔ¼ö 
//		CheckSpaces();
//		¼º°øÇÏ¹® true ½ÇÆÐÇÏ¹® alert() ¶ç¿ì°í return false
//============================================
function chk_len(theitem, maxlength, strTitle)
{
	var tmpStr;;
	tmpStr = theitem.value;
	
	if (CheckSpaces(tmpStr))
	{{
		alert(strTitle + 'À»(¸¦) ÀÔ·ÂÇÏ¼¼¿ä.');
		theitem.value = '';
		theitem.focus();
		return false;
	}}
	
	return cal_len(theitem, tmpStr, maxlength, strTitle);
	
}

//============================================
// ¹ÌÇÊ¼öÀÔ·Â ±æÀÌ Ã¼Å© ÇÔ¼ö
//============================================
function unfinChk_len(theitem, maxlength, strTitle)
{
	var tmpStr;
	tmpStr = theitem.value;
	
	return cal_len(theitem, tmpStr, maxlength, strTitle);
}


//============================================
// ±æÀÌ Ã¼Å© ÇÔ¼ö 
//============================================
function cal_len(theform,str,maxlength, strTitle) 
{
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;
	 
	tmpStr = new String(str);
	temp = tmpStr.length;

	for (k=0;k<temp;k++)
	{
		onechar = tmpStr.charAt(k);

		if (escape(onechar).length > 4) {
			tcount += 2;
			max_char=maxlength/2; 
		}
		else if (onechar!='\r') {
			tcount++;
			max_char=maxlength; 			
		}
	}
	
	if(tcount>maxlength) {
		reserve = tcount-maxlength;
		alert(strTitle + "Àº(´Â) " + max_char+"ÀÚ ÀÌ»ó ÀÔ·ÂÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.\nÇÑ±ÛÀº 2ÀÚ·Î °è»êµË´Ï´Ù."); 
		
		cutText(theform,str,maxlength);
		theform.select();
		theform.focus();
		return false;
	}
	return true;
}



function cutText(theform,str,maxlength)
{
	nets_check(theform,theform.value,maxlength);
}

function nets_check(theform,aquery,max)
{
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;
	 
	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for(k=0;k<temp;k++)
	{
		onechar = tmpStr.charAt(k);
		
		if(escape(onechar).length > 4) {
			tcount += 2;
		}
		else if(onechar!='\r') {
			tcount++;
		}
		if(tcount>max) {
			tmpStr = tmpStr.substring(0,k);			
			break;
		}
	}
	
	if (max == max) {
		theform.value = tmpStr;
		cal_len(theform,tmpStr,max);
	}
	
	return tmpStr;
}

	
	
	//	===============================================================================================================
	//	form³»ÀÇ ¸ðµç textbox ¿¡´ëÇÑ Æ¯¼ö¹®ÀÚ °É·¯³»±â.
	//
	//		theform : °Ë»öÇÒ Æû 		
	//		spcchar : °É·¯³¾ ¹®ÀÚµé
	//		return type : boolean
	//		ÇÔ¼ö ¹®ÀÇ ===> Àß¸ð¸£°ÚÀ¸¹®...... ±è¿µÃ¶ ¤¾¤¾
	//		
	//		ex) /member/mem001_1.jsp ¿¡ ÀÖÀ½. 
	//			document.bookform ÀÇ ¸ðµç textbox ¿¡¼­ [:*&%$#]À» °É·¯³»°í ½ÍÀ»¶§
	//		if (!ex) TextBox_SpcChar(document.bookform, "::*&%$#");)
	//		{
	//			return;	
	//		}
	//	===============================================================================================================
	function TextBox_SpcChar(theform, spcchar)
	{
		if (typeof(theform) != "object")
		{
			alert("°Ë»öÇÒ FormNameÀÌ ºÎÁ¤È®ÇÕ´Ï´Ù.");
			return false;
		}
		
		if (spcchar.length < 1 || spcchar == "")
		{
			alert("°Ë»öÇÒ Æ¯¼ö¹®ÀÚ°¡ ºÎÁ¤È®ÇÕ´Ï´Ù.");
			return false;
		}
				
		for (var i = 0; i < theform.elements.length; i++)
		{
			if ( typeof (theform.elements[i]) == "object" ) 
			{
				if ( theform.elements[i].type == "text" ) //text box
				{	
					for (var k = 0; k < spcchar.length; k++)
					{
						if ( (theform.elements[i].value).indexOf(spcchar.charAt(k)) > -1 )
						{
							alert("[ " + spcchar.charAt(k) + " ] \n\nÀ§ ¹®ÀÚ´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
							theform.elements[i].focus();
							return false;
						}
					}
					
				}
			}	
		}
		return true;	
	}	




// ÀÌ¸ÞÀÏ ÆË¾÷
function Pop_email(mail_to_name, mail_to_email) {
	var window_left = (screen.width-640)/2;
	var window_top = (screen.height-480)/2;
	var ref = "http://www.ibookland.com/cts/pop_mail/mail0403.asp?mail_to_name=" + mail_to_name + "&mail_to_email=" + mail_to_email;
	window.open(ref,"popup",'width=400,height=380,scrollbars=yes,status=no,top=' + window_top + ',left=' + window_left + '');
}


// ÆË¾÷ÆäÀÌÁö
function POP_UP(page, width, height, scroll, status, top, left) {
	var window_left = (screen.width-640)/2;
	var window_top = (screen.height-480)/2;

	if(page=="" || width=="" || height=="" ){
		alert("ÇÊ¿äÇÑ ÀÎÀÚ°¡ ºÎÁ·ÇÕ´Ï´Ù.(page,width, height)");
		return;
	}
	if(top == "" || left == "" ){
		top ="0";
		left ="0";
	}

	window.open(page,"popup",'width=' + width + ',height=' + height + ',scrollbars=' + scroll + ',status=' + status + ',top=' + top + ',left=' + left + '');
}


function Go_PageURL(go_url)
{
	this.location.href=go_url;
	return;
}


//=========================================================
//	pop menu °ü·Ã function 
//	webjesus 
//	2002-08-27 4:37¿ÀÈÄ
//=========================================================
	var menuskin = "skin1";
	var display_url = 0;
	

	function showmenu_pop()
	{
		var rightedge = document.body.clientWidth-event.clientX;
		var bottomedge = document.body.clientHeight-event.clientY;
		
		if (rightedge < pop_menu.offsetWidth)
		{
			pop_menu.style.left = document.body.scrollLeft + event.clientX - pop_menu.offsetWidth;
		}else
		{
			pop_menu.style.left = document.body.scrollLeft + event.clientX;
		}
		
		if (bottomedge < pop_menu.offsetHeight)
		{
			pop_menu.style.top = document.body.scrollTop + event.clientY - pop_menu.offsetHeight;
		}else
		{
			pop_menu.style.top = document.body.scrollTop + event.clientY;
		}
		pop_menu.style.visibility = "visible";
		return false;
	}
	
	function hidemenu_pop()
	{
		pop_menu.style.visibility = "hidden";
		return false;
	}
	
	function highlight_pop()
	{
		if (event.srcElement.className == "menuitems")
		{
			event.srcElement.style.backgroundColor = "highlight";
			event.srcElement.style.color = "#FFEA00";
			if (display_url)
				window.status = event.srcElement.url;
		}
	}
	
	function lowlight_pop()
	{
		if (event.srcElement.className == "menuitems")
		{
			event.srcElement.style.backgroundColor = "";
			event.srcElement.style.color = "black";
			window.status = "";
		}
	}
	
	function jumpto_pop()
	{
		if (event.srcElement.className == "menuitems")
		{
			if (event.srcElement.getAttribute("target") != null)
				window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
			else
				window.location = event.srcElement.url;	
		}
	}
	
//===================================================================	
	
	function showmenu_pop2(pop_name)
	{
		var rightedge = document.body.clientWidth-event.clientX;
		var bottomedge = document.body.clientHeight-event.clientY;
		
		if (rightedge < (eval(pop_name+".offsetWidth")) )
		{
			eval(pop_name).style.left = document.body.scrollLeft + event.clientX - eval(pop_name).offsetWidth;
		}else
		{
			eval(pop_name).style.left = document.body.scrollLeft + event.clientX;
		}
		
		
		
		
		if (bottomedge < (eval(pop_name+".offsetHeight")) )
		{	
			eval(pop_name).style.top = document.body.scrollTop + event.clientY - eval(pop_name).offsetHeight;
		}else
		{
			eval(pop_name).style.top = document.body.scrollTop + event.clientY;
		}
		
		eval(pop_name).style.visibility = "visible";
		
		return false;
	}
	
	function hidemenu_pop2(pop_name)
	{
		eval(pop_name).style.visibility = "hidden";
		return false;
	}
	
	function hidemenu_pop3(pop_name)
	{		
		c_pop_menu1.style.visibility = "hidden";
		c_pop_menu2.style.visibility = "hidden";
		c_pop_menu3.style.visibility = "hidden";
		c_pop_menu4.style.visibility = "hidden";
		s_pop_menu1.style.visibility = "hidden";
		s_pop_menu2.style.visibility = "hidden";
		s_pop_menu3.style.visibility = "hidden";
		s_pop_menu4.style.visibility = "hidden";
		return false;
	}
//=========================================================
	
	//=============
	//¸®µù°¡ÀÌµåº¸±â
	//============
	function readingguide_pop(value1, value2)
	{	
		window.open("/cts/myibook/mybook_reading_popup.asp?READING_MAIL=&P_GOODS_CD_NO="+value1+"&P_GOODS_CD_DITC="+value2,"","width=620,height=600,scrollbars=yes,status=yes,top=0,left=0")
    }

    //=============
    //±³°úÇÊµ¶ÇÁ·Î±×·¥ ¸Àº¸±â ÆË¾÷
    //============
    function openExample(key) {
        //showModalPop(sURL, sFeatures, debug)
        window.open("/cts/book/book_han/sample/sampleBookInfo.asp?goods_cd_no="+key, "example", "width=730,height=830,scrollbars=yes");
        return;
    }
