
//Å¬¸¯ÇßÀ» °æ¿ì ±ÛÀÚ ¾ø¾îÁö´Â °Í
function setTextLogin( val, str )
{
		if (val.value == str )
		{
			val.value = "";
			val.focus();
			return;
		}
}
//·Î±×ÀÎÇÏ±â
function login_check()
{
	var pwdChar="0123456789abcdefghijklmnopqrstuvwxyzABCEDFGHIJKLMNOPQRSTUVWXYZ_!@#$%^&*+-~?()></=\|." ;
	with(document.login_form)
	{
		if(id.value =="")
		{
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä .");
			id.focus();
		}
		else if(!validID(id.value))
		{
			id.focus();
		}
		else if(pwd.value =="")
		{
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä .");
			pwd.focus();
		}
		else 
		{
			saveid(document.login_form);
			submit();
		}
	
	}
}

	function validID( str )
	{
	     /* check whether input value is included space or not  */
	     if( str == ""){
	     	alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
	     	return 0;
	     }
	     
	     var retVal = checkSpace( str ); 
	             
	     if( retVal != "" ) {
	         alert("¾ÆÀÌµð´Â ºó °ø°£ ¾øÀÌ ¿¬¼ÓµÈ ¿µ¹® ¼Ò¹®ÀÚ¿Í ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
	         return 0; 
	     } 
	     if( str.charAt(0) == '_') {
		 alert("¾ÆÀÌµðÀÇ Ã¹¹®ÀÚ´Â '_'·Î ½ÃÀÛÇÒ¼ö ¾ø½À´Ï´Ù.");
		 return 0;
	     }
	
	     /* checkFormat  */
	     var isID = /^[a-z0-9]{4,20}$/;
	     if( !isID.test(str) ) {
	         alert("¾ÆÀÌµð´Â 4~20ÀÚÀÇ ¿µ¹® ¼Ò¹®ÀÚ¿Í ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù."); 
	         return 0; 
	     }
	     return 1;
	}

	function checkSpace( str )
	{
	     if(str.search(/\s/) != -1){
	     	return 1;
	     }
	
	     else {
	         return "";
	     }
	}

	 function checkChars(s, spc) {
	for (i=0; i<s.length; i++) {
		if (spc.indexOf(s.substring(i, i+1)) < 0) {
			return false;
		}
	}
	return true;
}

	//°¡ÀÔÇÑ Å¬·´ °¡±â
	function ClubGo()
	{
		with(document.frmSchClub)
		{
			if (selClub.value != "")
			{
				parent.location.href = selClub.value;
			}
		}
	}

function menuclick(menu, menunm, x) {

	for (i = 1;i<=x; i++)
	{
		document["menu"+menunm+i].src = "img_main/tap_"+menunm+i+".gif";
		document.all["list"+menunm+i].style.display = "NONE" ;
	}
		
	document["menu"+menunm+menu].src = "img_main/tap_"+menunm+menu+"_over.gif";
		
	document.all["list"+menunm+menu].style.display = "" ;

	menuChk=menu;
}


function saveid(form) {

  var expdate = new Date();
  // ±âº»ÀûÀ¸·Î 30ÀÏµ¿¾È ±â¾ïÇÏ°Ô ÇÔ. ÀÏ¼ö¸¦ Á¶ÀýÇÏ·Á¸é * 30¿¡¼­ ¼ýÀÚ¸¦ Á¶ÀýÇÏ¸é µÊ
  if (form.chkidsave.checked)
    expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
  else
    expdate.setTime(expdate.getTime() - 1); // ÄíÅ° »èÁ¦Á¶°Ç
  if (form.chkidsave.checked)
  {
	  idval = form.id.value;
  }
  else
  {
	idval = "";
  }

  setCookie2("saveid", idval, expdate);
}


function setCookie2(name,value,expires,domain) {
document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString())) + "; domain=" + (domain ? domain : "diyhard.co.kr") + ";" ;
}
function getCookie2(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset)
      // ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
      if (end == -1)
        end = document.cookie.length
      return unescape(document.cookie.substring(offset, end))
    }
  }
  return "";
}

function getid(form) {

  form.chkidsave.checked = ((form.id.value = getCookie2("saveid")) != "");
  if (form.id.value=="")
  {
	form.id.value = "";
  }

 
}





function onlynum(val){
	var inText = val.value;
	var ret;
	

	for (var i = 0; i < inText.length; i++) {
		ret = inText.charCodeAt(i);
		if (!((ret > 47) && (ret < 58)))  {
			alert("¼ýÀÚ¸¸À» ÀÔ·ÂÇÏ¼¼¿ä");
			val.value = "";
			val.focus();
			return false;
		}
	}
	return true;
}

// ³¯Â¥ Ã¼Å© ÇÔ¼ö
function fn_IsLeapYear( strYear )
{
	 var year = strYear;
	 var retValue = 28;
	 
	 if(year == "" || year == null)
	 {
	  var tempDate = new Date();
	  year = tempDate.getFullYear();
	  tempDate = null;
	 } 
	 
	 if( (year%100 != 0 && year%4 == 0) || year%400==0   )
	  retValue = 29;
	 
	 return retValue;
}
function YearChk(val)
{
	var today = new Date();
	var toyear = today.getYear();
	val = parseInt(val);
	if (val < toyear  &&  val > 1900)
	{
		val1 = "0";
	}
	else
	{
		val1 =  "1";
	}

	return val1;

}

function MonthChk(val)
{
	val = parseInt(val);
	if (val >= 1  &&  val <= 12)
	{
		return "0";
	}
	else
	{
		return "1";
	}

}

function DateChk(strYear, strMonth1, strDate1)
{
	strMonth = parseInt(strMonth1);
	strDate = parseInt(strDate1);

	var chkDate = new Array;
	chkDate[1]="31";
	chkDate[2]=fn_IsLeapYear( strYear );
	chkDate[3]="31";
	chkDate[4]="30";
	chkDate[5]="31";
	chkDate[6]="30";
	chkDate[7]="31";
	chkDate[8]="31";
	chkDate[9]="30";
	chkDate[10]="31";
	chkDate[11]="30";
	chkDate[12]="31";

	if (strDate >= 1  &&  strDate <= chkDate[strMonth])
	{
		return "0";
	}
	else
	{
		return "1";
	}

}


function Loginchk()
{
	alert('·Î±×ÀÎÀ» ÇÏ¼Å¾ß »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù. ') ;
	return;
}

