

//-------------------------------------------------------------------
// ´ÙÀ½ °´Ã¼·Î ÀÌµ¿ÇÏ´Â ÇÔ¼ö
//-------------------------------------------------------------------
function move_next(now_obj, next_obj, str_length){

	var str =  String(now_obj.value);
	if (str.length == str_length){
		next_obj.focus();
	}
}

//-------------------------------------------------------------------
// ¼ýÀÚÀÎ°¡¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö (ÁÖ¹Î¹øÈ£¿ë)
//-------------------------------------------------------------------
function is_int(value) {
	var _intValue   = '0123456789';
    var   j;
    for(j=0;j<_intValue.length;j++)
        if(value == _intValue.charAt(j)) {
            return true;
        }
    return false;
}

//-------------------------------------------------------------------
// ¼ýÀÚÀÎ°¡¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö(ÀüÈ­¹øÈ£¿ë)
//-------------------------------------------------------------------
function is_num(value) {
	var	_checkNumValue   = '0123456789-';
    var   j;
    for(j=0;j<_checkNumValue.length;j++)
        if(value == _checkNumValue.charAt(j)) {
            return true;
        }
    return false;
}

//-------------------------------------------------------------------
// ¼ýÀÚÀÎ°¡¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö 
//-------------------------------------------------------------------
function check_number(num)
{
    var    i;
    for(i=0;i<num.length;i++)
	{
        if(!is_num(num.charAt(i)))
            return false;
	}
    return true;
}

//-------------------------------------------------------------------
// ¼ýÀÚ·Î ±¸¼ºµÈ ¹®ÀÚ¿­ÀÎ°¡¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö 
//-------------------------------------------------------------------
function check_digit(num)
{
    var    i;
    var    str =  num;
    for(i=0;i<str.length;i++){
        if(!is_int(str.charAt(i)))           
        {
            return false;
        }
	}
    return true;
}

//-------------------------------------------------------------------
// ¸¶Áö¸·³¯ À¯È¿¼º °Ë»ç
//-------------------------------------------------------------------
function lastday(calyear,calmonth)
{
	var dayOfMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    if (((calyear %4 == 0) && (calyear % 100 != 0))||(calyear % 400 == 0))
        dayOfMonth[1] = 29;
    else
        dayOfMonth[1] = 28;
    var nDays = dayOfMonth[calmonth-1];
    return nDays;
}

//-------------------------------------------------------------------
// ÁÖ¹Îµî·Ï ¹øÈ£¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö
//-------------------------------------------------------------------
function is_resno(res_no){
	var str =  res_no;
	var str2 = '';
	var isNum = true;
	var ll_resno = 0 ;
	var ll_temp = 0 ;

	if (str.length != 13) return false;
	if (!check_digit(str))	return false;

	if ( parseInt(str.substring(6,7),10) == 1 || parseInt(str.substring(6,7),10) == 2 )
		str2 = str2 + "19";
	else
		str2 = str2 + "20";

	str2 = str2 + str.substring(0,6);

    var t_year  = parseInt(str2.substring(0,4),10);
    var t_month = parseInt(str2.substring(4,6),10);
    var t_day   = parseInt(str2.substring(6,8),10);

    if (t_year < 1900 || t_year >2100)
        return false;

    if (t_month <1 || t_month > 12)
        return false;

	if (t_day <1 || t_day > lastday(t_year, t_month))
        return false;


 	ll_resno = ll_resno + parseInt(str.substring(0,1),10) * 9 ;
 	ll_resno = ll_resno + parseInt(str.substring(1,2),10) * 8 ;
 	ll_resno = ll_resno + parseInt(str.substring(2,3),10) * 7 ;
 	ll_resno = ll_resno + parseInt(str.substring(3,4),10) * 6 ;
 	ll_resno = ll_resno + parseInt(str.substring(4,5),10) * 5 ;
 	ll_resno = ll_resno + parseInt(str.substring(5,6),10) * 4 ;
 	ll_resno = ll_resno + parseInt(str.substring(6,7),10) * 3 ;
 	ll_resno = ll_resno + parseInt(str.substring(7,8),10) * 2 ;
 	ll_resno = ll_resno + parseInt(str.substring(8,9),10) * 9 ;
 	ll_resno = ll_resno + parseInt(str.substring(9,10),10) * 8 ;
 	ll_resno = ll_resno + parseInt(str.substring(10,11),10) * 7 ;
 	ll_resno = ll_resno + parseInt(str.substring(11,12),10) * 6 ;
 	ll_temp = ll_resno % 11 ;
 	if (ll_temp == 0 ) ll_temp = 1 ;
 	if (ll_temp == 10 ) ll_temp = 0;
 	if (ll_temp != parseInt(str.substring(12,13),10)) return false;
 	return true ;
}

