<!--//

//Ä«Æä¶ç¿ì±â ÇÔ¼ö
function Cafe_Link(cafe_id){
	location.href = "/include/common/cafe_link.asp?url_id="+url_id
}

function popCafe(cafe_id){
	var win;
	win = window.open("","ktids","");
	win.location = "http://cafe.omykids.com/cafesite.asp?cafe_id="+cafe_id;
	if(win) win.focus();
}

function popCafe1(cafe_id, home_gubun){
//	openWinToolNoResizeNo("http://cafe.omykids.com/cafesite.asp?cafe_id="+cafe_id+"&home_gubun="+home_gubun, "cafesite", 915, 640)
/*
	var cafesite;
	cafesite = window.open("","cafesite","");
	cafesite.location = "<%=JOUNIORCAEFURL%>/cafesite.asp?cafe_id=" + cafe_id + "&home_gubun="+home_gubun;
	if(cafesite) cafesite.focus();
*/
	window.top.location.replace('http://cafe.omykids.com/?cafe_id='+cafe_id);

}

//Ä«Æä¶ç¿ì±â ÇÔ¼ö    KTIDS ¿¡¼­ ¾ÈµÊ.. È®ÀÎ¿ä..(ÀÏ´Ü ÀÌ·¸°Ô µ¹·Á³õÀ½)
//function Cafe_Link(url_id){
//	openWinToolYes("http://cafe1.omykids.com/"+url_id, "cafe_link", 300, 300) ;
//}

//·Î±×ÀÎ À¯Àú Ã¼Å©ÇÔ¼ö (front ÆäÀÌÁö¿¡¼­ ·Î±×ÀÎ ÇÊ¿äÇÒ½Ã)
function Check_User(userid){
	if (userid == "" ) {
		location.href = "/common/login_again.asp"
		return false;
	}
	return true;
}

function openWinToolYes(url, wname, w, h) {
   var win;
   win = window.open(url, wname, 'left=0,top=0,width=' + w + ',height=' + h + ',scrollbars=yes,resizable=yes,status=no,toolbar=yes,menubar=no');
}


function openWinToolNo(url, wname, w, h) {
   var win;
   win = window.open(url, wname, 'left=0,top=0,width=' + w + ',height=' + h + ',scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no');
}
function openWinToolNoScrollYes(url, wname, w, h) {
   var win;
   win = window.open(url, wname, 'left=0,top=0,width=' + w + ',height=' + h + ',scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no');
}

function openWinToolNoResizeNo(url, wname, w, h) {
   var win;
   win = window.open(url, wname, 'left=0,top=0,width=' + w + ',height=' + h + ',scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no');

	if (win)
		win.focus()
}

//¿ÀÁ÷ ¼ýÀÚ¸¸..
function onlyNumberInTextbox() {
   if ((event.keyCode>=48) && (event.keyCode <= 57))
      event.returnValue=true;
   else
      event.returnValue=false;
}

//¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÑ ÇÊµå¿¡ ¼ýÀÚ¿Ü¸¦ º¹»çÇØ¼­ ³Ö´Â°æ¿ì Ã¼Å©
function chkPatten(field){
	var regNum =/^[0-9]+$/;
	patten = eval(regNum);
	if(!patten.test(field.value)){
		alert("¼ýÀÚ¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä\n\n");
		field.value="";
		field.focus();
		return false;
	}
	return true;
}

//ÀüÈ­¹øÈ£ÀÇ °æ¿ì - ±îÁö
function onlyTelnumInTextbox() {
   if ( ((event.keyCode>=48) && (event.keyCode <= 57)) || event.keyCode==45 )
      event.returnValue=true;
   else
      event.returnValue=false;
}
function onlyIdtypeInTextbox() {
   if ((event.keyCode>=48) && (event.keyCode <= 57))
      event.returnValue=true;
   else if ((event.keyCode>=97) && (event.keyCode <= 122))
      event.returnValue=true;
   else if ((event.keyCode>=65) && (event.keyCode <= 90)) {
	event.keyCode = event.keyCode + 32;
      event.returnValue=true;
   }
   else
      event.returnValue=false;
}


