﻿// 작성자	:	전영식  capnet@onesys.co.kr
// 작성일	:	2002년 7월 20일
// 내용		:	사이트에서 공통으로 상용 하는 스트립트 모음  
// 수정사항	:
//			- 일시		:  2003년 8월 20일
//			- 수정자	:  전영식 capnet@onesys.co.kr
//			- 내용		:  현 사이트에 맞게 일부 수정		

//<!--
var RESIDENTNO1 ='JYS', RESIDENTNO2='LEM' ;

// 이미지 변환 작업 시작 ----------------------------------------------------------------------------
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_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 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_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function image_change(obj, img)
{
	obj.src = img;
}

/** ---- Prototype 추가 ----------- **/

String.prototype.trim = function() {
	return this.replace(/^\s*(\b.*\b|)\s*$/, "$1"); // 문장의 앞과 뒤의 공백 제거
}

function isSpace(inChar) {
  return (inChar == ' ' || inChar == '\t' || inChar == '\n');
}

function left(inLen) {
  return this.substring(0,inLen);
}
String.prototype.left = left;

function right(inLen) {
  return this.substring((this.length-inLen),this.length);
}

String.prototype.right = right;

function mid(inStart,inLen) {
  var iEnd;
  if (!inLen)
    iEnd = this.length;
  else
    iEnd = inStart + inLen;
  return this.substring(inStart,iEnd);
}

String.prototype.mid = mid;

function ch (o) {
//if ( c ) return;
o.style.backgroundImage="";
//c=true;
}

//------------------------------------------------------------------------------------------------


//입력 폼에 값에 대한 성질 처리 함수 -------------------------------------------------------------

// form : 객체의 폼 이름
// field : 객체의 필드 이름
// vStyle : 체크할 객체의 성질.. 
// vMax_len : 객체 입력값의 최대 길이 
// vMin_len : 객체 입력값의 최소 길이
// vAlpha : 영소문자 허용 유무 허용은 true(소문자만 허용) / false(대소문자 모두 허용)
// vNumb : 숫자 허용 유무 true(숫자만 가능) / false(모두 허용)
// vName : 화면에 보여질 객체의 이름.

//*******   vStyle 에 대한 정의   *******//

/*
	Default -> 기본값 체크;
	Email -> 이메일 체크;
	Domain -> 도메인 체크 ;
	Userid -> 아이디 체크 ;
	Radio  -> Radio 버튼 체크 ;
	CheckBox -> CheckBox 체크;
	DropDownList -> 콤보박스 체크;
*/

//***************************************//

// 객체의 존재 여부를 알아 낸다.. 
function isElement(form, obj)
{
	for( var i=0; i< form.elements.length; i++) 
	{
		var ele = form.elements[i];
		if(ele.name == obj)
			return ele;		
	}
	
	return false;
}

function isValueCheck(form, field, Null_YN, vStyle, vMax_len, vMin_len, vAlpha, vNumb, vName)
{
	if(!vName){		//객체의 이름이 없으면 field 의 이름을 대신 한다.
		vName = field ;
	}
	
	if(isElement(form, field) != false)	// 객체가 존재 하면.. 
	{	
		obj = isElement(form, field);
	}
	else				// 객체가 존재하지 않을때.. 
	{
		return false;
	}
	
	if(obj.length){				// 같은 이름의 객체가 존재 할때.. 
		
		if(vStyle == 'DropDownList')
		{
			if(Null_YN)	
			{
				if(obj.selectedIndex == 0)
				{
					alert(vName + "을 선택 하세요.");
					obj.focus();
					return true;
				}
			}
		}
		else if(vStyle == 'Radio')	// 객체가 라디오 버튼 이면.. 
		{
			//alert(obj.name);
			if(obj.value.length == 0)
			{
				alert("선택된 값이 없습니다.");
				return true;
			}
		}
		else if(vStyle == 'CheckBox')
		{
			if(Null_YN != true)
			{
				var icnt = 0;
				for(var i=0; i< obj.length; i++)
				{
					if(obj[i].checked == true)
						icnt ++;
				}
				
				if(icnt == 0)
				{
					alert("선택된 값이 없습니다.");
					return true;
				}
				else if(vMin_len < vMax_len)
				{
					if(icnt < vMin_len || icnt > vMax_len)
						alert(field + "는 최소 " + vMin_len + "개 이상 " + vMax_len +" 이하 선택 되어야 합니다." );
				}
			}
		}
		else
		{
			for (var i=0; i< obj.length; i++){
				if(isValue_Style(obj[i], Null_YN, vStyle , vMax_len, vMin_len, vAlpha, vNumb,vName)){
					return true;
				}
			}
		}			
	}
	else{
	
	 if(isValue_Style(obj, Null_YN, vStyle , vMax_len, vMin_len, vAlpha, vNumb,vName)){
			return true;
		}
	}
	//alert(obj.length);
		
}