//-------------------------------------------------------------------
// E-Mail Çü½Ä Ã¼Å©ÇÏ±â
//-------------------------------------------------------------------
function is_email(val)
{
	var s =  val;

	if ( s == "" || s == null) 
	{ 		
	    return false;
	}    
	else
	{			
		var i = 1;
		var sLength = s.length;
		
		while ((i < sLength) && (s.charAt(i) != "@"))
		{
			i++
		}
		
		if ((i >= sLength) || (s.charAt(i) != "@"))
		{		    
		    return false;
		}
		else i += 2;
		
		while ((i < sLength) && (s.charAt(i) != "."))
		{
			i++
		}
		
		if ((i >= sLength - 1) || (s.charAt(i) != "."))
		{		 
		    return false;
		}
		else return true;
	}
}

//-------------------------------------------------------------------
// select ¿¡¼­ options[i].value °¡ value ÀÎ options¿¡ selected ¸¸µé±â
//-------------------------------------------------------------------
function selectSelectBox(object, value)
{
	for (var i = 0; i < object.length; i ++)
	{
		if (object[i].value == value)
		{
			object[i].selected = true;
			break;
		}
	}
	return;
}

//-------------------------------------------------------------------
// radio ¿¡¼­ object[i].value °¡ value ÀÎ object¿¡ check
//-------------------------------------------------------------------
function checkRadio(object, value)
{		
	for (var i = 0; i < object.length; i ++)
	{
		if (object[i].value == value)
		{
			object[i].checked = true;
			break;
		}
	}
	return;
}

//-------------------------------------------------------------------
// byte·Î text ±æÀÌ¸¦ ¸®ÅÏÇÏ´Â Æã¼Ç
//-------------------------------------------------------------------
function getLength(str)
{
	var strLength   = 0;
	var len = 0;

	strLength = str.length;

	for(var i = 0; i < strLength; i++)
	{
		//2byteÀÎ °æ¿ì 2 Áõ°¡
		if(escape(str.charAt(i)).substring(0, 2) == "%u")
		{
				len += 2;
		}
		//¿£ÅÍ°ª : %0D + %0A
		//ÇÑ¹ø¸¸ Áõ°¡
		else if(escape(str.charAt(i)) != "%0A")
		{
				len++;
		}
	}

	return len;
}

//-------------------------------------------------------------------
// bytelength(form,value,mxlen)
//-------------------------------------------------------------------
function bytelength(fe,bstr,mx)
{
	len = bstr.length;
	for (ii=0; ii<bstr.length; ii++)
	{
		
		xx = bstr.substr(ii,1).charCodeAt(0);
		
		if (xx > 127) { len++; }
	}

	// Å¬°æ¿ì ¸Þ½ÃÁö »Ñ¸®±â
	if (mx < len){
		alert('ÀÔ·ÂÇÑ ±ÛÀÌ ±æ¾î¼­ Àß¸±¼ö ÀÖ½À´Ï´Ù.\n ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä'+len);
		fe.focus();
		fe.select();
	}
	return len;
}

//-------------------------------------------------------------------
// selectbox ¿¡ optionÀ¸·Î ³¯Â¥¸¦ »ý¼º
//-------------------------------------------------------------------
function setOptions(obj, val)
{
	object = eval(obj);		
	while(object.length > 0)
	{
		object[object.length - 1] = null;
	}

	object[0] = new Option('-ÀÏ-', '-1', false, false);

	for (var i = 0 + 1; i < val + 1; i ++)
	{
		if(i<10)
		{				
			eval("object["+i+"] = new Option('0" + i + "ÀÏ', '"+"0" + i + "', false, false);");			
		}
		else
			eval("object["+i+"] = new Option('" + i + "ÀÏ', '" + i + "', false, false);");
	}
}

//-------------------------------------------------------------------
// ³¯Â¥¸¦ ¿ù´ë·Î ³ª¿À°Ô ÇÏ±â À§ÇÑ Æã¼Ç
//-------------------------------------------------------------------
function dayList(form,val,obj)
{		
	if(val == '1' || val == '3' || val== '5' || val== '7' || val== '8' || val== '10' || val== '12')
	{
		setOptions(obj, 31);
	}
	else if (val == '2')
	{
		setOptions(obj, 29);
	}
	else
	{
		setOptions(obj, 30);
	}		
}