function checkYYInputbox(theField) {
	if (theField.value.length != 0 && ( theField.value.length != 4 || !isStrNumeric(theField.value) ) ) {
		theField.focus();
		theField.select();
	}
}
function checkMMInputbox(theField) {
	var mmInt = str2plusInt(theField.value);

	if (theField.value.length == 0 ) return;

	if ( !isStrNumeric(theField.value) || mmInt < 1 || mmInt > 12  ) {
		theField.focus();
		theField.select();
	} else {
		if (mmInt < 10)
			theField.value = "0" + mmInt;
	}
}
function checkDDInputbox(yyField,mmField,theField) {
	var yyInt = str2plusInt(yyField.value);
	var mmInt = str2plusInt(mmField.value);
	var ddInt = str2plusInt(theField.value);

	if (theField.value.length == 0 ) return false;
	if (yyField.value.length == 0) {
		yyField.focus();
		theField.value = "";
		return false;
	}
	if (mmField.value.length == 0) {
		mmField.focus();
		theField.value = "";
		return false;
	}
	if ( !isStrNumeric(theField.value) || ddInt < 0 || ddInt > getLastDayOfMonth(yyInt,mmInt,ddInt)  ) {
		theField.focus();
		theField.select();
		return false;
	} else {
		if (ddInt < 10)
			theField.value = "0" + ddInt;
	}
	return true;
}

function fillInputboxWhenNull(theField, str) {
	if (theField.value.length == 0) {
		theField.value = str;
	}
}


function isStrNumeric(str) {
	for (var i = 0; i < str.length; i++) {
		if ( !isCharNumeric(str.substring(i, i+1) ) )
			return false;
	}
	return true;
}
function isCharNumeric(chr) {
	if (chr >= '0' && chr <= '9')
		return true;
	else
		return false;
}

function isCharAlphabet(chr) {
	if (chr.toLowerCase() >= 'a' && chr.toLowerCase() <= 'z')
		return true;
	else
		return false;
}


function isValidsIdPwd(str) {
//	if (!isCharAlphabet(str.substring(0, 1)) ) return false;
	for (var i = 0; i < str.length; i++) {
		if ( !isCharAlphabet(str.substring(i, i+1)) && !isCharNumeric(str.substring(i, i+1)) )
			return false;
	}
	return true;
}


function isValidTelnumber(str) {
	var validChar = 0;
	if (str.length < 9 ) return false;
	for (var i = 0; i < str.length; i++) {
		if ( isCharNumeric(str.substring(i, i+1)) || str.substring(i, i+1) == "-" )
			validChar++;
		else
			return false;
	}
	return true;
}


function isValidEmail(theField)
{
   var dotcount = 0;
   var doubledotcount = 0;
   var Atcount = 0;
   var invaliddotcount = 0;
   var foundSymbol = true;
   for (var i = 0;i<theField.value.length; i++) {
      var ch = theField.value.substring(i,i+1)
      if (ch == "@")
         Atcount = Atcount + 1;
      if (ch == ".") {
         dotcount = dotcount + 1;
         if (theField.value.substring(i+1,i+2) == ".")
            doubledotcount = doubledotcount +1;
      }
   }
   for (var j = 0;j<theField.value.length; j++) {
      var ch2 = theField.value.substring(j,j+1)
      if (ch2 == ",")
         invaliddotcount = invaliddotcount + 1;
      }
   if ((Atcount != 1) || (dotcount < 1) || (doubledotcount > 0) || (invaliddotcount != 0))
      foundSymbol = false;
   return foundSymbol;

}