function isValue_Style(obj, Null_YN, vStyle, vMax_len, vMin_len, vAlpha, vNumb, vName)
{
	if(vStyle == 'SelectBox')
	{
		if(Null_YN == false)
		{
			if(obj.selectedIndex == 0)
			{
				alert( vName + '을(를) 선택해 주세요.');
				obj.focus();
				return true;
			}
		}
	}
	else if(vStyle == 'RadioButton')
	{
		if(Null_YN == false)
		{
			var chk = false;
			for(var i=0; i <obj.length; i++)
			{
				if(obj[i].checked == true)
				{
					chk = true;
				}
			}
			
			if(chk == false)
			{
				alert( vName + '을(를) 선택해 주세요.');
				//obj[0].focus();
				return true;
			}
		}
	}
	else if(vStyle == "CheckBox")
	{
		if(Null_YN == false)
		{
			if(vMin_len > 0 || vMax_len > 0)
			{
				var chk = 0;
				
				for(var i=0; i < obj.length; i++)
				{					
					if(obj[i].checked == true)
					{
						chk ++;
					}
				}
				
				if(chk < vMin_len || chk > vMax_len)
				{
					alert( vName + '은(는) 최소 ' + vMin_len + '개상 ~ ' + vMax_len + '이하의 갯수를 선택 해야 합니다.');
					obj[0].focus();
					return true;
				}
			}
			else
			{
				alert(vName + '은(는) 설정 오류가 발생 했습니다. 0개 이상의 갯수를 선택하여야 합니다.');
			}
		}
		else
		{
			if(vMin_len > 0 || vMax_len > 0)
			{
				var chk = 0;
				
				for(var i=0; i < obj.length; i++)
				{					
					if(obj[i].checked == true)
					{
						chk ++;
					}
				}
				if(chk > 0)
				{
					if(chk < vMin_len || chk > vMax_len)
					{
						alert( vName + '은(는) 최소 ' + vMin_len + '개상 ~ ' + vMax_len + '이하의 갯수를 선택 해야 합니다.');
						obj[0].focus();
						return true;
					}
				}
			}
		}
	}
	else if(vStyle == "ListBox")
	{
		if(Null_YN == false)
		{
			if(vMin_len > 0 || vMax_len > 0)
			{
				var chk = 0;
				
				for(var i=0; i < obj.length; i++)
				{					
					if(obj[i].selected == true)
					{
						chk ++;
					}
				}
				
				if(chk < vMin_len || chk > vMax_len)
				{
					alert( vName + '은(는) 최소 ' + vMin_len + '개상 ~ ' + vMax_len + '이하의 갯수를 선택 해야 합니다.');
					obj[0].focus();
					return true;
				}
			}
			else
			{
				alert(vName + '은(는) 설정 오류가 발생 했습니다. 0개 이상의 갯수를 선택하여야 합니다.');
			}
		}
		else
		{
			if(vMin_len > 0 || vMax_len > 0)
			{
				var chk = 0;
				
				for(var i=0; i < obj.length; i++)
				{					
					if(obj[i].selected == true)
					{
						chk ++;
					}
				}
				if(chk > 0)
				{
					if(chk < vMin_len || chk > vMax_len)
					{
						alert( vName + '은(는) 최소 ' + vMin_len + '개상 ~ ' + vMax_len + '이하의 갯수를 선택 해야 합니다.');
						obj[0].focus();
						return true;
					}
				}
				
			}
		}
	}else if (vStyle == 'Email'){    // 이메일 입력폼 일 경우 처리
		if (obj.value.length > 0){
			if (isEmail_Check(obj)){
				return true;
			}
		}else if(Null_YN == false){
			alert(vName +'은(는) 공백을 허용하지 않습니다.');
			if(obj.name.substring(0,3) != 'hid')
				obj.focus();
			return true;
		}
	}else if (vStyle == 'alphabet'){    // 영문만 입력
		if (isAlphabet_Check(obj.value, vMax_len, vMin_len)){
			obj.focus();
			return true;
		}
	}else if(vStyle == 'Domain'){   // 도메인 입력폼 일 경우 처리
		if (obj.value.length > 0){
			
			if(obj.value != "localhost" && obj.value != "local" && obj.value != "http://localhost")
			{
				if (isDomain_Check(obj)){
					return true;
				}
			}
			else
				return false;
				
		}else if(Null_YN == false){
			alert(vName +'은(는) 공백을 허용하지 않습니다.');
			obj.focus();
			return true;
		}
	}else if(vStyle == 'Userid'){   // 아이디 처리
		
		if (idcheck(obj.value, vMax_len, vMin_len)){
			obj.focus();
			return true;
		}

	
	}else if(vStyle == 'Res1'){   // 주민등록 번호 앞번호 일 경우
		if (Null_YN == false || (Null_YN == true && obj.value.length > 0)){ 
			if (obj.value.length != 0){
				RESIDENTNO1 = obj;
			}else{
				alert('주민번호 앞자리가 없습니다.');
				obj.focus();
				return true;
			}
		}
	}else if(vStyle == 'Res2'){   // 주민등록 번호 뒷번호 일 경우
		if (Null_YN == false || (Null_YN == true && obj.value.length > 0)){
			if (obj.value.length != 0){
				RESIDENTNO2 = obj;
			}else{
				alert('주민번호 뒷자리가 없습니다.');
				obj.focus();
				return true;
			}
		}
	}
	else if(vStyle == 'Default' || vStyle == 'Userid' || vStyle == 'Default2')       // 디폴트 값일 경우
	{
		if(Null_YN == false || (Null_YN == true && obj.value.length > 0))   // 값에 Null 을 허용 안하거나 null을 허용 하면서 값이 들어 있는경우..
		{
            
			if(vStyle == 'Default2')
			{
			    if (obj.value.trim().length == 0)
			    {
				    alert(vName + "은(는) 공백을 허용하지 않습니다.");
				    
				    if(obj.name.substring(0,3) != 'hid')
				        obj.focus();
				    
				    return true;
			    }
			}
			else
			{
			    if (obj.value.length == 0)
			    {
				    alert(vName + "은(는) 공백을 허용하지 않습니다.");
				    //alert(obj.name.substring(0,3));
				    if(obj.name.substring(0,3) != 'hid')
				        obj.focus();
				    
				    return true;
			    }
			}
			
			
			if(vMax_len < vMin_len)     // 값의 길이가 최대값이 최소값 보다 작을 경우
			{
				alert(vName + '의 최대 값과 최소 값 설정을 잘 못 했습니다. ');
				obj.focus();
				return true;
			}
			else                        // 값의 길이가 정상적일 경우
			{
				var vMSG='';
				if((vMax_len ==0 && vMin_len ==0) || (obj.value.length >= vMin_len && obj.value.length <= vMax_len))    // 값의 길이가 최소값이 최대값 보다 작을 경우
				{
					if(vAlpha == true && vNumb == true)
					{
						valRe = /^[_a-z0-9-]+$/;
						vMSG = vName + '은(는) 영문 소문자 또는 숫자만 가능 합니다.\n ex) abc_123 ';
					}
					else if(vAlpha == true && vNumb == false)
					{
						valRe = /^[_a-z-]+$/;
						vMSG = vName + '은(는) 영문 소문자만 가능 합니다.\n ex) abc_de-f ';
					}
					else if(vAlpha == false && vNumb == true)
					{
						valRe = /^[0-9]+$/;
						vMSG = vName + '은(는) 숫자만 가능 합니다.\n ex) 12345 ';
					}
					else if(vAlpha == false && vNumb == false){
					}
					
					if(vMSG.length > 0)
					{
						if(valRe.exec(obj.value)==null)
						{
							alert(vMSG);
							obj.focus();
							return true;
						}
				    
				    }
				}
				else        // 값의 길이가 최대값 보다 크거나 최소값 보다 작을 경우
				{
					alert(vName + '은(는) 최소 ' + vMin_len + '에서 최대' + vMax_len + '까지만 허용 합니다.');
					
					return true;				
				}
			}
		}
	}
	if (RESIDENTNO1 != 'JYS' && RESIDENTNO2 != 'LEM'){  // 주민등록번호가 초기값이 아니면 수행한다.
		if(Resident_NO_Check(RESIDENTNO1, RESIDENTNO2)){   // 주민등록 번호를 다 받았을 경우
			return true;
		}
	}
	return false;
	
}
 