//-------------------------------------------------------------------
// ³¯Â¥¸¦ ¿ù´ë·Î ³ª¿À°Ô ÇÏ±â À§ÇÑ Æã¼Ç2
//-------------------------------------------------------------------
function dayList2(form, year, month, obj)
{		
	var lastday = getLastDay(year, month);
	setOptions(obj, lastday);
}

//-------------------------------------------------------------------
// ¸¶Áö¸· ³¯Â¥ ¸®ÅÏ
//-------------------------------------------------------------------
function getLastDay(calyear, calmonth)
{
	var dayOfMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	if (((calyear %4 == 0) && (calyear % 100 != 0))||(calyear % 400 == 0))
		dayOfMonth[1] = 29;
	else
		dayOfMonth[1] = 28;
	var nDays = dayOfMonth[calmonth-1];
	return nDays;
}

//-------------------------------------------------------------------
// Ã¼Å©¹Ú½º¸¦ ÀüºÎ Ã¼Å©
//-------------------------------------------------------------------
function checkAll(form, obj, value)
{		
	if(value.checked == true)
	{
		clearAll(form, obj);
		if (obj.type == 'checkbox')
		{				
			obj.checked = 1;
		}
		else
		{
			for(x=0;x<obj.length;x++)
				obj[x].checked = 1;
		}
	}
	else
		clearAll(form, obj);
}

//-------------------------------------------------------------------
// Ã¼Å©¹Ú½º¸¦ ÀüºÎ Ã¼Å©¾ÈÇÔ
//-------------------------------------------------------------------
function clearAll(form, obj)
{
	if (obj.type == 'checkbox')
	{
		obj.checked = 0;
	}
	else
	{
		for(x=0 ;x<obj.length;x++)
		{
			if(obj[x].checked == true)
				obj[x].checked = 0;
		}
	}
}

//-------------------------------------------------------------------
// selectbox¿¡ option »ý¼º val
//-------------------------------------------------------------------
function setOption(obj, val1, val2)
{
	if ( obj.length == null)
	{
		var i =0;
	}
	else
		var i = obj.length;

	obj[i] = new Option(val1, val2, false, false);
}

//-------------------------------------------------------------------
// selectbox¿¡ option »èÁ¦
//-------------------------------------------------------------------
function rmOption(obj)
{
	for(var i=0; i<obj.length; i++)
	{
		if (obj.options[i].selected)
		{
			obj.options[i] = null;
		}
	}
	return;
}


function pageMove(url,boardId, page, categorySno, srchType, keyword, cntPage, answerYn, content)
{
	self.location = url + "?boardId="+boardId+"&page="+page+"&category_sno="+categorySno+"&srchType="+srchType+"&keyword="+keyword+"&viewPage="+cntPage+"&answerYn="+answerYn+"&content="+content;
}

function pageMove1(form , page, cntPage)
{
	form.page.value = page;
	form.viewPage.value = cntPage;
	form.submit();
}

/**************************************
°Ô½ÃÆÇ °ü¸® °ü·Ã
**************************************/
function addBoard(form)
{	
	form.mode.value="insert";
	if(formCheck(form))
		form.submit();
}

function editBoard(form)
{	
	form.mode.value="setup";
	if(formCheck(form))
		form.submit();
}

function formCheck(form)
{
	if(form.boardNm.value == "")
	{
		alert("°Ô½ÃÆÇÀÌ¸§À» ³Ö¾îÁÖ¼¼¿ä");
		form.boardNm.focus();
		return false;
	}
	if(form.imgFileCnt.value != "0")
		form.imgFileYn.value="Y";
	if(form.pdsFileCnt.value != "0")
		form.pdsFileYn.value="Y";
	return true;
}

function delBoard(form, sno)
{
	form.mode.value="delete";
	form.boardId.value = sno;
	if(confirm('Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?'))
		form.submit();
}

/**************************************
°Ô½ÃÆÇ °ü·Ã
**************************************/
function opr(obj, num)
{
	var form = document.cmdForm;

	if(obj == 'create')
	{
		form.mode.value="save";
		form.submit();
	}		
	else if(obj == 'delete')
	{
		form.mode.value="delete";
		form.board_sno.value=num;
		if(confirm("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î"))
			form.submit();			
	}
}

