//·Î±×ÀÎ ¸Þ½ÃÁö¸¦ º¸¿©ÁØ´Ù. 
function login_check(actFlag) {
	if (actFlag == "1") {
		alert("¸ÕÀú ·Î±×ÀÎÇÏ¼¼¿ä.")
	}
	else if (actFlag == "2") {
		//LoginWindow('/deli/login.asp'); ±âÁ¸ ÆË¾÷Ã¢ °æ·Î
		LoginWindow('/Deli/Member_login/login.asp');
	}
}


function WindowBack() {
	self.history.back();
} 


//·Î±×ÀÎ ¸Þ½ÃÁö¸¦ º¸¿©ÁØ´Ù.
function login_check(actFlag) {
	if (actFlag == "1") {
		alert("¸ÕÀú ·Î±×ÀÎÇÏ¼¼¿ä.");
		//document.idpass.tx_cid.focus();
	}
	else if (actFlag == "2") {
		alert("¸ÕÀú ·Î±×ÀÎÇÏ¼¼¿ä")
		LoginWindow('/deli/login.asp');
	}
}


function money_only() {
    alert("À¯·áÈ¸¿ø¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
}

//Ä·ÆÛ½ºÄî ·¹¼¼ÇÇ ÇÁ¸°Æ® ÆË¾÷
function camprint_popup(checkgbn,recipeno) {
var StrOption ;
	StrOption  = "width=585,height=630, scrollbars=yes";
	window.open ("/campus/actualTest/actualtest_print.asp?checkgbn=" + checkgbn + "&recipeno=" + recipeno, "SubWindow", StrOption ) ; 
} 

//½ºÅÍµð ¹× µ¿È£È¸ ±ÇÇÑ ¿©ºÎ
function UserLevel(Parc) {
 if(Parc == "1") 
      alert("È¸¿ø¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.") 
 else if(Parc == "2") 
     alert("±ÇÇÑÀÌ ¾ø½À´Ï´Ù.") 
 else if(Parc == "3") 
     alert("¿î¿µÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.") 
 else if(Parc == "4") 
     alert("À¯·áÈ¸¿ø¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")           
}

//Å»Åð Ã³¸® 
function UserGetOut() {
  var my_ret

  my_ret = confirm("Å»Åð ÇÏ½Ã°Ú½À´Ï±î?")

  if (my_ret == true) 
     location.href="/Campus/Restore.asp"
}

function FnSugung(alternative) { 
           alert("¸ÕÀú ¼ö°­½ÅÃ» ÇÏ¼¼¿ä");
           location.href="/Campus/ActualTest/sugang_01.asp?CheckGbn=" + alternative
} 

function ready_asf() { 
           alert("ÁØºñÁßÀÔ´Ï´Ù.");
}

function asf_open(asx_file, speed) {
	var asf_url = '/campus/handling/media/defaultFrm.asp?asx_file=' + asx_file + '&speed=' + speed;
	ans = confirm("µ¿¿µ»óÀ» º¸½Ã±â À§ÇØ °áÁ¦¸¦ ÇÏ½Ã°Ú½À´Ï±î?")
	if(ans == true){window.open(asf_url,"view_window","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=565,left=0,top=0");}
} 

function asf_open2(asx_file, speed) {
	//var asf_url = '/campus/handling/media/defaultFrm2.asp?asx_file=' + asx_file + '&speed=' + speed;
	//window.open(asf_url,"view_window","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=565,left=0,top=0");
	if(asx_file == "MF_32_A_2" || asx_file == "MF_32_A_4" || asx_file == "MF_30_A_4" || asx_file == "MF_33_A_2" || asx_file == "MF_34_A_1"){
  	  location.href='/campus/handling/media/defaultFrm22.asp?asx_file=' + asx_file + '&speed=' + speed;
	}else{  
	       ans = confirm("µ¿¿µ»óÀ» º¸½Ã±â À§ÇØ °áÁ¦¸¦ ÇÏ½Ã°Ú½À´Ï±î?")
	       if(ans == true){location.href='/campus/handling/media/defaultFrm22.asp?asx_file=' + asx_file + '&speed=' + speed;}
	}       
}  

function popup(paramno,paramnm,addr_cd) {
var StrOption ;
	StrOption  = "width=585,height=650,scrollbars=yes";
	window.open ("/campus/map/popup/pop_01.asp?paramno=" + paramno + "&paramnm=" + paramnm + "&addr_cd=" + addr_cd , "SubWindow", StrOption ) ; 
}

function WindowBack() {
	self.history.back()
} 


//¼±¹è(actflag=1),Ã¢¾÷(actflag=2),Å½¹æ±â(actflag=3)¿¡¼­ ¸®½ºÆ®·Î º¹±ÍÇÔ.
function listback(actFlag) {
	if (actFlag == "1") { 
		location.href="/Campus/Actualreport/Seniorfind/Seniorfind.asp"
	}
	else if (actFlag == "2") {
		location.href="/Campus/Foundation/Myfoundation/Myfoundation.asp"
	}
	else if (actFlag == "3") {
		location.href="/Campus/Actualreport/Interview/Interview.asp"
	}	
}



 

//args =>  month : 12, year : 1999
function total_day(month, year) {
    if(month == 1) total_days = 31
    else if(month == 2) {
        // À±³â Á¶»ç
        if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
            total_days = 29
        else
            total_days = 28
    }
    else if(month == 3) total_days = 31
    else if(month == 4) total_days = 30
    else if(month == 5) total_days = 31
    else if(month == 6) total_days = 30
    else if(month == 7) total_days = 31
    else if(month == 8) total_days = 31
    else if(month == 9) total_days = 30
    else if(month == 10) total_days = 31
    else if(month == 11) total_days = 30
    else if(month == 12) total_days = 31
    
    return total_days
}

//ÇÊµåÀÇ °ø¹éÀ» Ã¼Å©ÇÑ´Ù. 
//args => document.testForm.tx_name.value
//°ø¹éÀÌ ¾Æ´Ï¸é false¸¦ ¸®ÅÏÇÑ´Ù
function emptyField(validField) {
	if (validField.value.length == 0) return true;
	for (var i = 0 ; i < validField.value.length ; ++i) {
		var ch = validField.value.charAt(i);
		if (ch != ' ' && ch != '\t') return false;
	}
	return true;
}

//ÇÊµå¿¡ ¼ýÀÚ°ª¸¸ ÀÖ´ÂÁö Ã¼Å©ÇÑ´Ù.
//args => validField : document.testForm.tx_age.value
//¼ýÀÚ°¡ ¾Æ´Ñ°ªÀÌ ÀÖÀ¸¸é true¸¦ ¸®ÅÏÇÑ´Ù.
function numericCheck(validField) {
	if (validField.length == 0 ) return false ;
	for(var i = 0 ; i < validField.length ; i++) {
		charOne = validField.substring(i, i+1)
		if (charOne < "0" || charOne > "9") return true ;
	}
	return false;
}


//ÇÊµå°ªÀÇ ±æÀÌÃ¼Å©¸¦ ÇÑ´Ù.
//args => str : document.testForm.tx_id.value,  itemlength : 30
//strÀÇ ±æÀÌ°¡ 30À» ³ÑÀ¸¸é true¸¦ ¸®ÅÏÇÑ´Ù. ÇÑ±ÛÀº 2byte·Î ±æÀÌ¸¦ Ã¼Å©ÇÑ´Ù.
function CheckLen(str, itemlength)	{
	var max=itemlength;
	var str2='';
	var hlen=0;
	var i=0;

	if (navigator.appName != "Netscape") {
		while (hlen <= max && i < str.length) {
			if (str.charCodeAt(i) > 122) {
				hlen = hlen + 2;
			} 
			else {
				hlen = hlen + 1;
			}

			if (hlen <= max) {
				str2 = str2 + str.substr(i, 1);
			}
			else {
				return true		//Á¦ÇÑ±æÀÌ¸¦ ³Ñ¾úÀ» °æ¿ì true¸¦ return
			}

			i = i + 1;
		}
		str = str2;
	}
	return false		//Á¦ÇÑ±æÀÌ¸¦ ³ÑÁö ¾Ê¾ÒÀ» °æ¿ì false¸¦ return
}

//ÁÖ¹Î¹øÈ£¸¦ Ã¼Å©ÇÑ´Ù.
//args => resident : document.testForm.tx_resident.value
//ÁÖ¹Î¹øÈ£ÀÇ Çü½ÄÀÌ ¸ÂÀ¸¸é false¸¦ ¸®ÅÏÇÑ´Ù.
function Jumin_chk(resident) {
	IDtot =0;
	IDAdd = "234567892345";

 	for(i=0; i<12; i++)

	IDtot = IDtot + parseInt(resident.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(resident.substring(12, 13)) != IDtot) {
		return true;
	}
	return false;
}


//ÇÊµå°ª¿¡ Æ¯¼ö¹®ÀÚ »ç¿ë¿©ºÎ¸¦ Ã¼Å©ÇÑ´Ù.
//args => chkValue : document.testForm.tx_name.value
//Æ¯¼ö¹®ÀÚ°¡ ¾øÀ¸¸é false¸¦ ¸®ÅÏÇÑ´Ù.
function id_validchk(chkValue) {
	var flag = 1;
	var checkNo = "/?@&+%*!#$';";
	for (i = 0;  i < chkValue.length;  i++)
	{
	  ch = chkValue.charAt(i);
	  
	  for (j = 0;  j < checkNo.length;  j++)
	    if (ch == checkNo.charAt(j)){
		flag = 0;
	    }
	}
	
	if (flag == 0)
	{
	  return true;
    }
      return false;
}

//ÀÌ¸ÞÀÏ ÁÖ¼Ò Çü½ÄÀÌ¸Â´ÂÁö Ã¼Å©ÇÑ´Ù.
//args => emailStr : document.testForm.tx_email.value
//Çü½ÄÀÌ ¸ÂÀ¸¸é false¸¦ ¸®ÅÏÇÑ´Ù.
function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var firstChars=validChars
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom="(" + firstChars + validChars + "*" + ")"
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert("E-mail ÁÖ¼Ò°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.\n @ ¿Í . À» È®ÀÎÇÏ½Ê½Ã¿À")
	return true
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    alert("¸ÞÀÏ ¾ÆÀÌµð°¡ Á¤È®ÇÑ °Í °°Áö ¾Ê½À´Ï´Ù.")
    return true
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("IP°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù!")
		return true
	    }
    }
    return false
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("µµ¸ÞÀÎ ÀÌ¸§ÀÌ Á¤È®ÇÑ °Í °°Áö ¾Ê½À´Ï´Ù.")
    return true
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("µµ¸ÞÀÎ¸íÀÇ ±¹°¡ÄÚµå´Â 2ÀÚº¸Å¸ Å©°í 3ÀÚº¸´Ù ÀÛ¾Æ¾ß ÇÕ´Ï´Ù")
   return true
}