// 이메일 체크
function isEmail_Check(ele){
	EmailRe = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/ ;
					
	if (EmailRe.exec(ele.value)==null){
		alert('이메일 형식이 맞지 않습니다. .\n ex) Mail@test.co.kr');
		ele.value ="";
		ele.focus();
		return true;
	}
	return false;
}
// 영문만 입력가능
function isAlphabet_Check(num, vMax_len, vMin_len) {
	var numlength;
		numlength=num.length;
		
	if(numlength == 0){
		alert("클럽URL을 넣어 주세요.");
		return true;
	}
	if(vMax_len < vMin_len) {
		alert("클럽URL의 범위 설정이 잘못 되었습니다. \n 최소 값이 최대 값 보다 클수 없습니다.");
		return true;
	}else if(vMax_len !=0 && vMin_len != 0 && vMax_len == vMin_len){    // 값의 길이가 0이 아니면서 최대값과 최소값이 같을 경우
				alert("클럽URL의 범위 설정이 잘 못 되었습니다. \n 최소 값과 최대 값이 같을 수 없습니다.");
				return true;
	}else if(numlength > vMax_len || numlength < vMin_len){
		alert("[클럽URL]은 최소 " +vMin_len+ "에서 최대 " +vMax_len+ "까지만 허용 합니다.")
		return true;
	}
	
		
		for (i=0;i<numlength;i++) 
		{
			if((num.charAt(i)<'0' || num.charAt(i)>'9') && (num.charAt(i) != '.') && (num.charAt(i) == '@') && (num.charAt(i) != '-') && (num.charAt(i) != '_') && (num.charAt(i)<'a' || num.charAt(i)>'z') && (num.charAt(i)<'A' || num.charAt(i)>'Z')) 
			{
				alert("[클럽URL]은 영문자, 숫자, '-' , '_' 만 입력이 가능합니다.");
				return true;
			}
		}
	return false;
}
//도메인 체크
function isDomain_Check(ele){
	
	if(ele.value.indexOf("http://localhost") > -1)
	{
		return false;
	}
	/**
	if(ele.value =="http://localhost" || ele.value =="localhost" || ele.value == "local" )
	{
		return false;
	}**/
	else
	{
		DomainRe_1 = /^[http://]+[~_a-zA-Z/&?=0-9-]+(\.[~_a-zA-Z/&?=0-9-]+)*[~_a-zA-Z/&?=0-9-]+(\.[~_a-zA-Z/&?_=0-9-]+)+$/ ;
		DomainRe_2 = /^[https://]+[~_a-zA-Z/&?=0-9-]+(\.[~_a-zA-Z/&?=0-9-]+)*[~_a-zA-Z/&?=0-9-]+(\.[~_a-zA-Z/&?_=0-9-]+)+$/ ;
									
		if(DomainRe_1.exec("http://" + ele.value) == null && DomainRe_2.exec("https://" + ele.value) == null)
		{
			alert("URL 형식에 맞지 않습니다. .\n ex) http://www.test.com");
			ele.value ="http://";
			ele.focus();
			
			return true;
		}
		return false;
	}
}
// 아이디 체크 
function idcheck(num, vMax_len, vMin_len) {
	var numlength;
		numlength=num.length;
		
	if(numlength == 0){
		alert("아이디를 넣어 주세요.");
		return true;
	}
	if(vMax_len < vMin_len) {
		alert("아이디의 범위 설정이 잘못 되었습니다. \n 최소 값이 최대 값 보다 클수 없습니다.");
		return true;
	}else if(vMax_len !=0 && vMin_len != 0 && vMax_len == vMin_len){    // 값의 길이가 0이 아니면서 최대값과 최소값이 같을 경우
				alert("아이디의 범위 설정이 잘 못 되었습니다. \n 최소 값과 최대 값이 같을 수 없습니다.");
				return true;
	}else if(numlength > vMax_len || numlength < vMin_len){
		alert("[아이디]는 최소 " +vMin_len+ "에서 최대 " +vMax_len+ "까지만 허용 합니다.")
		return true;
	}
	
		
		for (i=0;i<numlength;i++) {
			if ((num.charAt(i)<'0' || num.charAt(i)>'9') && (num.charAt(i) != '.') && (num.charAt(i) != '@') && (num.charAt(i) != '-') && (num.charAt(i) != '_') && (num.charAt(i)<'a' || num.charAt(i)>'z') && (num.charAt(i)<'A' || num.charAt(i)>'Z')) {
				alert("[아이디]는 영문대소문자, 숫자, '-' , '_' 만 입력이 가능합니다.");
				return true;
			}
		}
	return false;
}


// 주민등록번호 체크 공식 대입
function Resident_Computer(J1, J2){

	// 주민등록번호 1 ~ 6 자리까지의 처리
	// 주민등록번호에 숫자가 아닌 문자가 있을 때 처리

	for(i=0;i<J1.length;i++){
		if (J1.charAt(i) >= 0 || J1.charAt(i) <= 9) {
	        // 숫자면 값을 곱해 더한다.
			if(i == 0){
				SUM = (i+2) * J1.charAt(i);
			}
			else{ 
				SUM = SUM +(i+2) * J1.charAt(i);
			}
		}
		else{
	        // 숫자가 아닌 문자가 있을 때의 처리
			alert("숫자만 입력하세요");
			return true;
		}
	}

	// 주민등록번호 7 ~ 8 자리까지의 처리

	for(i=0;i<2;i++){
		if (J2.charAt(i) >= 0 || J2.charAt(i) <= 9) {
			SUM = SUM + (i+8) * J2.charAt(i);
		}
		else{
		// 숫자가 아닌 문자가 있을 때의 처리
			alert("숫자만 입력하세요");
			return true;
		}
	}


	for(i=2;i<6;i++){
	     // 주민등록번호 9 ~ 12 자리까지의 처리
	    if (J2.charAt(i) >= 0 || J2.charAt(i) <= 9) {
			SUM = SUM + (i) * J2.charAt(i);
	    }
	    else{
	    // 숫자가 아닌 문자가 있을 때의 처리
			alert("숫자만 입력하세요");
			return true;
	    }
	}

		
	// 나머지 구하기
	var checkSUM = SUM % 11;
	// 나머지가 0 이면 10 을 설정
	if(checkSUM == 0){
		var checkCODE = 10;
	    // 나머지가 1 이면 11 을 설정
	}
	else {
		if(checkSUM ==1){
			var checkCODE = 11;
	    }
	    else{
			var checkCODE = checkSUM;
	    }
	}
	// 나머지를 11 에서 뺀다
	    

	var check1 = 11 - checkCODE;
	if (J2.charAt(6) >= 0 || J2.charAt(6) <= 9) {
	   var check2 = parseInt(J2.charAt(6))
	}
	else{
	   // 숫자가 아닌 문자가 있을 때의 처리
	   alert("숫자만 입력하세요");
	   return true;
	}
	    
	if(check1 != check2){
	    // 주민등록번호가 틀릴 때의 처리
	    alert("주민등록 번호를 다시 확인 하세요.");

	    return true;
	}

return false;

}

// 주민등록번호 체크 
function Resident_NO_Check(valJ1, valJ2){

	//------------------------------주민등록 번호 체크공식 시작--------------------------------------------------
	if (RESIDENTNO1 != 'JYS' && RESIDENTNO2 != 'LEM'){  // 주민등록번호가 초기값이 아니면 수행한다.
		var obj_J1 = valJ1;
		var obj_J2 = valJ2;
		Res1 = /([0-9]{6})/;
		if (Res1.exec(obj_J1.value) == null){
			alert('주민번호 앞자리가 규칙과 틀립니다.\n 다시 확인 주세요');
			obj_J1.value = '';
			obj_J1.focus();
			return true;
		}
	
		Res2 = /([0-9]{7})/;
	
		if (Res2.exec(obj_J2.value) == null){
			alert('주민번호 뒷자리가 규칙과 틀립니다.\n 다시 확인 주세요');
			obj_J2.value = '';
			obj_J2.focus();
			return true;
		}
		
		// 주민등록 생성 공식에 대입하여 주민번호가 맞는지 검증 한다.
		if (Resident_Computer(obj_J1.value, obj_J2.value)){
			return true;
		}
		
	}else {
		alert('잘못된 주민등록 체계 입니다. \n 주민등록번호는 앞자리 입력폼과 뒷자리 입력폼이 존재 해야 합니다.');
		return true;
	}
	
	 
	return false;
}

// 변수값이 숫자만 체크 한다
function numcheck(obj, vName) 
{
	var numlength;
	var num = obj.value;
	numlength = num.length;
	
	if(numlength == 0)
	{
		alert(vName + '은(는) 공백을 허용하지 않습니다.');
		obj.focus();
		return true;
	}
	
	for(i=0;i<numlength;i++)
	{
		if(num.charAt(i)<'0' || num.charAt(i)>'9')
		{
			alert(vName + '은(는) 숫자만 가능 합니다.');
			obj.value = 0;
			return true;
		}
 	}
 	
 	if(eval(obj.value) <= 0)
 	{
 		alert(vName + '은(는) 0보다 큰 수를 입력하셔야 합니다.');
 		obj.focus();
 		return true;
 	}
 	
	return false;
}

//-------------------------------------------------------------------------------------------------


// 기타 처리 함수 모음 -------------------------------------------------------------------------------

// 체크 리스트 박스중 선택된 것은 반전 시킴
function revcheck(obj, ele_name){
		for( var i=0; i< obj.elements.length; i++) {
			var ele = obj.elements[i];
			if(ele.name == ele_name)
				ele.checked = !ele.checked;
		}
		return 
	}

// Display 처리 함수
function Detall_View(M){

	if (document.getElementById(M).style.display==''){
		document.getElementById(M).style.display='none';
	}else{
		document.getElementById(M).style.display='';
	}
}


// 지정된 객체의 값이 채워지면 다음 객체로 포커스를 이동한다.
function isAutoTab(obj,Len, NextObj) {
	
	if (obj.value.length == Len/1){
		NextObj.focus();
	}
}


// 물어보기..
function isYesNo(v)
{
	var ans	
	ans = confirm(v);

	if(ans != true) 
		return false;
}

function isAlertNo(msg)
{
	alert(msg);
	return false;
}

// 새창 띠우기
function isNew_Popup(url)
{
	window.open(url);
}

function isNew_Popup_target(url, target)
{
	window.open(url, target);
}

// 관리페이지 우편번호 검색
function AdminZipCode()
{
	srceenwidth=window.screen.width/2-200;
	srceenheight=window.screen.height/2-300;
	url='/One_Admin_/zipcode.aspx';
	window.open(url,"AdminZipCode","'toolbar=no,menubar=no,scrollbars=auto,resizable=yes,width=400, height=360, left="+srceenwidth +", top="+srceenheight+"'");
}

// 아이디 검색
function isIDCehck(valUserid){

	if(valUserid=="")
	{
		alert("아이디를 입력하세요.");
	}
	else
	{	
		srceenwidth=window.screen.width/2-225;
		srceenheight=window.screen.height/2-200;
		url='/One_Admin_/checkid.aspx?id='+valUserid;
		window.open(url,"Userid_Popup","'toolbar=no,menubar=no,scrollbar=auto,resizable=no,width=303, height=175, left="+srceenwidth +", top="+srceenheight+"'")	
	}
}


function Menu()
{
	if(document.getElementById('Hidden_Menu').style.display != '')
	{
		document.getElementById('Hidden_Menu').style.display = '';
		document.getElementById('Show_Menu').style.display = 'none';
	}
	else
	{
		document.getElementById('Hidden_Menu').style.display = 'none';
		document.getElementById('Show_Menu').style.display = '';
	}

}

function SubMenu_Event(name)
{	
	if(name =='')
	{
	/*
		for(i=1;i <= document.getElementById.length; i++)
		{
			if(document.getElementById('SubMenu' + i ))
			{
				document.getElementById('SubMenu' + i).style.display = 'none';
			}
		}
		*/
	}
	else
	{
		if(document.getElementById(name).style.display != '')
		{
		
		/**
			for(i=1;i <= document.getElementById.length; i++)
			{
				if(document.getElementById('SubMenu' + i ))
				{
					document.getElementById('SubMenu' + i).style.display = 'none';
				}
			}
		**/	
			document.getElementById(name).style.display = '';
			
		}
		else
		{
			document.getElementById(name).style.display = 'none';
			
		}
	}	
}

// 타이머 작동
function isTimer()
	{			
		
		if(document.getElementById("txtSecond").value != "59")
		{
			var intSecond = parseInt(document.getElementById("txtSecond").value * 1) + 1;
			if(intSecond < 10)
			{
				document.getElementById("txtSecond").value = "0" + intSecond ;
			}
			else
			{
				document.getElementById("txtSecond").value = intSecond ;
			}
		}
		else
		{
			document.getElementById("txtSecond").value = "00";
			
			if(document.getElementById("txtMinute").value != "59")
			{
				var intMinute = parseInt(document.getElementById("txtMinute").value * 1) + 1;
				if(intMinute < 10)
				{
					document.getElementById("txtMinute").value = "0" + intMinute ;
				}
				else
				{
					document.getElementById("txtMinute").value = intMinute ;
				}
			}
			else
			{
				document.getElementById("txtMinute").value = "00";
				var intHour = parseInt(document.getElementById("txtHour").value * 1) + 1;
				if(intHour < 10)
				{
					document.getElementById("txtHour").value = "0" + intHour ;
				}
				else
				{
					document.getElementById("txtHour").value = intHour ;
				}
			}
			
		}
		
		
		setTimeout("isTimer()",1000);
	}
	
// 서브 메뉴 변경
function show_hidelayer(div_id)
{	
	for( var i=0; i< document.all.length; i++) 
	{
		var ele = document.all(i).id;
		if(ele.indexOf('sub') == 0)
		{
			//document.getElementById(i).style.visibility = 'hidden';						
			document.all(i).style.display = 'none';
		}
	}
			
	//document.getElementById(div_id).style.visibility = 'visible';
	document.getElementById(div_id).style.display = 'block';
}

//서브 메뉴 시작점 고정(서브 메뉴를 vertical로 뿌릴때)
//2007.03.06. Yujin.
function show_hidelayer_vertical(div_id)
{	
	for( var i=0; i< document.all.length; i++) 
	{
		var ele = document.all(i).id;
		if(ele.indexOf('sub') == 0)
		{
			document.all(i).style.display = 'none';
		}
	}
			
//	document.getElementById(div_id).style.left     = event.clientX;
//	document.getElementById(div_id).style.left = left;
	
	mouseX = event.clientX ;
	mouseY = event.clientY ;
	
	var body_width = document.body.offsetWidth;								
	
	if(mouseX > parseInt(body_width * (2/3)))								
		document.getElementById(div_id).style.left = parseInt(body_width * (2/3));
	else					
		document.getElementById(div_id).style.left = mouseX;	

	document.getElementById(div_id).style.display  = 'block';
									
}

//서브 메뉴 마우스 아웃시 모든 레이어 숨기기
//2007.03.06. Yujin.
//사용 안 함
function hide_all_layer()
{
    for( var i=0; i< document.getElementById.length; i++) 
	{
		var ele = document.all(i).id;
		if(ele.indexOf('sub') == 0)
		{   
			document.all(i).style.display = 'none';
		}
	}
}

//서브 메뉴 레이어 숨기기(닫기 버튼)
//2007.03.07. Yujin
function hide_layer(div_id)
{
    document.getElementById(div_id).style.display = 'none';
}
//-----------------------------------------------------------

function bgChange(name, imgName)
{		
	name.background = imgName;
}
function img_chagne(obj)
{
	document.getElementById('img').src = obj.value;
}

function show_menu_table(client_id, flag)
{				
	for( var i=0; i< document.all.length; i++) 
	{
		var ele = document.all(i).id;
		if(ele.indexOf('sub_menu') > 0)
		{						
			document.all(i).style.display = 'none';
		}
	}		
			
	if(flag == 't')
		document.getElementById(client_id).style.display = '';
}

// 숫자만 입력가능
function IsDigitInput(txtInput) {
	if (event.keyCode<48 || event.keyCode>57) {
		return false;
	}
}


// Enter키가 눌려졌을경우 Submit하여 특정버튼 이벤트를 실행한다.
function ExecutePostBack(btnSubmit) {
	if (event.keyCode == 13) {
		__doPostBack(btnSubmit, '');
	}
}

function meeting_pop(){
	window.open('/edu/meeting_pop.aspx','meeting','height=250,width=300,top=150,left=150,status=no,toolbar=no,menubar=no,location=no,titlebar=no,scrollbars=no');	
}

function memo_pop(page_url, width, height)
{
	window.open(page_url,"memo_pop","'toolbar=no,menubar=no,scrollbars=yes,resizable=yes,height="+height+",width="+width+"'");	
}

/*
	입력 상자 처리관련
*/
function checkInputBox(fld, max_size, next_fld, typeBOOL)
{
	if(!parseFloat(max_size))
		max_size = 1048576;
	else if(parseFloat(max_size) < 1)
		max_size = 1048576;

	if(typeBOOL == 1 && !chkIntEx())
	{// 숫자만 입력...
		event.returnValue = false;
		return;
	}
	else if(typeBOOL == 2 && event.keyCode == 229)
	{// 한글 입력 취소...
		event.returnValue = false;
		return;
	}
}

function chkIntEx()
{
	if(event.keyCode == 8) return true;
	if(event.keyCode == 9) return true;
	if(event.keyCode == 45) return true;
	if(event.keyCode == 46) return true;
	if(event.keyCode == 35) return true;
	if(event.keyCode == 36) return true;
	if(event.keyCode == 36) return true;
	if(event.keyCode >= 37 && event.keyCode <= 40) return true;

	if(event.keyCode >= 48 && event.keyCode <= 57) return true;
	if(event.keyCode >= 96 && event.keyCode <= 105) return true;

	return false;
}


// 바이트 체크
function cal_pre(frm, num, lblbyte) 
{
	tmpStr = frm.value;
	cal_byte(tmpStr, frm, num, lblbyte);
}

function cal_byte(aquery, frm, num, lblbyte) 
{
	var tmpStr;
	var temp = 0;
	var onechar;
	var tcount;
	
	tcount = 0;
	
	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for(k=0; k<temp; k++)
	{
		onechar = tmpStr.charAt(k);

		if(escape(onechar).length > 4)
		{
			tcount += 2;
		}
		else if(onechar!='\r')
		{
			tcount++;
		}
	}
	
	if(lblbyte != null)
		lblbyte.innerHTML = tcount;
		
	if(tcount > num)
	{
		reserve = tcount - num;
		alert(num + '바이트 이상은 작성할수 없습니다.\r\n 쓰신 메세지는 ' + reserve + '바이트가 초과되었습니다.\r\n 초과된 부분은 자동으로 삭제됩니다.'); 
		frm.value = LeftH(tmpStr, num);
		
		lblbyte.innerHTML = 80;
	}
}

function LeftH(str, cnt)
{
	var k = 0;
	var i;
	var ss='';
	
	for(i=1; i<=cnt; i++)
	{
		if(escape(str.charAt(k)).length > 4)
		{
			i = i + 1;
		}
			
		if(i <= cnt)
			ss = ss + str.charAt(k);
		k = k + 1;
	}
	
	return ss;
}

// 핸드폰번호체크
function chkMobileNum(phoneNum)
{
	if(!parseFloat(phoneNum) || (phoneNum.length != 10 && phoneNum.length != 11))
		return false;

	switch(phoneNum.substring(0, 3))
	{
		case "010" :
		case "011" :
		case "013" :
		case "016" :
		case "017" :
		case "018" :
		case "019" :
		case "010" :
			var chkNum = "";
			chkNum = phoneNum.substring(3, phoneNum.length-4);

			if(parseFloat(chkNum) == 0)
				return false;
				
			break;
		default :
			return false;
	}

	return true;
}

// 해당 년/월에 따른 일 보여주기(dropdownlist일 경우)
function ShowDay(form, field_dd, field_yy, field_mm)
{
	if((isElement(form, field_dd) != false) || (isElement(form, field_yy) != false) || (isElement(form, field_mm) != false))	// 객체가 존재 하면.. 
	{	
		obj = isElement(form, field_dd);
		var yy = isElement(form, field_yy).value;
		var mm = isElement(form, field_mm).value;
		var lastday;

		switch (eval(mm))
		{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:
				lastday = 31;
				break;
			case 2:
				lastday = (new Date("03/00/" + yy)).getDate();
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				lastday = 30;
				break;
		}
		
		if(obj.length > lastday)
		{
			var j=0;
			for(var i=lastday; i<31; i++)
			{
				obj.options[i-j] = null;
				j++;
			}
		}
		else
		{
			for(var i=obj.length; i<lastday; i++)
			{
				var new_option = new Option(i+1, i);
				obj.options.add(new_option, i+1);
			}
		}
	}
	else
	{
		alert('객체가 존재하지 않습니다');
	}
	
}

// HTML 태그 처리
function strFromDb(str)
{       
    str = str.replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&amp;/gi, "&").replace(/<br>/gi, "\r\n");

    return str;  
}    

function strToDb(str)
{
    str = str.replace(/</gi, "&lt;").replace(/>/gi, "&gt;").replace(/&/gi, "&amp;").replace(/\r\n/gi, "<br>");

    return str;  
} 

// 숫자 체크
function IsNum(strval)
{
    var flag = true;

    for(var i=0; i<strval.length && flag ; i++)
    {
        var strch = strval.charAt(i).toUpperCase();

        if((strch>="0" && strch<="9") || strch==".") continue;

        flag = false;
    }
	
    return flag;
}

// 정수 체크
function IsInt(strval)
{
    var flag = true;

    for(var i=0; i<strval.length && flag ; i++)
    {
        var strch = strval.charAt(i).toUpperCase();

        if((strch>="0" && strch<="9")) continue;

        flag = false;
    }
	
    return flag;
}

    // 숫자체크 : onkeyup
    function chkNum(obj)
    {        
        try
        {
            obj.style.textAlign = 'right';
        }
        catch(e)
        {
        }
        
        var strval = RemoveComma(obj.value);
        var result = "";
        
        for(var i=0 ; i<strval.length ; i++)
        {
            if(!IsNum(strval.substring(i, i+1)))
            {
                alert('숫자만  입력가능합니다.');
                
                break;
            }
            
            result += strval.substring(i, i+1);
        }
        
        return AddComma(result);
        
    }
    
    // 콤마없는 숫자 : onkeyup
    function chkNumNotComma(obj)
    {
        var value = obj.value;
        var result = "";
        
        for(var i=0 ; i<value.length ; i++)
        {
            if(!IsNum(strval.substring(i, i+1)))
            {
                alert('숫자만  입력가능합니다.');
                
                break;
            }
            
            result += strval.substring(i, i+1);
        }
        
        result;
    }
    
    // onkeyup
    function rtrTime(obj)
    {
        var strVal = obj.value;
        var result = "";
        
        for(var i=0 ; i<strVal.length ; i++)
        {
            if(!(strVal>="0" && strVal<="9"))
            {
                alert('숫자만 입력가능합니다.');
                
                break;
            }
            
            result += strVal.substring(i, i+1);
        }
        
        if(parseInt(result, 10) >= 60)
        {
            alert('60보다 작아야 합니다.');
            
            return "";
        }
        
        
        return result;
    }
    
    function rtwoTime(obj)
    {
        var strVal = obj.value;
        
        if(strVal.length == 1)
            strVal = "0" + strVal;
        
        return strVal;
    }
    
    function chkTime(obj)
    {
        for(var i=0 ; i<strVal.length ; i++)
        {
            if(!(val>="0" && val<="9"))
            {
                alert('숫자만 입력가능합니다.');
                obj.select();
                
                return false;
            }
        }
        
        if(parseInt(result, 10) >= 60)
        {
            alert('60보다 작아야 합니다.');
            obj.select();
            
            return false;
        }
    }

    // 입력 체크시 공백, 숫자, 크기 확인
    function isBlankChkNum(obj, size, objName)
    {
        var flag = false
        
        if(obj)
        {
            if(obj.value.trim() == "")
            {
                alert(objName + '값을 입력하세요');
                obj.focus();
            }
            else
            {
                if(!IsNum(RemoveComma(obj.value.trim())))
                {
                    alert(objName + ' : 숫자만 입력가능합니다.');
                    obj.select();
                } 
                else
                {
                    if(RemoveComma(obj.value.trim()).length > size)
                    {
                        alert(objName + '의 값이 ' + size + '자리 보다 큽니다.');
                        obj.select();
                    }
                    else
                    {
                        flag = true;
                    }
                }
            }
        }
        else
        {
            alert(objName + '객체를 찾을 수 없습니다.');
        }
        
        return flag;
    } 

   
// 입력 체크시 숫자, 크기 확인
function isChkNum(obj, size, objName)
{
    var flag = false
    
    if(obj)
    {
        if(!IsNum(RemoveComma(obj.value)))
        {
            alert(objName + ' : 숫자만 입력가능합니다.');
            obj.select();
        } 
        else
        {
            if(RemoveComma(obj.value).length > size)
            {
                alert(objName + '의 값이 ' + size + '자리 보다 큽니다.');
                obj.select();
            }
            else
            {
                flag = true;
            }
        }
    }
    
    return flag;
}

function isChkInt(obj, size, objName, isBlank)
{    
    if(!isBlank) // 공백금지
    {
        if(obj.value == "")
        {
            alert(objName + '의 값을 입력하세요');
            obj.focus();
            
            return false;
        }
    }
    
    if(obj.value != "")
    {
        if(!IsInt(RemoveComma(obj.value)))
        {
            alert(objName + ' 의 값은 숫자만 입력가능합니다.');
            obj.select();
            
            return false;
        }
        
        if(RemoveComma(obj.value).length > size)
        {
            alert(objName + '의 값이 ' + size + '자리 보다 큽니다.');
            obj.select();
             
            return false;
       }
    }
    
    return true;
}


    // 양의 정수값 체크
    function chkPlusInt(obj)
    {                
        if(event.keyCode == 9)
        {
            obj.select();
            
            return;
        }
        
        var strval = RemoveComma(obj.value);
        var result = "";
                
        for(var i=0 ; i<strval.length ; i++)
        {
            if(!IsInt(strval.substring(i, i+1)))
            {
                alert('숫자만  입력가능합니다.');
                
                if(result == "")
                    result = 0;
                obj.value = AddComma(result);
                
                return;
            }
            
            result += strval.substring(i, i+1);
        }
        
        if(result == "")
            result = 0;
            
        obj.value = AddComma(result);
        
    }

function chkPhone(obj)
{
    if(obj.value != "")
    {
        var strVal = obj.value;
        var result = "";
                
        for(var i=0 ; i<strVal.length ; i++)
        {
            if(!((strVal>="0" && strVal<="9") || strVal == "-"))
            {
                alert('전화번호 형식에 맞지 않습니다.');
                
                if(result == "")
                    result = 0;
                obj.value = result;
                
                return;
            }
            
            result += strVal.substring(i, i+1);
        }
    }
    
    return true;
}
      
//
function isChkFloat(obj, fLen, sLen, objName, isBlank)
{    
    if(!isBlank) // 공백금지
    {
        if(obj.value == "")
        {
            alert(objName + '의 값을 입력하세요');
            obj.focus();
            
            return false;
        }
    }
    
    if(obj.value != "")
    {
        if(!IsValidFloat2(obj, fLen, sLen, objName))
        {
            return false;
        }
    }
    
    return true;
}
      
// 숫자에서 콤마(,) 제거
function RemoveComma(strval)
{
	var val='';
	if (strval == "" || strval == null)
	{
		return val;
	}
	for(i=strval.length; i>0; i--)
	{
		if(strval.substring(i,i-1) != ",")
		{
			val = strval.substring(i,i-1)+val;
		}
	}
	
	return val;
}

// 

// 숫자 1,000 단위로 쉼표(,) 추가 
function AddComma(strval)
{   
    strval = strval.toString();
    
	var strch = strval.charAt(0);
	var signed = (strch=="-" ? true : false);		

	var strval1 = strval;
	if (strch=="+" || strch=="-") strval1 = strval.substring(1, strval.length);	//부호 제외한 값
	
	var strvalnc = RemoveComma(strval1);	

	var vals = strvalnc.split(".");
	
	var vali = vals[0];				
	var vald = vals[1];				
	
	var res = "";
	
	if (vali.length%3) 
		res = vali.substring(0, vali.length%3) + (vali.length>3 ? "," : "");
	
	for(var i=vali.length%3; i<vali.length; i+=3) 
	{
		res += vali.substring(i, i+3) + (i<vali.length-3 ? "," : "");
	}
	
	return (signed ? ("-" + res) : res) + (vald==null ? "" : "." + vald);
}

// 문자열길이 크기 동일성 체크
function isSameStrSize(strval, len)
{
	var nBytes = 0;
	
	for(i=0; i<strval.length;i++)
	{
		var strch=strval.charCodeAt(i);
		
		if (strch>128)
		{
			nBytes += 2;
		}
		else
		{
			nBytes++;
		}
	}
	
	if(nBytes != len) 
		return false;
	else  
		return true;
}

// 문자열길이 유효성 체크
function IsValidString(strval,len)
{
	var nBytes = 0;
	
	for(i=0; i<strval.length;i++)
	{
		var strch=strval.charCodeAt(i);
		
		if (strch>128)
		{
			nBytes += 2;
		}
		else
		{
			nBytes++;
		}
	}
    
	if(nBytes > len) 
		return false;
	else  
		return true;
}

function IsValidStr(obj, size, objName, allowBlank) // obj:TextBox, size:최대크기, objName:TextBox 명칭, allowBlank:빈값 허용여부 
{
    if(obj)
    {
        if(!allowBlank)
        {
            if(obj.value == "")
            {
                alert(objName + "의 값을 입력하세요");
                obj.focus();
                
                return false;
            }
        }
        
        if(obj.value != "")
        {
            if(!IsValidString(obj.value, size))
            {
                alert(objName + "의 내용은 " + size + "byte를 초과할 수 없습니다.");
                obj.select();
                
                return false;
            }
        }
        
        return true;
   }
}

// 실수 길이 체크
function IsValidFloat(strval, fLen, sLen, msg)
{
    
    if(!IsNum(strval))
    {
        alert(msg +'는 숫자만 가능합니다.');
        
        return false;
    }
    
    var fNum = strval.split(".")[0];
    var sNum = strval.split(".")[1];
    
    if(fNum.length > fLen - sLen)
    {
        alert(msg +'의 정수값이 ' + (fLen - sLen) + '자리를 초과합니다.');
        return false;
    }
    
    if(sNum != null)
    {        
        if(sNum.length > sLen)
        {
            alert(msg +'의 실수값이 ' + sLen + '자리를 초과합니다.');
            return false;
        }
    }
        
    return true;      
}

// 실수 길이 체크
function IsValidFloat2(obj, fLen, sLen, msg)
{
    var strval = RemoveComma(obj.value);
    
    if(!IsNum(strval))
    {
        alert(msg +'는 숫자만 가능합니다.');
        obj.select();
        
        return false;
    }
    
    var fNum = strval.split(".")[0];
    var sNum = strval.split(".")[1];
    
    if(fNum.length > fLen - sLen)
    {
        alert(msg +'의 정수값이 ' + (fLen - sLen) + '자리를 초과합니다.');
        obj.select();
       
        return false;
    }
    
    if(sNum != null)
    {        
        if(sNum.length > sLen)
        {
            alert(msg +'의 실수값이 ' + sLen + '자리를 초과합니다.');
            obj.select();
            
            return false;
        }
    }
        
    return true;      
}


// 초기화
function blockReset(el)
{
    if(el != null)
    {
          for(var i=0 ; i<el.childNodes.length ; i++)
          {
                // TextBox
                if((el.childNodes[i].nodeName.toLowerCase() == "input" && el.childNodes[i].type == "text") || el.childNodes[i].nodeName.toLowerCase() == "textarea")
                {
                    el.childNodes[i].value = "";
                }
				// DropDownList 
                if(el.childNodes[i].nodeName.toLowerCase() == "select")
                {
                    el.childNodes[i].selectedIndex = 0;
                }
                
                blockReset(el.childNodes[i]);
          }
    }
}

// 공백확인
function chkEmpty(el)
{
    if(el != null)
    {
          for(var i=0 ; i<el.childNodes.length ; i++)
          {
                if((el.childNodes[i].nodeName.toLowerCase() == "input" && el.childNodes[i].type.toLowerCase() == "text") || el.childNodes[i].nodeName.toLowerCase() == "textarea")
                {
                    if(el.childNodes[i].value == "")
                    {
                        alert("필수입력사항을 확인하세요.");
                        
                        el.childNodes[i].focus();
                     
                        return false;  
                    }
                }
                else
                {
                    if(!chkEmpty(el.childNodes[i]))
                        return false;
                }
          }//for
    }//if(el != null)
    
    return true;
}
 

function movePage(msg, page)
{
    alert(msg);
    
    document.location.href = page;
}

function NewPopUp(Nurl, Nname, sw, sh, Tbar, Sbar, Mbar)
{
	cw = screen.availWidth; // 화면 너비
	ch = screen.availHeight; // 화면 높이

	// sw : 띄울 창의 너비
	// sh : 띄울 창의 높이

	ml = (cw-sw)/2;// 가운데 띄우기위한 창의 x위치
	mt = (ch-sh)/2;// 가운데 띄우기위한 창의 y위치

	window.open(Nurl, Nname, 'width='+sw+',height='+sh+',top='+mt+',left='+ml+',toolbar='+Tbar+',scrollbars='+Sbar+',menubar='+Mbar+',status=no,directories=no');
}

/* 오늘 날짜 : yyyy-mm-dd 형식 */
function getToday()
{
	var today	= new Date();
    var year, month, day
    year		= today.getFullYear();
    month		= (today.getMonth() + 1).toString();
    if(month.length == 1)
        month	= "0" + month;
    day			= (today.getDate()).toString();
    if(day.length == 1)
        day		= "0" + day;
        
	var tDay	= year + "-" + month +"-" + day;				//오늘
	
	return tDay;
}

// 오늘 날짜와 비교
function isLargeToday(date)
{
    var today = getToday();
    
    if(date.replace(/-/gi, '') > today.replace(/-/gi, ''))
    {
        return true;
    }
    else
    {
        return false;
    }
}

// 문자열 바이트 수만큼 추출
function getByteText(str, len)
{
    var cnt     = 0;
    var text    = "";
    var enter   = /\r\n|\r|\n/g;
    
    for(var i=0 ; i<str.length ; i++)
    {		  
        if(escape(str.charAt(i)).length > 4 )
        {
            cnt += 2;
        }
        else
        {
            cnt++;
        }
                
        if(cnt <= len)
        {
            text += str.charAt(i);
        }
    }
   
    return text;
}

// 문자열 바이트 수반환
function myGetBytes(str)
{
    var nBytes = 0;
    for(var i=0 ; i<str.length ; i++)
    {		  
        var strCh   = str.charCodeAt(i);		        
        
        if(strCh>128)
        {
            nBytes += 2;
        }
        else
        {
            nBytes++;
        }
    }
    
    return nBytes;    
}


// line 수 추출
function getLineCnt(string)
{
    var enter   = /\r\n|\r|\n/g;
    var cnt     = 0;
    
    while(enter.exec(string))
    {
        cnt++;
    }
    
    return cnt;

}

// TextArea row 제한 : onkeypress
function fixRowTextArea(textarea)
{
    var rows      = parseInt(textarea.rows);
    var lineCnt   = getLineCnt(textarea.value);
      
    if(lineCnt > rows -1  )
    {
        event.keyCode = '';
        
        return false;
    }
    else
    {
        return true;
    }
}

// iframe height 조정

function resizeIframe(iframeObj)
{
    if(iframeObj)
    {
        if(navigator.appName == 'Microsoft Internet Explorer' ) 
        {
            var innerBody   = iframeObj.contentWindow.document.body;            
            var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
            iframeObj.style.height = innerHeight;
        }
    }   
    
    if(parent.reHeightSize)
    {
        parent.reHeightSize();
    }
}

// 면적 평형 환산
function openExchangeArea()
{
    window.open("/FranchNet/AreaExchanger.aspx", '평형환산', 'width=450, height=280');
}


// 2007.10.15. 디자이너 추가
function makeSelectBox02(thisId,optionParam) {
	var downArrowSrc = "image/selectbox_footer.gif";	//오른쪽 화살표이미지
	var classNameHeader = "selectBoxTypeB_"; // CSS 파일에서 Class명 Header 값 (한 사이트에서 셀렉트박스 디자인이 여러개일 경우 Class를 따로 지정하기위해 변수로 분리해놉니다.
	var downArrowSrcWidth = 19;	//오른쪽 화살표이미지 width
	var optionHeight = 19; // option 하나의 높이
	var optionMaxNum = 6; // 한번에 보여지는 option의 갯수
	var hideNullValue = false; // value가 없거나 빈값이면 인덱스로 취급하고 뿌려주지 않게하려면 true, 상관없이 모두 보여주려면 false.
	var isPutup = false;
	
	if (optionParam != null && optionParam != "") { // optionParam 를 설정했으면 그에 맞게 셋팅해준다.
		if (getOptionParameter("putup",optionParam) == "yes") isPutup = true; // 옵션항목 레이어를 위로 보여기로 선택한경우
		var userMaxNum = parseInt(getOptionParameter("option",optionParam));
		if (userMaxNum > 0) optionMaxNum = userMaxNum;	// 옵션항목 갯수를 임의로 지정한 경우
		var userClassHeader = getOptionParameter("classHeader",optionParam);
		if (userClassHeader != "") classNameHeader = userClassHeader; // 별도의 스킨을 지정한 경우
	}
	
	var optionInnerLayerHeight = 0;
	var objId = thisId;
	var obj = document.getElementById(objId);
	var selectBoxWidth = parseInt(obj.style.width);
	var selectBoxHeight = parseInt(obj.style.height);
	if (obj.options.length > optionMaxNum) optionInnerLayerHeight = optionHeight * optionMaxNum;
	
	
	newSelect = "<div style='position:absolute;z-index:50;'>";
	newSelect += "<table id='" + objId + "selectBoxOptionLayer' cellpadding='0' cellspacing='0' border='0' style='position:relative;z-index:100;display:none;' onMouseOver=\"viewOptionLayer('"+ objId + "')\" onMouseOut=\"setMousePosition('out')\">";
	
	var coverHTML = ""; // selectbox 위에 얹혀지는 투명레이어 (수정할 필요 없음.)
	coverHTML += "	<tr>";
	coverHTML += "		<td height='" + (selectBoxHeight - 1) + "' style='cursor:hand;' onClick=\"hideOptionLayer('"+ objId + "')\"></td>";
	coverHTML += "	</tr>";
	if (!isPutup) newSelect += coverHTML; // 옵션항목 레이어가 아래로 보여질경우.
	
	newSelect += "	<tr>";
	newSelect += "		<td bgcolor='#5f5f5' style='padding:1px 1px 1px 1px'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
	newSelect += "			<tr>";
	newSelect += "				<td height='3' bgcolor='#5F5F5F'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		<div class='"+ classNameHeader +"OptionInnerLayer' style='width:" + (selectBoxWidth-2) + "px;height:" + optionInnerLayerHeight + ";'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%' style='table-layout:fixed;word-break:break-all;'>";
	var defaultShowedOptionsNum = 0;
	for (var i=0 ; i < obj.options.length ; i++) {
		var nowValue = obj.options[i].value.replace(/'/g,"&rsquo;");
		var nowText = obj.options[i].text.replace(/'/g,"&rsquo;");;
		if (((!hideNullValue)||nowValue != null)&&((!hideNullValue)||nowValue != "")) {
			newSelect += "			<tr>";
			newSelect += "				<td height='" + optionHeight + "' class='"+ classNameHeader +"Option' onMouseOver=\"this.className='"+ classNameHeader +"OptionOver'\" onMouseOut=\"this.className='"+ classNameHeader +"Option'\" onClick=\"selectThisValue('"+ objId + "'," + i + ",'" + nowValue + "','" + nowText + "','" + classNameHeader + "')\" style='cursor:hand;'>" + nowText + "</td>";
			newSelect += "				<input type='hidden' id='"+ objId + "SelectBoxOptionValue" + i + "' value='" + nowValue + "'>";
			newSelect += "			</tr>";
			if (defaultShowedOptionsNum < optionMaxNum) defaultShowedOptionsNum++;
		}
	}
	newSelect += "		</table>";
	newSelect += "		</div>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
	newSelect += "			<tr>";
	newSelect += "				<td height='3' bgcolor='#5F5F5F'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	
	if (isPutup) newSelect += coverHTML; // 옵션항목 레이어가 위로 보여질경우.
	newSelect += "</table>";
	newSelect += "</div>";
	
	newSelect += "<table id='testArea' cellpadding='0' cellspacing='1' border='0' bgcolor='#5f5f5' onClick=\"viewOptionLayer('"+ objId + "')\" style='cursor:hand;' onMouseOut=\"setMousePosition('out')\">";
	newSelect += "	<tr>";
	newSelect += "		<td bgcolor='#5F5F5F'>";
	newSelect += "		<table cellpadding='0' cellspacing='0' border='0'>";
	newSelect += "			<tr>";
	newSelect += "				<td><div id='" + objId + "selectBoxSelectedValue' class='"+ classNameHeader +"SelectedArea' style='width:" + (selectBoxWidth - downArrowSrcWidth - 2) + "px;height:" + (selectBoxHeight - 2) + "px;overflow:hidden;' onBlur=\"selectBoxBlur('" + objId + "','" + classNameHeader + "')\"></div></td>";
	newSelect += "				<td><img src='" + downArrowSrc + "' width='" + downArrowSrcWidth + "' border='0'></td>";
	newSelect += "			</tr>";
	newSelect += "		</table>";
	newSelect += "		</td>";
	newSelect += "	</tr>";
	newSelect += "</table>";
	document.write(newSelect);
	
	if (isPutup) { // 옵션항목 레이어가 위로 보여질경우.
		var optionLayerTopMargin = 7; // 옵션항목 레이어가 뜨는 위치 조절시 수치를 변경해줍니다.
		var innerDivTop = (-1)*((optionHeight * defaultShowedOptionsNum) + optionLayerTopMargin);	// 옵션항목레이어의 높이 + 옵션항목 위아래 margin 및 추가 여백
		document.getElementById(objId+"selectBoxOptionLayer").style.top = innerDivTop;
	}
	
	var haveSelectedValue = false;
	for (var i=0 ; i < obj.options.length ; i++) {
		if (obj.options[i].selected == true) {
			haveSelectedValue = true;
			settingValue(objId,obj.options[i].text);
		}
	}
	if (!haveSelectedValue) settingValue(objId,obj.options[0].text);
}

//////////////////////////////////////
// IE Embed patch
//
// @author iezn@iezn.com
// @homepage http://iezn.com
// @create date 2006.04.19
// @last modify 2006.04.25
// @version 0.41
// 배포시 위내용을 포함해 주시기 바랍니다
// 사용방법 : <script src="경로/iepatch.js"></script>
//////////////////////////////////////
/*
* embed 패치 적용 컨테이너
* null인경우 document 값을 기본으로 합니다
* id값을 설정한경우 설정범위 내에만 적용이 됩니다
* 
* 본문이나 일부 노드에만 적용할경우 해당 노드의 id 값을 입력하실 수 있습니다
* 예)
* var __embed_target_id = "contents";
* 로 처리한경우 body 내에 <태그 id="contents">플래쉬,동영상...</태그>
* 안에 내용에만 패치가 적용됩니다
*/
if(typeof(__embed_target_id)=='undefined'){
	var __embed_target_id = null;
}

/**
* embed 패치를 적용할 태그를 설정합니다
* 기본값은 object,eembed,appelt 태그입니다
* false 값인경우 패치에서 제외됩니다
*/
if(typeof(__embed_tags)=='undefined'){
	var __embed_tags = {object:true,embed:true,applet:false}
}

/**
* 플래쉬파일중 flashvars 를 사용할경우 해당 플래쉬의 오브젝트아이디:true 값으로 object를 등록해 주세요
*/
var __flash_force_objs = {};

if(document.attachEvent){
	document.write('<style type="text/css">');
	document.write('object,embed{display:none;}');
	document.write('</style>');
	document.attachEvent('onreadystatechange',
		function (){
			
			if(__embed_target_id===null){
				var __target = document;
			}else{
				var __target = document.getElementById(__embed_target_id);
			}
			if (document.readyState == "complete"){
				function _replace(obj){
					var obj_re = document.createElement(obj.outerHTML);					
					obj_re.style.display='inline';
					obj.parentNode.replaceChild(obj_re,obj);
				}
				function _inner(obj){
					obj.style.display='inline';					
					var html = obj.outerHTML;
					var classid = obj.classid.toLowerCase();
					if(classid=='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' && typeof(__flash_force_objs[obj.id])=='undefined'){//flash 인경우
						obj.insertAdjacentHTML('beforeBegin',html);
						obj.parentNode.removeChild(obj);
					}else{						
						//변경하고자하는 ActiveX classid 를 추가하시기 바랍니다
						if(classid=='clsid:6bf52a52-394a-11d3-b153-00c04f79faa6' || //media 7
						classid=='clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95' || //6.4
						classid=='clsid:6bf52a52-394a-11d3-b153-00c04f79faa6' ||
						classid=='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ||
						classid=='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
											
						){//media player 10
							embed_pos = html.indexOf('embed');
							if(embed_pos!=-1){//embed 가 존재하는경우
								var embed = '<'+html.substr(embed_pos);
								embed = embed.substr(0,embed.length-9);
								obj.insertAdjacentHTML('beforeBegin',embed);
								obj.parentNode.removeChild(obj);
							}else{
								//object로만 되어 있는경우 동영상 부분만 패치한다
								var embed = document.createElement('embed');
								var total = obj.childNodes.length;
								embed.setAttribute('autostart',0);
								if(obj.width){
									embed.setAttribute('width',obj.width);
								}
								if(obj.height){
									embed.setAttribute('height',obj.height);
								}
								for(var k=0;k<total;k++){
									n = obj.childNodes.item(k).getAttribute("name");
									v = obj.childNodes.item(k).getAttribute("value");
									if(n=='URL' || n=='url' || n=='FileName'){
										n = 'src';
									}
									embed.setAttribute(n,v);
								}
								if(embed.getAttribute('src')){
									embed.style.display = 'inline';
									obj.parentNode.replaceChild(embed,obj);
								}else{
									//파일엑세스 object가 아닌경우는 유지한다								
								}
							}
						}
					}
				}

				if(__embed_tags.object===true){
					var objs = __target.getElementsByTagName('object');
					var i = objs.length;
					while(i-->0){
						_inner(objs[i]);
					}
				}
				if(__embed_tags.embed===true){
					var objs = __target.getElementsByTagName('embed');
					var i = objs.length;
					while(i-->0){
						_replace(objs[i])
					}
				}

				if(__embed_tags.applet===true){
					var objs = __target.getElementsByTagName('applet');
					var i = objs.length;
					while(i-->0){
						_replace(objs[i])
					}
				}
			}
		}
	);
}

//점선링크삭제

function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring; 


// remove prototype 추가 : 2008.03.04
function remove(str)
{
    var sIndex = this.indexOf(str);
    
    //substring의 뜻은 인덱스 첫번째 문자에서 인덱스 두번째 문자까지를 가져오겠다는 뜻.    
    return this.substring(0, sIndex) + this.substring(sIndex + str.length , this.length);
}

String.prototype.remove = remove;

