//***********************************************************************//
//***********************************************************************//
//																		 
//	Title					: include javascript file							 
//	Author				: ÃÖ°­½Ä									 
//	Date					: 2006. 11. 07
//  Modify				: 
//	Description		: Client Side Script								 
//																														
//***********************************************************************//
//***********************************************************************//

//=======================================
//  Á¦¾àÁ¶°Ç
//  »ç¿ëÀÚ - ÃÖ°­½Ä
//=======================================
function Tcheck(target, cmt, astr, lmin, lmax){
		var i;
		var t = target.value;
		if (t.length < lmin || t.length > lmax) {
			if (lmin == lmax) alert(cmt + '´Â ' + lmin + ' ÀÚ ÀÌ¾î¾ß ÇÕ´Ï´Ù');
				 else alert(cmt + '´Â ' + lmin + ' ~ ' + lmax + ' ÀÚ ÀÌ³»·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù');
			target.focus();
			return true;
		}
		if (astr.length > 1) {
			for (i=0; i < t.length; i++){
				if(astr.indexOf(t.substring(i,i+1))<0) {
					alert(cmt + '¿¡ Çã¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÔ·ÂµÇ¾ú½À´Ï´Ù');
					target.focus();
					return true;
				}
			}
		}
		return false;
	}

//=======================================
//  ÁÖ¹Î¹øÈ£Ã¼Å©
//  »ç¿ëÀÚ - ÃÖ°­½Ä
//=======================================
function social_id_check(f) {
	var jumin = form.socialid1.value+form.socialid2.value;

	if(Jumin_chk(jumin)) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ Æ²¸®°Å³ª Àß¸øµÈ ÁÖ¹Î¹øÈ£ÀÔ´Ï´Ù.");
		form.socialid1.focus();
		return true;
	}
	return false;
	}

	function Jumin_chk(it) {
		IDtot = 0;
		IDAdd = "234567892345";

		for(i=0; i<12; i++) IDtot = IDtot + parseInt(it.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(it.substring(12, 13)) != IDtot) return true;
		else return false;
	}


//=======================================
//  ÀüÀÚ¿ìÆíÃ¼Å©
//  »ç¿ëÀÚ - ÃÖ°­½Ä
//=======================================
function email_chk(email){
	var t = email.value;
	var ValidFlag = false;
	var atCount = 0;
	var SpecialFlag;
	var atLoop;
	var atChr;
	var BadFlag;
	var tAry1;
	var UserName;
	var DomainName;

	if ( t.length > 0 && t.indexOf("@") > 0 && t.indexOf(".") > 0 ) {
		atCount = 0;
		SpecialFlag = false;

		for( atLoop=1; atLoop<=t.length; atLoop++ ) {
			atChr = t.substring( atLoop, atLoop+1 );
			if ( atChr == "@" ) atCount = atCount + 1;

			if ( (atChr >= 32) && (atChr <= 44) ) SpecialFlag = true;
			if ( (atChr == 47) || (atChr == 96) || (atChr >= 123) ) SpecialFlag = true;
			if ( (atChr >= 58) && (atChr <= 63) ) SpecialFlag = true;
			if ( (atChr >= 91) && (atChr <= 94) ) SpecialFlag = true;
		}

		if ( ( atCount == 1 ) && (SpecialFlag == false ) ) {
			BadFlag = false;
			tAry1 = t.split("@");
			UserName = tAry1[0];
			DomainName = tAry1[1];
			if ( (UserName.length <= 0 ) || (DomainName.length <= 0 ) ) BadFlag = true;
			if ( DomainName.substring( 1, 2 ) == "." ) BadFlag = true;
			if ( DomainName.substring( DomainName.length-1, DomainName.length) == "." ) BadFlag = true;
			if (DomainName == "hanmail.net") BadFlag = true;
			if (DomainName == "daum.net") BadFlag = true;
			ValidFlag = true;
		}
	}
	if ( BadFlag == true ) ValidFlag = false;
	return ValidFlag;
}

//=======================================
//  ¶óµð¿À¹öÆ° Á¦¾àÁ¶°Ç
//  »ç¿ëÀÚ - ÃÖ°­½Ä
//=======================================
function checkRadio(InputName){
		if (InputName.checked){  //ÇÏ³ªÀÏ °æ¿ì
			return true;
		}
		for(i=0;i<InputName.length;i++){  //¿©·¯°³ÀÏ °æ¿ì 
			if(InputName[i].checked == true){
				return true;
			}
		}
		return false;
	}

//=======================================
//  ¾ÆÀÌÇÁ·¹ÀÓ Å©±âÁ¶Àý
//  »ç¿ëÀÚ - ÃÖ°­½Ä
//=======================================
function reSize(objName)
{
        var obj = document.all[objName];
        var frameBody = obj.document.body;
        obj.style.height = frameBody.height;
        obj.style.width= '100%';
}