if (domArr[domArr.length-1].length==2 && len<3) {
   var errStr="This address ends in two characters, which is a country"
   errStr+=" code.  Country codes must be preceded by "
   errStr+="a hostname and category (like com, co, pub, pu, etc.)"
   alert(errStr)
   return true
}

if (domArr[domArr.length-1].length==3 && len<2) {
   var errStr="ÀÌ ÁÖ¼Ò´Â È£½ºÆ®¸íÀÌ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù"
   alert(errStr)
   return true
}
return false;
}


//SubmitÁß¿¡ ¶Ç Å¬¸¯ÇÏ´Â°Í ¸·±â
//args => theForm : document.testForm
var isSubmit = false;

function CheckForm(theForm) {
	if (!isSubmit) {
		isSubmit = true;
		theForm.submit();
		return true;
	}
	else {
		alert("\nµî·Ï ÁßÀÔ´Ï´Ù. Àá½Ã ±â´Ù¸®¼¼¿ä."); 
		return; 
	}
}

//À©µµ¿ì¸¦ ¿ÀÇÂÇÑ´Ù.
//args => openurl : testWindow.htm, winName : OpenWin
//argtb : Åø¹Ù yes no, arglc, argdr, argst, argmb, argsb, argrs
// argwd : ³ÐÀÌ 100, arghg : ³ôÀÌ 100, arglf : leftÀ§Ä¡ 10, argtp : topÀ§Ä¡ 20
function open_window(openurl, winName, argtb, arglc, argdr, argst, argmb, argsb, argrs, argwd, arghg, arglf, argtp) {
	winproperty = "toolbar=" + argtb + ",location=" + arglc + ",directories=" + argdr + ",status=" + argst + ",menubar=" + argmb
	winproperty = winproperty + "scrollbars=" + argsb + ",resizable=" + argrs + ",width=" + argwd + ",height=" + arghg + ",left=" + arglf + ",top=" + argtp
	window.open(openurl, winName, winproperty);
}