function send(form, page, val, obj, displaySno, answerSno, categorySno)
{
	form.mode.value="view";
	form.page.value=page;
	form.printCnt.value=val;
	form.board_sno.value=obj;
	form.display_sno.value = displaySno;
	form.answer_sno.value = answerSno;
	form.category_sno.value = categorySno;
	form.submit();		
}

function send2(form, page, val, obj, displaySno, answerSno, categorySno)
{
	form.mode.value="view";
	form.target="iphak";
	form.page.value=page;
	form.printCnt.value=val;
	form.board_sno.value=obj;
	form.display_sno.value = displaySno;
	form.answer_sno.value = answerSno;
	form.category_sno.value = categorySno;
	form.submit();		
}

function goSetup()
{
	var form = document.cmdForm;
	form.mode.value = "setup";
	form.submit();
}
// insert 
function save()
{ 
	form = document.write;
	
	if(document.write.title.value=="")
	{
		alert("Á¦¸ñÀ» ÀûÁö ¾ÊÀ¸¼Ì½À´Ï´Ù."); 
		form.title.focus();
		return;
	}
	else if(document.write.name.value=="" )
	{
		alert("ÀÌ¸§À» ÀûÁö ¾ÊÀ¸¼Ì½À´Ï´Ù."); 
		form.name.focus();
		return;
	}
	else if(document.write.email.value=="")
	{
		alert("emailÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		form.email.focus();
		return;
	}
	else if(!(is_email(document.write.email.value)))
	{
		alert("emailÁÖ¼Ò°¡ ¿Ç¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		form.email.focus();
		return;
	}
	else if(document.write.pwd.value=="")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀûÁö ¾ÊÀ¸¼Ì½À´Ï´Ù."); 
		form.pwd.focus();
		return;
	}
	else if(document.write.contents.value=="")
	{
		alert("³»¿ëÀ» ÀûÁö ¾ÊÀ¸¼Ì½À´Ï´Ù."); 
		form.contents.focus();
		return;
	}
	else if(document.getElementsByName("limitDateYn")[0].checked == true)
	{
		if(document.write.limitDay.value == "" || document.write.limitDay.value == "-1")
		{
			alert("°Ô½Ã¹° ±âÇÑÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			return;
		}
		else
			form.submit();
	}
	else
	{		
		form.submit();
	}
}


function getSearchList(form)
{
	form.mode.value = "";
	form.submit();
}

//view
function answer(url, boardSno, boardId, content)
{
	location.href=url + "?mode=viewAnswer&board_sno="+boardSno+"&boardId="+boardId + "&content=" + content + "&url=" + url;
}
function coment(url, boardSno, boardId)
{
	location.href=url + "?mode=coment&board_sno="+boardSno+"&boardId="+boardId;
}	
function editView(url, boardSno, boardId, page, content)
{
	location.href=url + "?mode=editView&board_sno="+boardSno+"&boardId="+boardId + "&page="+page+"&content=" + content;
}
function deleteView(url, boardSno, boardId, page, content)
{
	location.href=url + "?mode=deleteView&board_sno="+boardSno+"&boardId="+boardId + "&page="+page+"&content=" + content;
}
function movePage(boardId, boardSno, printCnt, displaySno, answerSno, categorySno)
{
	viewForm.boardId.value= boardId;
	viewForm.board_sno.value= boardSno;
	viewForm.printCnt.value = printCnt;
	viewForm.display_sno.value= displaySno;
	viewForm.answer_sno.value= answerSno;
	viewForm.category_sno.value= categorySno;
	viewForm.mode.value = "view";
	viewForm.submit();		
}
function downFile(form, fileSno, fileName, fileSize)
{	
	form.mode.value="file_down";
	form.file_sno.value = fileSno;
	form.file_name.value = fileName;
	form.file_size.value = fileSize;
	form.submit();
}

function reply(url, boardSno, boardId, content)
{
	location.href=url + "?mode=answer&board_sno=" + boardSno + "&boardId=" + boardId + "&content=" + content ;
}

function deleteFile(fileSno, boardSno, boardId, content)
{
	if(document.write.pwd.value=="")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀûÁö ¾ÊÀ¸¼Ì½À´Ï´Ù."); 
		document.write.pwd.focus();
		return;
	}
	self.location="/KyungwonBoard?mode=file_delete&file_sno=" + fileSno + "&board_sno=" + boardSno + "&boardId=" + boardId + "&content=" + content + "&pwd=" + document.write.pwd.value;
}

function deleteFile2(fileSno, boardSno, boardId, content)
{
	if(document.write.pwd.value=="")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀûÁö ¾ÊÀ¸¼Ì½À´Ï´Ù."); 
		document.write.pwd.focus();
		return;
	}
	self.location="/HakgwaBoard?mode=file_delete&file_sno=" + fileSno + "&board_sno=" + boardSno + "&boardId=" + boardId + "&content=" + content + "&pwd=" + document.write.pwd.value;
}

