function CenterPop(newwin,w,h) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,toolbars=no,status=no,menu=no';
  win = window.open(newwin, "Window", winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function Today() {
	var now = new Date();
	year = now.getYear();          // ÇöÀç ³âµµ °¡Á®¿À±â
	month = now.getMonth()+1;        // ÇöÀç ¿ù °¡Á®¿À±â (+1)

	if((month+"").length < 2){         //¿ùÀÌ '7'·Î ÂïÈ÷Áö ¾Ê°í '07'·Î ÂïÈ÷µµ·Ï ±æÀÌ¸¦ ¹Þ¾Æ¿Â´Ù
		month = "0" +month;         //±æÀÌ°¡ 1ÀÌ¶ó¸é ¾Õ¿¡ 0À» ºÙ¿©¼­ '07'ÇüÅÂ·Î ³ª¿À°Ô ÇÑ´Ù
	}

	date = now.getDate();       // ÇöÀç ³¯Â¥ °¡Á®¿À±â

	if((date+"").length < 2){         //ÀÏÀÌ '7'·Î ÂïÈ÷Áö ¾Ê°í '07'·Î ÂïÈ÷µµ·Ï ±æÀÌ¸¦ ¹Þ¾Æ¿Â´Ù
		date = "0" +date;           //±æÀÌ°¡ 1ÀÌ¶ó¸é ¾Õ¿¡ 0À» ºÙ¿©¼­ '07'ÇüÅÂ·Î ³ª¿À°Ô ÇÑ´Ù
	}

	today = year +""+ month +""+ date ;           //¿À´Ã ³¯Â¥ ex) 20080801

	return today;
}

function Biz_Chk(obj1, obj2, obj3) {
	var ThisVal1 = obj1.value;
	var ThisVal2 = obj2.value;
	var ThisVal3 = obj3.value;

	var chkRule = "137137135"; // »ç¾÷ÀÚ¹øÈ£ Ã¼Å© Çü½Ä
	var strCoreNum = ThisVal1 + ThisVal2 + ThisVal3; // »ç¾÷ÀÚ¹øÈ£ 10ÀÚ¸®
	var step1, step2, step3, step4, step5, step6, step7;

	step1 = 0; // ÃÊ±âÈ­

	for (i=0; i<7; i++) {
		step1 = step1 + (strCoreNum.substring(i, i+1) * chkRule.substring(i, i+1));
	}

	step2 = step1 % 10;
	step3 = (strCoreNum.substring(7, 8) * chkRule.substring(7, 8)) % 10;
	step4 = strCoreNum.substring(8, 9) * chkRule.substring(8, 9);
	step5 = Math.round(step4 / 10 - 0.5);
	step6 = step4 - (step5 * 10);
	step7 = (10 - ((step2 + step3 + step5 + step6) % 10)) % 10;

	if (strCoreNum.substring(9, 10) != step7) return false;

	return true;
}

function radio_chk(f,ele) {
	var str = false;

	for (i=0; i<ele.length; i++) {
		if (ele[i].checked==true) {
			str = true;
			break;
		}
	}

	if (str==false) return false
	else return true
}

function personal_chk(str) {
	tmp_title = str;
	tmp_title = tmp_title.replace(/\s/g,'');
	tmp_title = tmp_title.replace(/&nbsp;/g,'');
	tmp_title = tmp_title.replace(/\\/g,'');
	tmp_title = tmp_title.replace(/\//g,'');

	if(tmp_title.search(/\d{6}\-\d{7}/) != -1 || tmp_title.search(/\d{13}/) != -1 || tmp_title.search(/\d{4}\-\d{4}\-\d{4}\-\d{4}/) != -1 || tmp_title.search(/\d{16}/) != -1||tmp_title.search(/\d{2,3}-\d{3,4}-\d{4}/) != -1) return false
	else return true
}

function MM_openBrWindow(theURL,winName,features) {
	var Win;
	Win = window.open(theURL,winName,features);
//	Win.resizeTo(800, 600);
	Win.focus();

	//MM_openBrWindow('','Window','width=765,height=720,scrollbars=1,top=0,left=0')
}

function CenterPop(newwin,w,h,scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;

  if (scroll=1)
  {
	  winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=yes,toolbars=no,status=yes,menu=no';
  }else{
	  winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,toolbars=no,status=yes,menu=no';
  }

  win = window.open(newwin, "Window", winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


function c_del(f,url) {
	msg = "»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?";
	if (confirm(msg)==true) {
		f.action = url;
		f.submit();
	}
}

function c_del2(url) {
	msg = "»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?";

	if (confirm(msg)==true) {
		document.form1.action = url;
		document.form1.submit();
	}

//	if (confirm(msg)==true) location.href= url;

}

function validEmail(email) {
	invalidChars = " /:,;"

	if (email == "") {						// cannot be empty
		return false
	}

	for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) {
			return false
		}
	}

	atPos = email.indexOf("@",1)			// there must be one "@" symbol

	if (atPos == -1) {
		return false
	}

	if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
		return false
	}

	periodPos = email.indexOf(".",atPos)

	if (periodPos == -1) {					// and at least one "." after the "@"
		return false
	}

	if (periodPos+3 > email.length)	{		// must be at least 2 characters after the "."
		return false
	}

	return true

}

function JuminCheck(obj1,obj2) {
	var comp="0123456789";
	var string=obj1.value;
	var len=string.length;
	if (len == 6) {
		for(i=0;i<len;i++) {
			if(comp.indexOf(string.substring(i,i+1))<0) {
				return false;
			}
		}
	} else {
		return false;
	}
	var string=obj2.value;
	var len=string.length;
	if (len == 7) {
		for(i=0;i<len;i++) {
			if(comp.indexOf(string.substring(i,i+1))<0) {
				return false;
			}
		}
	} else {
		return false;
	}

  num = 0;
  num7 = 0;
  num13 = 0;
  totalnum = 0;
  chknum = 0;
	num7 = parseInt(obj2.value.substring(0,1),10);
  num  = parseInt(obj1.value.substring(0,1),10)   * 2 +
         parseInt(obj1.value.substring(1,2),10)   * 3 +
         parseInt(obj1.value.substring(2,3),10)   * 4 +
         parseInt(obj1.value.substring(3,4),10)   * 5 +
         parseInt(obj1.value.substring(4,5),10)   * 6 +
         parseInt(obj1.value.substring(5,6),10)   * 7 +
         parseInt(obj2.value.substring(0,1),10)   * 8 +
         parseInt(obj2.value.substring(1,2),10)   * 9 +
         parseInt(obj2.value.substring(2,3),10)   * 2 +
         parseInt(obj2.value.substring(3,4),10)   * 3 +
         parseInt(obj2.value.substring(4,5),10) * 4 +
         parseInt(obj2.value.substring(5,6),10) * 5;

	num13 = parseInt(obj2.value.substring(6,7),10);
	totalnum = num%11;
  chknum   = 11 - totalnum;

  if(chknum >= 10 ) chknum = chknum - 10;
		if((num13 == chknum) && ( num7 == 1 || num7 == 2 ))
			return true;
    else   return false;


	//if (JuminCheck(f.jumin1, f.jumin2) == false) {
	//	alert("ÁÖ¹Î¹øÈ£°¡ Á¤»óÀûÀÌÁö ¾Ê½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
	//	f.jumin1.focus();
	//	return false;
	//}

}

function numchk(num){
    num=new String(num);
    num=num.replace(/,/gi,"");

    return numchk1(num);

	//onKeyUp="this.value=numchk(this.value)"
}

function numchk1(num){
    var sign="";
    if(isNaN(num)) {
        alert("¼ýÀÚ¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.");
        return "";
    }

	if(num==0) {
        return num;
    }

    if(num<0){
        alert("¼ýÀÚ¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.");
        return "";
    }
    else{
		return num;
    }

}

function onlyNumber()
{
    key = event.keyCode;

    if ((key >= 48 && key <= 57) // Å°º¸µå »ó´Ü ¼ýÀÚÅ°
       || (key >= 96 && key <= 105) // Å°ÆÐµå ¼ýÀÚÅ°
       || key == 8  // ¹é½ºÆäÀÌ½º Å°
       || key == 37 // ¿ÞÂÊ È­»ìÇ¥ Å°
       || key == 39 // ¿À¸¥ÂÊ È­»ìÇ¥ Å°
       || key == 46 // DEL Å°
       || key == 13 // ¿£ÅÍ Å°
       || key == 9  // Tab Å°
       )
    {
        event.returnValue = true ;
    }
    else
    {
        // alert(key);
        event.returnValue = false ;
    }
}


function checkDecimals(fieldName, fieldValue) {
       decallowed = 1; // ¼Ò¼ýÁ¡ÀÌÇÏ¼ýÀÚÀÇ °¹¼ö

       if (isNaN(fieldValue) || fieldValue == "") {
               alert("¼ýÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
               fieldName.select();
               fieldName.focus();
			   return false;
       }
       else {
               if (fieldValue.indexOf('.') == -1) fieldValue += ".";
               dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);

               if (dectext.length > decallowed)
               {
                       alert ("¼Ò¼öÁ¡ " + decallowed + " ÀÚ¸®±îÁö¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù");
                       fieldName.select();
                       fieldName.focus();
					   return false;
               }
               else {
                       //alert ("¹Ù¸£°Ô ÀÔ·Â ÇÏ¼Ì³×¿ä");
					   return true;
               }
       }

	   //if (checkDecimals(form.val1, form.val1.value)==false) return;
}

function isValidDate(s) {

    var pt = /^\d{4}-\d{2}-\d{2}$/;

    if (!pt.test(s)) return false;



    var y = parseInt(s.substr(0,4), 10);

    var m = parseInt(s.substr(5,2), 10) - 1;

    var d = parseInt(s.substr(8,2), 10);



    var dt = new Date(y, m, d);



    if (dt.getYear() == y && dt.getMonth() == m && dt.getDate() == d) {

        return true;

    }

    else {

        return false;

    }

}

function isDate(y, m, d) {

        switch (m) {
				case 1:
                if (d > 31) return false;
								break;
        case 2:        // 2¿ùÀÇ °æ¿ì
                if (d > 29) return false;
                if (d == 29) {
                        // 2¿ù 29ÀÇ °æ¿ì ´çÇØ°¡ À±³âÀÎÁö¸¦ È®ÀÎ
                        if ((y % 4 != 0) || (y % 100 == 0) && (y % 400 != 0))
                                return false;
                }
                break;
        case 3:
                if (d < 1||d > 31) return false;
								break;
        case 4:
                if (d < 1||d > 30) return false;
								break;
        case 5:
                if (d < 1||d > 31) return false;
								break;
        case 6:
                if (d < 1||d > 30) return false;
								break;
        case 7:
                if (d < 1||d > 31) return false;
								break;
        case 8:
                if (d < 1||d > 31) return false;
								break;
        case 9:
                if (d < 1||d > 30) return false;
								break;
        case 10:
                if (d < 1||d > 31) return false;
								break;
        case 11:
                if (d < 1||d > 30) return false;
								break;
        case 12:
                if (d < 1||d > 31) return false;
								break;

        }
        // Å« ´ÞÀÇ °æ¿ì
        return true;


		//var y = f.b_year2.options[f.b_year2.selectedIndex].value;
		//var m = f.b_month2.options[f.b_month2.selectedIndex].value;
		//var d = f.b_day2.options[f.b_day2.selectedIndex].value;

		//y = parseInt(y, 10);
		//m = parseInt(m, 10);
		//d = parseInt(d, 10);

		//if (isDate(y,m,d)==false) {
		//	alert("³¯Â¥¿À·ùÀÔ´Ï´Ù.");
		//	return false;
		//}


}

function todays() {
	var mydate=new Date()
	var year=mydate.getYear()

	if (year < 1000)
		year+=1900
	var day=mydate.getDay()
	var month=mydate.getMonth()+1

	if (month<10)
		month="0"+month

	var daym=mydate.getDate()

	if (daym<10)
		daym="0"+daym

	g_day= year + "-" + month + "-" +daym;

	return g_day;
}

function getCookie(name) {
		var from_idx = document.cookie.indexOf(name+'=');
		if (from_idx != -1) {
			from_idx += name.length + 1
			to_idx = document.cookie.indexOf(';', from_idx)

			if (to_idx == -1) {
				to_idx = document.cookie.length
			}
			return unescape(document.cookie.substring(from_idx, to_idx))
		}
}

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_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_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 resizeFrameSpam()
{
    try
    {
        var oBody  = document.frames("policyForm").document.body;
        var oFrame  = document.all("policyForm");

        if(oBody.readyState != "complete")
        {
            setTimeout( "reSize()", 100 );
            return; // ¸ðµç °´Ã¼°¡ ¿ÏÀüÈ÷ ·ÎµåµÈ ÈÄ ÇÑ¹ø¸¸ Á¶Á¤ÇÏ±â À§ÇØ
        }

        var nMin = 20;
        oFrame.style.height = nMin;    // Á¶Àý Àü ÃÊ±â »çÀÌÁî¸¦ Àâ¾ÆÁÖÁö ¾ÊÀ¸¸é
                                      // IFRAME ³» ÆäÀÌÁö Refresh ½Ã »çÀÌÁî°¡ °è¼Ó Áõ°¡ÇÒ ¼ö ÀÖ´Ù.

        var nHeight = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
        if(nHeight < nMin) nHeight = nMin;

        oFrame.style.height = nHeight;
    }
    catch(e)
    {
        window.status = 'Error: ' + e.number + '; ' + e.description;
    }
}

function nextFocus(sFormName,sNow,sNext)
{
	var sForm = 'document.'+ sFormName +'.'
	var oNow = eval(sForm + sNow);

	if (typeof oNow == 'object')
	{
		if ( oNow.value.length == oNow.maxLength)
		{
			var oNext = eval(sForm + sNext);

			if ((typeof oNext) == 'object')
				oNext.focus();
		}
	}
}

function MovieIDMove() {
	document.form2.reset();
	document.form2.movieid.value = document.form1.movieid.value;

	var intFileCnt = document.getElementById("file_list").length;
	blnUploading = false;

	if (intFileCnt > 0) {
		var nListIndex = intFileCnt - 1;
		document.getElementById("file_list").options[nListIndex] = null;
	}

	self.ifrm_area.location.href = "about:blank";
}

function AllCheck(){
	for( var i=0; i<document.BoardForm1.elements.length; i++) {
		if(document.BoardForm1.elements[i].name == 'sel')
			document.BoardForm1.elements[i].checked = true;
	}
	return;
}

function CancelCheck(){
	for( var i=0; i<document.BoardForm1.elements.length; i++) {
		if(document.BoardForm1.elements[i].name == 'sel')
			document.BoardForm1.elements[i].checked = false;
	}
	return;
}

function DeleteFunc(url) {
	form = document.BoardForm1;
	dCnt = 0;
	if (form.sel){
		if (form.sel.length){
			for(i = 0; i < form.sel.length; i++)
				if (form.sel[i].checked)	dCnt++;
		} else {
			if (form.sel.checked)
				dCnt++;
		}
		if(dCnt != 0) {
			ans = confirm("¼±ÅÃÇÑ " + dCnt + "°³¸¦  »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")
			if (ans == true){
				form.delCnt.value = dCnt;
				form.action = url;
				form.submit();
			}
			else
				return;
		} else {
			alert("¼±ÅÃÇÑ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.")
			return;
		}
	} else {
		alert("¼±ÅÃÇÑ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.")
		return;
	}

}
function chk_extension2(file){
	if (file !=""){
		ext = file.slice(file.lastIndexOf(".")+1).toLowerCase();
		if (ext == "jpg" || ext == "gif" || ext == "jpeg"){
//			alert("ÀÌ¹ÌÁöÆÄÀÏ (.jpg) ¸¸ ¾÷·Îµå °¡´ÉÇÕ´Ï´Ù.");
			return true;
		}
		return false;
	}
}