//¹®ÀÚ¿­¿¡¼­ Æ¯Á¤¹®ÀÚ¸¦ ´Ù¸¥¹®ÀÚ·Î ¹Ù²Û´Ù.
//args => originalString : document.testForm.tx_title.value, findText : ', findText : `
function stringReplace(originalString, findText, findText) { 
	var pos = 0
	pos = originalString.indexOf(findText) 
	while (pos != -1) { 
		preString = originalString.substring(0, pos)
		postString = originalString.substring(pos+1, originalString.length)
		originalString = preString + replaceText + postString
		pos = originalString.indexOf(findText) 
	} 
	return originalString
}

//¶óµð¿À¹öÆ° ÇÏ³ªÀÌ»ó ¼±ÅÃÃ¼Å©
//args => ck_Radio : document.testForm.td_radio
//ÇÏ³ªµµ Ã¼Å©°¡ µÇÁö ¾Ê¾ÒÀ» °æ¿ì true¸¦ ¸®ÅÏÇÑ´Ù.
function Chk_Radio(ck_Radio) {
	chkFlag = "N";

	for ( i = 0 ; i < ck_Radio.length ; i++) {
		if (ck_Radio[i].checked) {
			chkFlag = "Y";
			break;
		}
	}
	
	if (chkFlag == "N" ) {
		return true;
	}
	else {
		return false;
	}
}

//¼±ÅÃµÈ ¶óµð¿À ¹öÆ°ÀÇ °ªÀ» ¸®ÅÏÇÑ´Ù.
//args => ck_Radio : document.testForm.td_radio
function Radio_Value(ck_Radio) {
	var Sel_Value = "";

	for ( i = 0 ; i < ck_Radio.length ; i++) {
		if (ck_Radio[i].checked) {
			Sel_Value = ck_Radio[i].value;
			break;
		}
	}

	return Sel_Value;
}

// È­¸é»ó¿¡¼­  ToggleÇÑ´Ù.
//args => id : document.testForm.div_name
function ToggleDisplay(id) {
	if (id.style.display == "none") {
		id.style.display = ""
	}
	else {
		id.style.display = "none"
	}
}

//ÀÌ¹ÌÁö º¯°æÇÏ±â
//args => ChangeImgName : document.testForm.imgName1, ChangeImgUrl : http://www.test.co.kr/images/testImages.gif
function change_Image(ChangeImgName, ChangeImgUrl) {
	ChangeImgName.src = ChangeImgUrl;
}





