	// Companion 적용을 위해 파일 인코딩을 반드시 UTF-8로 설정

	var isIe8 = false;
	var navigatorInfo = navigator.userAgent.toLowerCase();
	if(navigatorInfo.indexOf("msie 7.0") > -1 && navigatorInfo.indexOf("trident/") > -1) {
		isIe8 = true;
	}

	function cfSelectValuesCheckOff(checkBoxId) {
		$("#"+checkBoxId)[0].checked = false;
		return;
	}
	
	function cfFocusOfLen(originObjId, targetObjId, length) {
		if($("#"+originObjId)[0].value.length >= length) {
			$("#"+targetObjId)[0].focus();
		}
	}
	
	function cfMngrLogout() {
		//location.href = "/ebill.ep.admin.loginMngr.cmd.FindLogoutMngr.xx";
		XecureNavigate("/ebill.ep.admin.loginMngr.cmd.FindLogoutMngr.xx", "_self");
	}

	function cfViewQService(key) {
		if(key == "open") {
			$("#q_service")[0].style.display = "";
			if( !isIe8 ) {
				$("select").hide();				
				$("#family").show();		
			}
		} else {
			$("#q_service")[0].style.display = "none";
			if( !isIe8 ) {
				$("select").show();
			}
		}		
	}
	
	
	//특수문자 제한
	function cfInputCheckSpecialKey(obj){
	  //re = /[~!@\#$%^&*\()\-=+_']/gi;
	  re = /[~!@\#$%^&*\()\-=+'`]/gi;
	  re2 = /\s/g;
	  if(re.test(obj.value)){
	     alert("특수문자는 입력하실수 없습니다.");
	     obj.value=obj.value.replace(re,"");
	  } else if(re2.test(obj.value)) {
	  	 alert("특수문자는 입력하실수 없습니다.");
	     obj.value=obj.value.replace(re2,"");
	  }
	}
	
	//특수문자 제한(스페이스바 제외)
	function cfInputCheckSpecialKeySpacebar(obj){
	  //re = /[~!@\#$%^&*\()\-=+_']/gi;
	  re = /[~!@\#$%^&*\()\-=+'`]/gi;
	  if(re.test(obj.value)){
	     alert("특수문자는 입력하실수 없습니다.");
	     obj.value=obj.value.replace(re,"");
	  }
	}	
	
	/* 팝업 관련 fnc */
	
	// 팝업창 닫기
	function cfClosePopup() {
		window.close();
	}
	//팝업 띄우기
	function cfOpenPopup(url, winName ,event) {
		var winProps = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,"
		             + "width=230,height=200,left=" + event.screenX + ",top=" + event.screenY;
		             
		var win = window.open(url, winName, winProps);

  		win.focus();
	}
	
	//벨리데이션 제거를 위한 함수
	function cfCancelValidate(obj, cssName) {
		if(navigator.appName=="Netscape") {
			obj.setAttribute("class",cssName);
		} else {
			obj.className = cssName;
		}
	}
	
	//검색버그를 처리하기 위한 함수
	function cfCancelSearchType() {
		if($("input[@name='searchText_']:nth(0)").val() == undefined) {
			$("input[@name='searchType_']").attr('value', "");
		}
	}
	
	// File Download Overried (관리자용 모니터링 화면)
	function cfDownloadFile(atchFileId, atchFileSeqno, atchFileNm, atchFilePathNm, jobTpCd) {
		
		var downloadForm = document.createElement("form");
		downloadForm.action = "/ebill.zz.atchFileMgmt.cmd.DownloadFile.zz";
		downloadForm.method = "post";
		
		var atchFileId_ = document.createElement("input");
		atchFileId_.type = "hidden";
		atchFileId_.name = "atchFileId";
		atchFileId_.value = atchFileId;
		
		var atchFileSeqno_ = document.createElement("input");
		atchFileSeqno_.type = "hidden";
		atchFileSeqno_.name = "atchFileSeqno";
		atchFileSeqno_.value = atchFileSeqno;
		
		var atchFileNm_ = document.createElement("input");
		atchFileNm_.type = "hidden";
		atchFileNm_.name = "atchFileNm";
		atchFileNm_.value = atchFileNm;
		
		var atchFilePathNm_ = document.createElement("input");
		atchFilePathNm_.type = "hidden";
		atchFilePathNm_.name = "atchFilePathNm";
		atchFilePathNm_.value = atchFilePathNm;
		
		var jobTpCd_ = document.createElement("input");
		jobTpCd_.type = "hidden";
		jobTpCd_.name = "jobTpCd";
		jobTpCd_.value = jobTpCd;
		
		downloadForm.appendChild(atchFileId_);
		downloadForm.appendChild(atchFileSeqno_);
		downloadForm.appendChild(atchFileNm_);
		downloadForm.appendChild(atchFilePathNm_);
		downloadForm.appendChild(jobTpCd_);
		
		document.body.appendChild(downloadForm);
		downloadForm.submit(true);
		
		downloadForm.parentNode.removeChild(downloadForm);
		
	}
	
	//파일 다운 스크립트 정보를 가지고 있는 사용자 전역 변수
	var atchFileSorce = "";
	
	// 파일 삭제 스크립트
	function cfDeleteFile(atchFileId) {
		
		$("#attchFileDelFg")[0].value = "Y"; // 기존 파일 삭제 후 파일 첨부 안함
		
		var targetId = document.getElementById(atchFileId);
		
		atchFileSorce = targetId.innerHTML;
		
		var outHtml = "<input name=\"attachFile\" type=\"file\" class=\"input_file\" style=\"ime-mode:disabled;\" onkeydown=\"return false;\" />&nbsp;";
		outHtml += "<input type=\"image\" src=\"/static/images/ep/img/board/btns_cancel.gif\" class=\"btns\" alt=\"취소\" onclick=\"cfRestoreFile('atchFile')\" />";
		
		targetId.innerHTML = outHtml;
	}
	
	//파일 복원 스크립트
	function cfRestoreFile(atchFileId) {
		
		$("#attchFileDelFg")[0].value = "N"; // 원상태 유지
		
		var targetId = document.getElementById(atchFileId);
		
		targetId.innerHTML = atchFileSorce;
	}
	
	//주민번호 유효성 검사
	function cfCheckResid(resid) {

	    var ssn = resid;

	    if (ssn.length != 13) { 
	        return false;
	    } 

	    var a=ssn.substring(0,1);
	    var b=ssn.substring(1,2);
	    var c=ssn.substring(2,3);
	    var d=ssn.substring(3,4);
	    var e=ssn.substring(4,5);
	    var f=ssn.substring(5,6);
	    var g=ssn.substring(6,7);
	    var h=ssn.substring(7,8);
	    var i=ssn.substring(8,9);
	    var j=ssn.substring(9,10);
	    var k=ssn.substring(10,11); 
	    var l=ssn.substring(11,12); 
	    var m=ssn.substring(12,13);

	    var sum = 2*a + 3*b + 4*c+ 5*d + 6*e+ 7*f+ 8*g + 9*h+ 2*i+3*j+ 4*k+ 5*l;
	    var r1 = sum%11;
	    var temp = 11* ((sum-r1)/11) + 11 - sum;
	    var r2 = temp%10;
	    var temp1 = temp- 10*((temp-r2)/10);
	    if (m != temp1) { 
	        return false;
	    } 

	    return true;
	}
	
	// File Download Overried(홈페이지팀 게시물 다운로드)
	function cfDownloadFileEp(atchFileId, atchFileSeqno, atchFileNm, atchFilePathNm, jobTpCd) {
		
		var cdnService = true;	// CDN 서비스 on 일 때 : true , off 일 때 : false		
		
		if (cdnService) {
			var downloadForm = document.createElement("form");
			downloadForm.action = "http://esero.go.kr.krweb.nefficient.co.kr/esero/data/" + jobTpCd + "/" + atchFileNm;			
			downloadForm.method = "post";
			downloadForm.target = "_new";
			document.body.appendChild(downloadForm);			
			downloadForm.submit(true);
			downloadForm.parentNode.removeChild(downloadForm);
			return;
		}
		var downloadForm = document.createElement("form");
		downloadForm.action = "/ebill.ep.atchFileMgmt.cmd.DownloadFile.xx";
		downloadForm.method = "post";
		
		var atchFileId_ = document.createElement("input");
		atchFileId_.type = "hidden";
		atchFileId_.name = "atchFileId";
		atchFileId_.value = atchFileId;
		
		var atchFileSeqno_ = document.createElement("input");
		atchFileSeqno_.type = "hidden";
		atchFileSeqno_.name = "atchFileSeqno";
		atchFileSeqno_.value = atchFileSeqno;
		
		var atchFileNm_ = document.createElement("input");
		atchFileNm_.type = "hidden";
		atchFileNm_.name = "atchFileNm";
		atchFileNm_.value = atchFileNm;
		
		var atchFilePathNm_ = document.createElement("input");
		atchFilePathNm_.type = "hidden";
		atchFilePathNm_.name = "atchFilePathNm";
		atchFilePathNm_.value = atchFilePathNm;
		
		var jobTpCd_ = document.createElement("input");
		jobTpCd_.type = "hidden";
		jobTpCd_.name = "jobTpCd";
		jobTpCd_.value = jobTpCd;
		
		downloadForm.appendChild(atchFileId_);
		downloadForm.appendChild(atchFileSeqno_);
		downloadForm.appendChild(atchFileNm_);
		downloadForm.appendChild(atchFilePathNm_);
		downloadForm.appendChild(jobTpCd_);
		
		document.body.appendChild(downloadForm);
		downloadForm.submit(true);
		
		downloadForm.parentNode.removeChild(downloadForm);
		
	}
	
	
	function cfGnbMenuOver(subMenuNum){
		var subMenu = "subNavi";
		var tabName = "mtab";
		for(j=1;j<7;j++)	{
			objTab = document.getElementById(tabName+j);
			if(j==subMenuNum)	{
				document.getElementById(subMenu+j).style.display="inline";
				objTab.src = objTab.src.replace("off.gif", "on.gif");	
			} else {
				document.getElementById(subMenu+j).style.display="none";
				objTab.src = objTab.src.replace("on.gif", "off.gif");
			}
		}

		//if(objTab.src.indexOf("off.gif") == -1){
					
	}
	
	
	function cfMenuOver(navId) {
		var menuDispaly = $("#sub_"+navId)[0].style.display;
		
		for(var i=1; i <= 9; i++) {
			try {
				$("#sub_"+(navId.substring(0,2)+i+navId.substring(3,5)))[0].style.display = "none";
			} catch(e) {}
		}
		
		if(menuDispaly == "none") {
			$("#sub_"+navId)[0].style.display = "";
		} else {
			$("#sub_"+navId)[0].style.display = "none";
		}
		
	}
	
	
	/* 화면 확대 축소 시작 IE 전용 */
	var nowZoom = 100; // 현재비율
	var maxZoom = 200; // 최대비율(500으로하면 5배 커진다)
	var minZoom = 80; // 최소비율
	
	// +, - 키를 입력하면 화면 확대, 축소를 한다.
	document.onkeypress = getKey;

	function getKey(keyStroke) {
		isNetscape = (document.layers);
		eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
		which = String.fromCharCode(eventChooser).toLowerCase();
		which2 = eventChooser;

		var el = event.srcElement;

		if ((el.tagName != "INPUT") && (el.tagName != "TEXTAREA")) {
			if (which == "+") {
				cfZoomIn();
			} else if (which == "-") {
				cfZoomOut();
			}
		}
	}

	//화면 키운다.
	function cfZoomIn() {
		if(nowZoom < maxZoom) {
			nowZoom += 10; // 25%씩 커진다.
		} else {
			return;
		}

		$("#sub")[0].style.zoom = nowZoom + "%";
	}


	//화면 줄인다.
	function cfZoomOut() {
		if(nowZoom > minZoom) {
			nowZoom -= 10; // 25%씩 작아진다.
		} else {
			return;
		}

		$("#sub")[0].style.zoom = nowZoom + "%";
	}
	
	//화면 원래대로 
	function cfZoomDefault() { 
	    nowZoom = 100; 
	    $("#sub")[0].style.zoom = nowZoom + "%"; 
	}
	/* 화면 확대 축소 끝 */
	// 관심메뉴 등록
	function cfCreateIntrst(menuId) {
		if(menuId=="") {
			cfAlert("EP.INF.MENU_REPRSNT_FAIL");
			return ;
		} else {
			if(cfConfirm("EP.CFM.MENU_REPRSNT")) {
				//정상등록
				$("#intrstMenuId")[0].value = menuId;
				cfAppendXecureForm();
				cfAppendXecureInput();
				var frm = $("#intrstForm")[0];
				frm.action = "/ebill.ep.home.intrst.cmd.CreateIntrstTx.ep";
				frm.submit();
				//var url = "/ebill.ep.home.intrst.cmd.CreateIntrstTx.ep?intrstMenuId="+menuId ;
				//XecureNavigate(url,"_self");
			}
		}
	}
	
	
	function cfCreateIntrstErrMsg() {
		cfAlert("EP.ERR.LOGIN_AUTH");
	}
	
	function cfFindIntrstPage() {
		if($("#intrstPage")[0].value) {
			//location.href = $("#intrstPage")[0].value;
			XecureNavigate($("#intrstPage")[0].value, "_self");
		}
	}
	
	//서버파일 다운로드
	function cfHomeDownFile(fileId) {
		
		var downloadForm = document.createElement("form");
		downloadForm.action = "/ebill.ep.home.fileDown.cmd.DownloadFile.xx";
		downloadForm.method = "post";
		
		var fileId_ = document.createElement("input");
		fileId_.type = "hidden";
		fileId_.name = "fileId";
		fileId_.value = fileId;
		
		downloadForm.appendChild(fileId_);
		
		document.body.appendChild(downloadForm);
		downloadForm.submit(true);
		
		downloadForm.parentNode.removeChild(downloadForm);
		
	}
	
	//e세로 홈페이지 가기
	function cfMoveHmpg() {
		window.open("/ebill.ep.home.main.cmd.FindMain.xx?simpleHomepageFg=N","","");
	}
	
		//XecureNavigate("/ebill.ep.home.main.cmd.FindMain.xx?simpleHomepageFg=N", "_self");
		

	//e세로 간편홈페이지 링크
	function cfMoveSimplPage(strVar) {
		
		var URL = "";

		switch(strVar) {
		
		case "10_0_0" : URL = "/ebill.ep.home.user.cmd.StplatIndvdlInfoPrtcAgre.xx?simpleHomepageFg=Y"; break; // [10_0_0]
		
		case "10_1_0" : URL = "/ebill.ep.home.user.cmd.StplatIndvdlInfoPrtcAgre.xx?simpleHomepageFg=Y"; break; // [10_1_0]
		// 회원가입		
		case "10_2_0" : URL = "/ebill.ep.home.user.cmd.LoginMgmt.xx?simpleHomepageFg=Y"; break; // [10_2_0]
		// 로그인로그아웃
		case "10_2_1" : URL = "/ebill.ep.home.user.cmd.LoginMgmt.xx?simpleHomepageFg=Y"; break; // [10_2_1]
		// 로그인
		case "10_2_2" : URL = "/ebill.ep.home.user.cmd.FindLogoutFM.xx?simpleHomepageFg=Y"; break; // [10_2_2]
		// 로그아웃
		case "10_3_0" : URL = "/ebill.ep.home.user.cmd.FindIdPwdSearch.xx?simpleHomepageFg=Y"; break; // [10_3_0]
		// 아이디패스워드찾기
		case "11_0_0" : URL = "/ebill.ep.home.useStplat.cmd.FindUseStplat.xx?simpleHomepageFg=Y"; break; // [11_0_0]
		// 약관및정책
		case "11_1_0" : URL = "/ebill.ep.home.useStplat.cmd.FindUseStplat.xx?simpleHomepageFg=Y"; break; // [11_1_0]
		// 이용약관
		case "11_2_0" : URL = "/ebill.ep.home.indvdlInfoTrtmnt.cmd.FindIndvdlInfoTrtmnt.xx?simpleHomepageFg=Y"; break; // [11_2_0]
		
				
// 개인정보취급방침
		}
		if(URL.indexOf("://") > -1) {
			window.open(URL, "", "");
			return;
			
		}		
		//location.href=URL;
		XecureNavigate(URL, "_self");
	}	
	
	//서브로그인아이디 초기화
	function cfInitId() {
		if(!$("#subId")[0].value) {
			cfCancelValidate($("#subId")[0],"id");
		}
	}
	
	//서브로그인아이디 입력
	function cfOnId() {
		cfCancelValidate($("#subId")[0],"oninput");
	}
	
	//서브로그인비밀번호 초기화
	function cfInitPw() {
		if(!$("#subPw")[0].value) {
			cfCancelValidate($("#subPw")[0],"pw");
		}
	}
	// 다른 키에 저장
	function cfSetNextPage_(idx) {		
		var x_nextPage = '';
		
		if( gNextPage != '' ) {
			x_nextPage = gNextPage.replace(/_/gi, '\.');
			if(idx == 1) {
				$("#mainFormCert")[0].nextPage_.value = x_nextPage;
			} else if(idx == 2) {
				$("#mainForm")[0].nextPage_.value = x_nextPage;
			} else if(idx == 3) {
				$("#subLoginForm")[0].nextPage_.value = x_nextPage;
			}
		}
	}
	// 다른 키에 저장
	function cfSetRequestToken(idx) {		
		var token = $("#REQUEST_TOKEN")[0].value;
		
		if(idx == 1) {
			$("#mainFormCert")[0].REQUEST_TOKEN.value = token;
		} else if(idx == 2) {
			$("#mainForm")[0].REQUEST_TOKEN.value = token;
		} else if(idx == 3) {
			$("#subLoginForm")[0].REQUEST_TOKEN.value = token;
		}								
	}
	
	// 모든폼에 토큰 분배
	function cfSetRequestTokenAllForm() {
		//alert("22");
		var request_token_count = $(":input:hidden[name=REQUEST_TOKEN]").length;
		if(request_token_count > 0) {
			var token = $(":input:hidden[name=REQUEST_TOKEN]")[request_token_count-1].value;
			// alert(token);
			
			for (var i = 0 ; i < $("form").length ; i++) {
				if ($("form")[i].REQUEST_TOKEN != undefined) {
					$("form")[i].REQUEST_TOKEN.value = token;
				}
			}
		}
	}		
	
	function cfSetRequestTokenPopup(idx) {		
		var token = $("#REQUEST_TOKEN")[0].value;
		
		if(idx == 1) {
			$("#mainFormCert")[0].REQUEST_TOKEN_POPUP.value = token;
		} else if(idx == 2) {
			$("#mainForm")[0].REQUEST_TOKEN_POPUP.value = token;
		}				
	}
	//서브로그인비밀번호 입력
	function cfOnPw() {
		cfCancelValidate($("#subPw")[0],"oninput");
	}
	
	//서브공인인증로그인
	function cfOgcrLogin() {
		//cfAlert("EP.INF.SRVC_PRPARE");
		$("#signed_msg").val(Sign_with_option(0, "xecure"));	// 개발!!!
	    
		if($("#signed_msg").val() != "") {
			cfAppendXecureForm();
			cfAppendXecureInput();
			
			var frm = $("#mainFormCert")[0];
			frm.action = "/ebill.ep.home.user.cmd.FindCertMgmtTx.xx";
			frm.submit();
		} 
	}
	

	//keyCode IE,FF처리
	function cfKeyCode(e){
		var result = ""; 
	    
	    if(typeof(e) != "undefined") { 
	        result = e.which; 
	    }
	    if(result == undefined) {
	        result = event.keyCode; 
	    }
		return result;
	}
	
	//서브 로그인
	function fcFindLoginEnter(e) {
		if(cfKeyCode(e) == 13) {
			cfFindLogin();
		}
	}
	

	//서브 로그인
	function cfFindLogin() {
		
		if(!$("#subId")[0].value) {
			cfAlert("EP.ERR.ESSNTL_INPUT_MATTER_L", "아이디,입력", ",");
			$("#subId")[0].focus();
			return;
		} else if(!$("#subPw")[0].value) {
			cfAlert("EP.ERR.ESSNTL_INPUT_MATTER_L", "비밀번호,입력", ",");
			$("#subPw")[0].focus();
			return;
		} else {
			
			cfAppendXecureForm();
			cfAppendXecureInput();
			
			var frm = $("#subLoginForm")[0];
			frm.action = "/ebill.ep.home.user.cmd.FindSubLoginMgmtTx.xx";
			frm.submit();
		}
	}
	
	
	//전송마감시간 카운터
	function discountTimer(dd, hh, mm, ss, msgEnd) {
	     if(!msgEnd) 
	     { 
	         msgEnd = '00:00:00'; 
	     } 
	 
	     ss    = ss - 1; 
	 
	     if(ss == -1) 
	     { 
	         ss    = 59; 
	         mm    = mm - 1; 
	     } 
	 
	     if(mm == -1) 
	     {                                              
	         mm    = 59; 
	         hh    = hh - 1; 
	     } 
	 
	     if(hh == -1) 
	     {                                              
	         hh    = 23; 
	         dd    = dd - 1; 
	     } 
	 
	     if(ss == 0 && mm == 0 && hh == 0 && dd == 0) 
	     {   
	         return; 
	     } 
	 
	     dd    += ''; 
	     hh    += ''; 
	     mm    += ''; 
	     ss    += ''; 
	 
	     dd    = (dd.length==1)    ? '0'+dd    : dd; 
	     hh    = (hh.length==1)    ? '0'+hh    : hh; 
	     mm    = (mm.length==1)    ? '0'+mm    : mm; 
	     ss    = (ss.length==1)    ? '0'+ss    : ss;
     
	     if(eval(dd < 0) || eval(hh < 0) || eval(mm < 0) || eval(ss < 0)) {
		     $("#timeobj")[0].style.display = 'none';
		     $("#timeobj2")[0].style.display = 'block';	    	 
	    	 dd    = '0';
		     hh    = '00'; 
		     mm    = '00'; 
		     ss    = '00';
		     
		     $("#time_resDay")[0].style.display = 'none';
		     $("#time_resTm")[0].style.display = 'none';
		     $("#time_end")[0].style.display = 'none';

	     } else {
		     $("#timeobj")[0].style.display = 'block';
		     $("#timeobj2")[0].style.display = 'none';
	     
	    	 $("#time_resDay")[0].style.display = 'block';
		     $("#time_resTm")[0].style.display = 'block';
		     $("#resDay")[0].innerHTML = dd;
		     $("#resTm")[0].innerHTML = hh + ':' + mm + ':' + ss;
		     $("#time_end")[0].style.display = 'none';  
	     }
	     window.setTimeout("discountTimer("+dd+","+hh+","+mm+","+ss+",'"+msgEnd+"')",1000); // 1초간격
	}
	
	//서버파일 다운로드(인터넷발행 서식 다운로드)
	function cfDownloadFileAtFsEp(atchFileNm, atchFilePathNm, jobTpCd) {
		
		var cdnService = true;	// CDN 서비스 on 일 때 : true , off 일 때 : false
		
		if (cdnService) {
			var downloadForm = document.createElement("form");
			downloadForm.action = "http://esero.go.kr.krweb.nefficient.co.kr/esero/data/" + jobTpCd + "/form/" + atchFileNm;			
			downloadForm.method = "post";
			downloadForm.target = "_new";
			document.body.appendChild(downloadForm);			
			downloadForm.submit(true);
			downloadForm.parentNode.removeChild(downloadForm);
			return;
		}
		var downloadForm = document.createElement("form");
		downloadForm.action = "/ebill.zz.atchFileMgmt.cmd.DownloadFileAtFs.zz";
		downloadForm.method = "post";
		
		var atchFileNm_ = document.createElement("input");
		atchFileNm_.type = "hidden";
		atchFileNm_.name = "atchFileNm";
		atchFileNm_.value = atchFileNm;
		
		var atchFilePathNm_ = document.createElement("input");
		atchFilePathNm_.type = "hidden";
		atchFilePathNm_.name = "atchFilePathNm";
		atchFilePathNm_.value = atchFilePathNm;
		
		var jobTpCd_ = document.createElement("input");
		jobTpCd_.type = "hidden";
		jobTpCd_.name = "jobTpCd";
		jobTpCd_.value = jobTpCd;
		
		downloadForm.appendChild(atchFileNm_);
		downloadForm.appendChild(atchFilePathNm_);
		downloadForm.appendChild(jobTpCd_);
		
		document.body.appendChild(downloadForm);
		downloadForm.submit(true);
		
		downloadForm.parentNode.removeChild(downloadForm);
		
	}
	
	function cfCertLogin() {
		$("#signed_msg").val(Sign_with_option(0, "xecure"));	// 개발!!!
	    
		if($("#signed_msg").val() != "") {
			cfAppendXecureForm();
			cfAppendXecureInput();
			
			var frm = $("#mainFormCert")[0];
			frm.action = "/ebill.ep.home.user.cmd.FindCertMgmtTx.xx";
			frm.submit();
		} 
	}
	// 팝업 오픈
	function cfOpenWindow(url, winName, width, height, left, top, scrollbars, resizable, noXecure) {
		var winProps = "toolbar=0,location=0,directories=0,status=yes,menubar=0,scrollbars="+scrollbars+",resizable="+resizable
		             + ",width=" + width + ",height=" + height;
		
		if(left!=null && left!="") winProps += ",left=" + left;
		if(top!=null && top!="") winProps += ",top=" + top;
		
		if(noXecure == null) {
			XecureNavigate(url, winName, winProps);
		} else {
			var win = window.open(url, winName, winProps);
	  		win.focus();
		}
	}
	
	/* 홈페이지 사용자 객체 */
    function gObjHmpgUserClass() {}
    gObjHmpgUserClass.prototype = {
        setValue : function(oHmpgUserId, oBusnid, oBusnRgstOpenDt, oTradeNm, oEmailAddr, busnid, busnRgstOpenDt, fncFindHmpgUserInfoCB) {
        	this.oHmpgUserId = oHmpgUserId;
            this.oBusnid = oBusnid;
            this.oBusnRgstOpenDt = oBusnRgstOpenDt;
            this.oTradeNm = oTradeNm;
            this.oEmailAddr = oEmailAddr;            
            this.busnid = busnid;
            this.busnRgstOpenDt = busnRgstOpenDt;       
            this.fncFindHmpgUserInfoCB = fncFindHmpgUserInfoCB;
        },
        toString : function() {
            return this.oBusnid + "[" + this.oTradeNm + "]";
        }
    }
    var gObjHmpgUser = new gObjHmpgUserClass();
    
    // 홈페이지 사용자 조회 */
    function cfGetHmpgUserInfo() { return gObjHmpgUser.rtnJson; }

    /*
    Function 설명 : 홈페이지 사용자 공통함수
    Parameter 설명
    	oHmpgUserId   	: 홈페이지ID를 전달받을 객체명
        oBusnid     	: 사업자번호를 전달받을 객체명
        oBusnRgstOpenDt	: 개업일자를 전달받을 객체명
        oTradeNm      	: 상호를 전달받을 객체명
        oEmailAddr    	: 이메일을 전달받을 객체명
                
        busnid      	: 사업자등록번호로 조회
        busnRgstOpenDt	: 개업일자로 조회
        fncFindHmpgUserInfoCB : 호출자에서 결과를 처리할 콜백함수
    */
function cfFindHmpgUser(oHmpgUserId, oBusnid, oBusnRgstOpenDt, oTradeNm, oEmailAddr, busnid, busnRgstOpenDt, fncFindHmpgUserInfoCB) {
    busnid = busnid.trim();    
    busnRgstOpenDt = busnRgstOpenDt.trim();
    
    //alert(busnid + " : " +busnRgstOpenDt);
    
    var oHmpgUserIdCnt = $("input[name='"+oHmpgUserId+"']").size();
	var oBusnidCnt   = $("input[name='"+oBusnid+"']").size();
	var oBusnRgstOpenDtCnt   = $("input[name='"+oBusnRgstOpenDt+"']").size();	
	var oTradeNmCnt  = $("input[name='"+oTradeNm+"']").size();
	var oEmailAddrCnt  = $("input[name='"+oEmailAddr+"']").size();

	if(oHmpgUserId != "" && oHmpgUserIdCnt > 1) {
		cfAlert("OS.ERR.DUPLICATE", oHmpgUserId+","+oHmpgUserIdCnt, ",");
		$("#"+oHmpgUserId).focus();
		return false;
	}
	if(oBusnid != "" && oBusnidCnt > 1) {
		cfAlert("OS.ERR.DUPLICATE", oBusnid+","+oBusnidCnt, ",");
		$("#"+oBusnid).focus();
		return false;
	}
	if(oBusnRgstOpenDt != "" && oBusnRgstOpenDtCnt > 1) {
		cfAlert("OS.ERR.DUPLICATE", oBusnRgstOpenDt+","+oBusnRgstOpenDtCnt, ",");
		$("#"+oBusnRgstOpenDt).focus();
		return false;
	}
	if(oTradeNm != "" && oTradeNmCnt > 1) {
		cfAlert("OS.ERR.DUPLICATE", oTradeNm+","+oTradeNmCnt, ",");
		$("#"+oTradeNm).focus();
		return false;
	}
	if(oEmailAddr != "" && oEmailAddrCnt > 1) {
		cfAlert("OS.ERR.DUPLICATE", oEmailAddr+","+oEmailAddrCnt, ",");
		$("#"+oEmailAddr).focus();
		return false;
	}
	
    // 사용자정보조회용 객체 초기화
	gObjHmpgUser.setValue(oHmpgUserId, oBusnid, oBusnRgstOpenDt, oTradeNm, oEmailAddr, busnid, busnRgstOpenDt, fncFindHmpgUserInfoCB);
    
    //alert("Ending........");
    
	if(busnid == "" && busnRgstOpenDt == "") {
		cfAlert("OS.ERR.MANDATORY");
		$("#"+oBusnid).focus();
		return false;
	} else {
	//	cfAppendXecureForm();
	//	cfAppendXecureInput();
	//	alert(busnid + " :2번째(FindHmpgUserInfoMngrAjax): " +busnRgstOpenDt);
    	// 홈페이지사용자 조회 AJAX 호출	
       cfAjaxSubmit("/ebill.ep.admin.mailMgmtMngr.cmd.FindHmpgUserInfoMngrAjax.ep",
    		        {"busnid":busnid, "busnRgstOpenDt":busnRgstOpenDt},fncFindHmpgUserResultHandler);
	}
}

// 1. 호출자에서 넘어온 오브젝트에 결과값 셋팅하기
// 2. 호출자로 결과값 리턴하기(json)
function fncFindHmpgUserResultHandler(rtnXml) {
    var totalRecords = $(rtnXml).find("header").find("totalRecords").text();
    var hmpgUserCnt = $(rtnXml).find("header").find("hmpgUserCnt").text();

    //alert("totalRecords = "+totalRecords + " : hmpgUserCnt = " + hmpgUserCnt);
    
    if( totalRecords == 0 ) {
		//cfAlert("OS.ERR.NORESULT");
        gObjHmpgUser.rtnJson = {"totalRecords":totalRecords}; 		// 결과값 설정
        gObjHmpgUser.fncFindHmpgUserInfoCB(); 							// 콜백함수 호출        
    } else if( totalRecords == 1 ) {
        $(rtnXml).find("record").each(function() {
            var record = $(this);
            var hmpgUserId = $("hmpgUserId", record).text(); 		// 홈페이지ID
            var busnid = $("busnid", record).text(); 				// 사업자등록번호
            var busnRgstOpenDt = $("busnRgstOpenDt", record).text();// 개업일자
            var tradeNm = $("tradeNm", record).text(); 				// 상호명
            var emailAddr = $("emailAddr", record).text(); 			// 이메일주소                        
            var rtnJson = {
            		"totalRecords":totalRecords,
            		"hmpgUserId":hmpgUserId,
            		"busnid":busnid,
            		"busnRgstOpenDt":busnRgstOpenDt,
            		"tradeNm":tradeNm,
            		"emailAddr":emailAddr
            		};

            // 호출자 객체에 결과값 설정
            $("#"+gObjHmpgUser.oHmpgUserId).val(hmpgUserId);
            $("#"+gObjHmpgUser.oBusnid).val(busnid);
            $("#"+gObjHmpgUser.oBusnRgstOpenDt).val(busnRgstOpenDt);
            $("#"+gObjHmpgUser.oTradeNm).val(tradeNm);
            $("#"+gObjHmpgUser.oEmailAddr).val(emailAddr);
            
            gObjHmpgUser.rtnJson = rtnJson; 		// 결과값 설정
            gObjHmpgUser.fncFindHmpgUserInfoCB(); 	// 콜백함수 호출
        });
    } else {
    	cfFindHmpgUserPopUp();    
    }
}

function cfFindHmpgUserTpPopup() {
    var winName = "FindHmpgUserInfoMngr";

	// 팝업용폼에 파리미터용 객체 생성 -> 값설정 -> 팝업호출 -> SUBMIT
    var oForm = fncInitPopupForm(winName, "/ebill.ep.admin.mailMgmtMngr.cmd.FindHmpgUserInfoMngr.ep");

//    $(oForm)
//    	.append("<input type='hidden' name='" + gObjHmpgUser.oStdIncmRtCd + "' />")

	fncSetElement(oForm, "text", "oHmpgUserId", gObjHmpgUser.oHmpgUserId);
	fncSetElement(oForm, "text", "oBusnid", gObjHmpgUser.oBusnid);
	fncSetElement(oForm, "text", "oBusnRgstOpenDt", gObjHmpgUser.oBusnRgstOpenDt);
	fncSetElement(oForm, "text", "oTradeNm", gObjHmpgUser.oTradeNm);
	fncSetElement(oForm, "text", "oEmailAddr", gObjHmpgUser.oEmailAddr);
	fncSetElement(oForm, "text", "busnid", gObjHmpgUser.busnid);
	fncSetElement(oForm, "text", "busnRgstOpenDt", gObjHmpgUser.busnRgstOpenDt);

	fncOpenWindow("", winName, "560", "542", "100", "100");
	fncPopupFormSubmit(oForm);

    //alert(oForm.name);
    //$(oForm).remove();
	//$("#"+winName).empty();
	//document.getElementById(name).removeNode(true);
    //alert(oForm.name);
}

function cfFindHmpgUserPopUp() {
    var winName = "FindHmpgUserInfoMngr";
    
    var url = "/ebill.ep.admin.mailMgmtMngr.cmd.FindHmpgUserInfoMngr.ep?"
    	+  "hmpgUserId=" +gObjHmpgUser.oHmpgUserId
    	+  "&busnid=" +gObjHmpgUser.oBusnid
    	+  "&busnRgstOpenDt=" +gObjHmpgUser.oBusnRgstOpenDt
    	+  "&tradeNm=" +gObjHmpgUser.oTradeNm
    	+  "&emailAddr=" +gObjHmpgUser.oEmailAddr    	
    	;
	
	XecureNavigate(url, winName ,'width=900px, height=470px, tollbar=no, location=no');
	
}
    
    