//delete
function del(form)
{
	if(form.pwd.value == "")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		form.pwd.focus();
		return;
	}
	form.submit();
}

//coment
function textCounter(field, countfield, maxlimit)
{
	if (msglen(field.value) > maxlimit) // if too long...trim it!
	{
		alert("ÀÔ·ÂÇÒ¼ö ÀÖ´Â ÃÖ´ë±æÀÌ¸¦ ÃÊ°úÇß½À´Ï´Ù.");
		field.value = assert_msglen(field.value, maxlimit);
	}
	else 
		countfield.value = maxlimit - field.value.length;
}

//ÇÑ±Û 2byteÆ÷ÇÔ maximum ±ÛÀÚ¸¦ ¸®ÅÏ
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;
	}
	
	return msg;
}

//±ÛÀÚÀÇ byte ¼ö ¸®ÅÏ
function 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 coment(form)
{
	if (form.c_name.value==""){
		alert ("ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
	  form.c_name.focus();
		return false;
	}
	if (form.c_pwd.value==""){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		form.c_pwd.focus();
		return false;
	}
	if (form.c_content.value==""){
		alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		form.c_content.focus();
		return false;
	}
	else 
	{
		form.mode.value="coment_write";
		form.submit();
	}
}
function delComent(form)
{
	form.mode.value="coment_delete";
	if(confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?'))	
		form.submit();
}



/**************************************
	¸ÞÀÎ °ü·Ã
**************************************/
flag_id = false;
flag_pwd = false;

function login() {
	form = document.loginFrm;
	if(form.id.value == "") {
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		form.id.focus();
		return;
	}
	if(form.pwd.value == "") {
		alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		form.pwd.focus();
		return;
	}
	form.submit();
}
function logout() {
	location.replace("/main/ui/logout.jsp");
}

function findPwd()
{
	self.location="/main/ui/content.jsp?content=0802";
}

function modifyInfo(type) {
	location.href = "/main/ui/content.jsp?content=0801_" + type;
}

function mypage(id, type) {
	if(id == "test")
	{
		if(confirm("jikwon?"))
			location.href = "/main/ui/content.jsp?content=0803_gyo";
		else if(confirm("jaehak?"))
			location.href = "/main/ui/content.jsp?content=0803_jaehak";
		else if(confirm("ilban?"))
			location.href = "/main/ui/content.jsp?content=0803_ilban";
		else if(confirm("yebi?"))
			location.href = "/main/ui/content.jsp?content=0803_suheom";
	}
	else
	{
		if(type=="1")
			location.href = "/main/ui/content.jsp?content=0803_gyo";
		else if(type=="2")
			location.href = "/main/ui/content.jsp?content=0803_gyo";
		else if(type=="3")
			location.href = "/main/ui/content.jsp?content=0803_gyo";
		else if(type=="4")
			location.href = "/main/ui/content.jsp?content=0803_gyo";
		else if(type=="5")
			location.href = "/main/ui/content.jsp?content=0803_gyo";
		else if(type=="6")
			location.href = "/main/ui/content.jsp?content=0803_gyo";
		else if(type=="7")
			location.href = "/main/ui/content.jsp?content=0803_jaehak";
		else if(type=="A")
			location.href = "/main/ui/content.jsp?content=0803_ilban";
		else if(type=="B")
			location.href = "/main/ui/content.jsp?content=0803_suheom";
	}
}

function openLogin(val, val2)
{
	window.open("/main/ui/include/popupLogin.jsp?rtnUrl="+val+"&content="+val2,"login","width=150,height=100");
}


//-------------------------------------------------------------------
// ±³Á÷¿øÁ¤º¸ °Ë»ö
//-------------------------------------------------------------------

function checkForm()
{
	if (document.frm.keyword.value == "")
	{
		alert("::Å°¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä::");
		document.frm.keyword.focus();
		return false;
	}

	var option_temp = 0;
	for (var i=0; i < document.frm.field.length; i++)
	{
		if (document.frm.field[i].selected == true)
		{
			option_temp = i + 1;
		}
	}

	document.frm.option.value = option_temp;
	document.frm.find_flag.value = "T";
	document.frm.submit();
}
//-------------------------------------------------------------------

function scroll() {
	var gotop = document.getElementById("0108_top");
	if(gotop) { gotop.style.top = document.body.clientHeight - 130 + document.body.scrollTop; }
}

function defaultStatus(){
	var lec = document.all.lecture;
	for (var i=0;i<lec.length;i++){
		document.all.lecture[i].style.border = "1 solid #EFEFEF";
		document.all.lecture[i].style.backgroundColor = "";
	}
}

function mouseOnTD(obj)
{
	obj.style.border = "1 solid gray";
	obj.style.backgroundColor = "white";
	obj.style.cursor = "hand";
}

function mouseOnTD2(obj)
{
	obj.style.border = "1 solid #FFDE8B";
	obj.style.backgroundColor = "#F5FEF1";
	obj.style.cursor = "hand";
}

function mouseOutTD2(obj)
{
	obj.style.border = "0";
	obj.style.backgroundColor = "";
	obj.style.cursor = "";
}

function ClickOnTD(obj){
	obj.style.border = "1 solid gray";
	obj.style.backgroundColor = "white";
	obj.style.cursor = "hand";
}

function resizeImage(img)
{
  //¸Þ¸ð¸®¿¡ ÀÓ½Ã ÀÌ¹ÌÁö »ý¼º
  var tempImg = new Image;

  //ÀÓ½Ã ÀÌ¹ÌÁö ´Ù¿î·Îµå ¿Ï·á½Ã ÀÛµ¿ÇÒ ÀÌº¥Æ®ÇÚµé·¯ µî·Ï
  tempImg.onload = function()
  {
    //ÀÓ½Ã ÀÌ¹ÌÁöÀÇ Å©±â(¿ø·¡ Å©±â)°¡ img ÅÂ±×¿¡ ÁöÁ¤µÈ Å©±âº¸´Ù ÀÛ´Ù¸é
    if(tempImg.width < img.width)
    {
      //img ÅÂ±×ÀÇ Å©±â¸¦ ¿ø·¡ Å©±â·Î...
      img.width = tempImg.width;
    }
  }

  //ÀÓ½Ã ÀÌ¹ÌÁö ´Ù¿î·Îµå ½ÃÀÛ
  tempImg.src = img.src;
}

//ÀÔÇÐ ³»½Å¼ºÀû »êÃâ ÆË¾÷
function popup1()
{
	window.open("/iphak/ui/content/popup.jsp","","width=660,height=730,left=0,top=0");
}

//°³ÀÎÁ¤º¸º¸È£Á¤Ã¥
function gogogo()
{
	window.open("/main/ui/info.jsp","","width=668,height=730,left=0,top=0");
}

//»ê¾÷Ã¼À§Å¹ ½ÅÀÔ»ý¸ðÁý¾È³» ÆË¾÷
function pop11_15()
{
	window.open("/main/ui/popup/11_15.jsp","pop11_15","width=403,height=442,top=0,left=0");
}

//±³¼öÆ¯°­¾È³» ÆË¾÷
function pop11_15_2()
{
	window.open("/main/ui/popup/11_15_2.jsp","pop11_15_2","width=402,height=402,top=0,left=403");
}

function pop11_17_1()
{
	window.open("/main/ui/popup/11_17_1.jsp","pop11_17_1","width=352,height=318,top=70,left=330");
}

function pop11_17_2()
{
	if (getCookie("ncook") != "done") {
		window.open("/main/ui/popup/11_17_2.jsp","pop11_17_2","width=320,height=369,top=70,left=0");
	}
}

////////////////////ÄíÅ° °ü·Ã////////////////////
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 setCookie(name,value,expiredays) {
var todayDate = new Date();
todayDate.setDate(todayDate.getDate() + expiredays);
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function closeWin() {
if(document.checkClose.ncook.checked == true) {
setCookie("ncook", "done" ,7);
}
self.close();
}
/////////////////////////////////////////////////////

function updateGesimulView(url, boardId, boardSno, displaySno, answerSno, categorySno, content, id)
{
	var url = "/main/ui/board/gesimulView_g.jsp?url="+url+"&boardId="+boardId+"&board_sno="+boardSno+"&display_sno="+displaySno+"&answer_sno="+answerSno+"&category_sno="+categorySno+"&mode=view&content="+content+"&sabeon="+id;
	window.open(url,"","width=595,height=520,scrollbars=yes");
}