// ³¯Â¥Çü½ÄÀÌ ¿Ã¹Ù¸¥Áö °Ë»ç
function isValidDate(strDate)
{

	var arrDate;
	var chkDate

	if (strDate.indexOf("-") != -1) {
		arrDate = strDate.split("-");
	}
	else {
		arrDate = strDate.split("/");
	}

	if (arrDate.length != 3) {
		return false;
	}

	chkDate = new Date(arrDate[0] + "/" + arrDate[1] + "/" + arrDate[2]);

	if (isNaN(chkDate) == true ||
		(arrDate[1] != chkDate.getMonth() + 1 || arrDate[2] != chkDate.getDate())) {
		return false;
	}

	return true;
}

function getByteLength(input) {
    var byteLength = 0;
    for (var inx = 0; inx < input.value.length; inx++) {
        var oneChar = escape(input.value.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;
}

function containsCharsOnly(input,chars) {
    for (var inx = 0; inx < input.value.length; inx++) {
       if (chars.indexOf(input.value.charAt(inx)) == -1)
           return false;
    }
    return true;
}

function isAlphabet(input) {
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    return containsCharsOnly(input,chars);
}

function isUpperCase(input) {
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¾ËÆÄºª ¼Ò¹®ÀÚÀÎÁö Ã¼Å©
 */
function isLowerCase(input) {
    var chars = "abcdefghijklmnopqrstuvwxyz";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ª¿¡ ¼ýÀÚ¸¸ ÀÖ´ÂÁö Ã¼Å©

 */
function isNumber(input) {
    var chars = "0123456789";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¾ËÆÄºª,¼ýÀÚ·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©

 */
function isAlphaNum(input) {
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¼ýÀÚ,´ë½Ã(-)·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
 */
function isNumDash(input) {
    var chars = "-0123456789";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¼ýÀÚ,ÄÞ¸¶(,)·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©

 */
function isNumComma(input) {
    var chars = ".,0123456789";
    return containsCharsOnly(input,chars);
}


// ¸®½ºÆ® È­¸é¿¡¼­ »èÁ¦, ¼öÁ¤½Ã ÇÊ¿ä
function checkAll(check1, check2) {
	var existobj = eval(check2);
	var	isChecked = check1.checked;

	if (existobj != null) {
		var lenobj = eval(check2.length);
		if(lenobj != null){
			for(var i = 0; i < check2.length; i++){
				check2[i].checked = isChecked;
			}
		}else{
				check2.checked = isChecked;
		}
	}
}

// ¸®½ºÆ® È­¸é¿¡¼­ »èÁ¦, ¼öÁ¤½Ã ÇÊ¿ä
function checkAllButton(chkFrm) {

	var existobj = eval(chkFrm);

	if (existobj != null) {
		var lenobj = eval(chkFrm.length);
		if(lenobj != null){
			for(var i = 0; i < chkFrm.length; i++){
				if(chkFrm[i].checked == true){
					chkFrm[i].checked = false;
				}else{
					chkFrm[i].checked = true;
				}
			}
		}else{
				if(chkFrm.checked == true){
					chkFrm.checked = false;
				}else{
					chkFrm.checked = true;
				}
		}
	}
}



// ¸®½ºÆ® È­¸é¿¡¼­ »èÁ¦, ¼öÁ¤½Ã ÇÊ¿ä
function isChecked() {
	var checkCnt = 0;

	if (f1.seq_no == null ) return false;
	var lenobj = eval(f1.seq_no.length);

	if (lenobj == null ) {
		if (f1.seq_no.checked == true)
			checkCnt++;
	}
	else {

		for(var i = 0; i< f1.seq_no.length; i++) {
			if (f1.seq_no[i].checked == true) {
				checkCnt++;
			}
		}
	}

	if (checkCnt == 0) return false;
	else return true;
}

// ¸®½ºÆ® È­¸é¿¡¼­ »èÁ¦, ¼öÁ¤½Ã ÇÊ¿ä
function isUpdateChecked() {
	var checkCnt = 0;

	for(var i = 0; i< f1.seq_no.length; i++) {
		if (f1.seq_no[i].checked == true) {
			checkCnt++;
		}
	}

	if (checkCnt > 1) return false;
	else return true;
}


//
function isCheckedValue(){

	var nValue;

	if (f1.seq_no == null ) return null;
		var lenobj = eval(f1.seq_no.length);

	if (lenobj == null ) {
		if (f1.seq_no.checked == true)
			nValue = f1.seq_no.value;
			return nValue;
	}
	else {

		for(var i = 0; i< f1.seq_no.length; i++) {
			if (f1.seq_no[i].checked == true) {
				nValue = f1.seq_no[i].value;
			}
		}

		return nValue;
	}
}


function isCheckbox(theField) {
	var checkCnt = 0;

	if (theField == null ) return false;
	var lenobj = eval(theField.length);

//	alert(theField.length);

	if (lenobj == null ) {
		if (theField.checked == true)
			checkCnt++;
	}
	else {

		for(var i = 0; i< theField.length; i++) {
			if (theField[i].checked == true) {
				checkCnt++;
			}
		}
	}

	if (checkCnt == 0) return false;
	else return true;
}


function isUpdateCheckbox(theField) {
	var checkCnt = 0;

	for(var i = 0; i< theField.length; i++) {
		if (theField[i].checked == true) {
			checkCnt++;
		}
	}

	if (checkCnt > 1) return false;
	else return true;
}

function CheckboxValue(theField){

	var nValue;

	if (theField == null ) return null;
		var lenobj = eval(theField.length);

	if (lenobj == null ) {
		if (theField.checked == true)
			nValue = theField.value;
			return nValue;
	}
	else {

		for(var i = 0; i< theField.length; i++) {
			if (theField[i].checked == true) {
				nValue = theField[i].value;
			}
		}

		return nValue;
	}
}

function SelectedValue(theChkField, theSelectField){

	var nValue;

	if (theChkField == null ) return null;
		var lenobj = eval(theChkField.length);

	if (lenobj == null ) {
		if (theChkField.checked == true)
			nValue = theSelectField.value;
			return nValue;
	}
	else {

		for(var i = 0; i< theChkField.length; i++) {
			if (theChkField[i].checked == true) {
				nValue = theSelectField[i].value;
			}
		}

		return nValue;
	}
}


function SelectedValue2(theChkField, theSelectField){

	var nValue;

	if (theChkField == null ) return null;
		var lenobj = eval(theChkField.length);

	if (lenobj == null ) {
		if (theChkField.selected == true)
			nValue = theSelectField.value;
			return nValue;
	}
	else {

		for(var i = 0; i< theChkField.length; i++) {
			if (theChkField[i].selected == true) {
				nValue = theSelectField[i].value;
			}
		}

		return nValue;
	}
}

//print
function Print_Click() {
	window.parent.print();
}

//javascript ¿¡¼­ ¿À´Ã ³¯Â¥ YYYY-MM-DD ·Î Ç¥½ÃÇÏ±â
function Now_Date(){

	var now = new Date()
	var year = now.getYear()
	var month = now.getMonth() + 1
	var date = now.getDate(), day

	if ( month < 10 )
	  month = "0"+month;

	if ( date < 10 )
	  date = "0"+date;

	var nowdate = year+"-"+month+"-"+date

return nowdate;

}

//javascript ¿¡¼­ ¿À´Ã ³¯Â¥ YYYYMMDD ·Î Ç¥½ÃÇÏ±â
function NowDate(){

	var now = new Date()
	var year = now.getYear()
	var month = now.getMonth() + 1
	var date = now.getDate(), day

	if ( month < 10 )
	  month = "0"+month;

	if ( date < 10 )
	  date = "0"+date;

	var nowdate = year+""+month+""+date

return nowdate;

}

//javascript ¿¡¼­ ¿À´Ã ³¯Â¥ YYYYMM ·Î Ç¥½ÃÇÏ±â
function Now_Month(){

	var now = new Date()
	var year = now.getYear()
	var month = now.getMonth() + 1

	if ( month < 10 )
	  month = "0"+month;

	var nowdate = year+""+month

return nowdate;

}

function replace(_text, _find, _rep) {
   var strText = "" + _text;
   var intPos;

   if (_find==_rep)
      return strText;

   while (strText.indexOf(_find)>-1) {
      intPos  = strText.indexOf(_find);
      strText = "" + (strText.substring(0, intPos) + _rep + strText.substring((intPos+_find.length), strText.length));
   }
   return strText;
}

function updateChar(length_limit, field)
{
	var Comment= "";
	Comment = eval("document.f1."+field+"");
	var form = document.f1;
	var length = calculate_msglen(Comment.value);
	textlimit.innerText = length;

	if (length > length_limit)
	{
		alert("ÃÖ´ë " + length_limit + "byteÀÌ¹Ç·Î ÃÊ°úµÈ ±ÛÀÚ¼ö´Â ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
		Comment.value = Comment.value.replace(/\r\n$/, "");
		Comment.value = assert_msglen(Comment.value, length_limit);
	}
}

function calculate_msglen(message)
{
	var nbytes = 0;
	for (i=0; i<message.length; i++)
	{
		var ch = message.charAt(i);
		if(escape(ch).length > 4)
		{
			nbytes += 2;
		}
		else if (ch == '\n')
		{
			if (message.charAt(i-1) != '\r')
			{
				nbytes += 1;
			}
		}
		else if (ch == '<' || ch == '>')
		{
			nbytes += 4;
		}
		else
		{
			nbytes += 1;
		}
	}
	return nbytes;
}

function assert_msglen(message, maximum)
{
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;
	for (i=0; i<msglen; i++)
	{
		var ch = message.charAt(i);
		if (escape(ch).length > 4)
		{
			inc = 2;
		}
		else if (ch == '\n')
		{
			if (message.charAt(i-1) != '\r')
			{
				inc = 1;
			}
		}
		else if (ch == '<' || ch == '>')
		{
			inc = 4;
		}
		else
		{
			inc = 1;
		}
		if ((nbytes + inc) > maximum)
		{
			break;
		}
		nbytes += inc;
		msg += ch;
	}
	textlimit.innerText = nbytes;
	return msg;
}

function ShowImg_Click(strImgFilePathNm){

	openWinToolNoResizeNo("/include/common/show_img.asp?img_path="+strImgFilePathNm,"ÀÌ¹ÌÁöº¸±â",200,200);
}

function Account_Select(){
	openWinToolNoResizeNo("/account/account_select.asp","°áÁ¦Ã¢",450,420);
}


	/**************************************************
	 *	URL ÀÌµ¿ - ÇöÀçÁÖ¼Ò°¡ histoty¿¡ ³²´Â´Ù
	 **************************************************/
	function moveUrl(url){
		document.location.href = url;
	}


	/**************************************************
	 *	ÀÏ¹ÝÀûÀ¸·Î ´Ü¼øÇÑ ÇÃ·¡½¬ ÀÏ °æ¿ì
		width : °¡·ÎÅ©±â
		height : ¼¼·ÎÅ©±â
		url : ÇÃ·¡½¬ ÆÄÀÏÀÇ °æ·Î
	 **************************************************/
	function swfView(width, height, url){
		document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ");
		document.write("		codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' ");
		document.write("		width='"+width+"' height='"+height+"' align='middle'>");
		document.write("	<param name='allowScriptAccess' value='sameDomain' /> ");
		document.write("	<param name='movie'				value='"+url+"' /> ");
		document.write("	<param name='quality'			value='high' /> ");
		document.write("	<param name='wmode'				value='transparent'> ");
		document.write("	<embed src='"+url+"' quality='high' width='"+width+"' height='"+height+"' align='middle' ");
		document.write("		allowScriptAccess='sameDomain' type='application/x-shockwave-flash' ");
		document.write("		pluginspage='http://www.macromedia.com/go/getflashplayer' />");
		document.write("</object>");
	}
//-->
