﻿/*****************************************************************************************************************************************************************
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr"/>버전확인
*****************************************************************************************************************************************************************/


/*****************************************************************************************************************************************************************
*****************************************************************************************************************************************************************
*  
* @Information : [자바스크립트 공통 함수]
* @Version : 1.0 (2009-07-09) 
* @Author : onDemand institute.
* @Description : 이곳에 함수를 추가/수정/삭제 할 때는 반드시 함수정의서를 수정해 주십시오.
* Copyright by 2009 onDemand Develop Team All rights reserved.
*
*****************************************************************************************************************************************************************
*****************************************************************************************************************************************************************/
function flashLink(url, width, height) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '" VIEWASTEXT>');
    document.write('<param name="movie" value="' + url + '">');
    document.write('<param name="quality" value="high">');
    document.write('<param name="wmode" value="transparent">');
    document.write('<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
    document.write('</object>');
}


//////////////////////////////////////////////////////////////////////////////////////////// 1. Basic
// 번호만 입력 가능
// 사용법 : <asp:TextBox ID="txt_OnlyNum" runat="server" style="ime-mode:disabled;"_
//                             onkeypress="onDemand_js_1001();" onpaste="return false;"></asp:TextBox>
//  한글입력 방지구문 : style="ime-mode:disabled;"
//  수정 : 작성자-모준호, 수정일자 - 2009년 6월 1일(월)
function onDemand_js_1001() {
    event.returnValue = false;

    if (event.keyCode == 8)         // BackSpace
        event.returnValue = true;

    if (event.keyCode >= 48 && event.keyCode <= 57)      //알파벳
        event.returnValue = true;
}


// 특수문자,공백 제거 (OnkeyDown Event) 영문, 한글, 숫자만 사용,
// 특수문자 예외 : 점('.'), 공백(' '), ('-') 은 사용가능 - 수정 : 작성자-모준호, 수정일자 - 2009년 7월 14일(화)
function onDemand_js_1002() {
//    var specialChars = '`@#$%%^&*=+\|[{]};:\',<>/';
//    var str = String.fromCharCode(event.keyCode);

//    for (j = 0; j < specialChars.length; j++) {
//        if (str.charAt(0) == specialChars.charAt(j))
//            event.returnValue = false;
//    }
}



// Dynamics CRM 페이지 삽입 된 퀵메뉴
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 flevDivPositionValue(sDiv, sProperty) { // v2.1, Marja Ribbers-de Vroed, FlevOOware
	this.opera = (window.opera); // Opera 5+
	this.ns4 = (document.layers); // Netscape 4.x
	this.ns6 = (document.getElementById && !document.all && !this.opera); // Netscape 6+
	this.ie = (document.all);  // Internet Explorer 4+
    var sValue = ""; docObj = eval("MM_findObj('" + sDiv + "')"); if (docObj == null) {return 0;}
	if ((sProperty == "left") || (sProperty == "top")) {
		if (!this.ns4) {docObj = docObj.style;} 
		sValue = eval("docObj." + sProperty);
		if ((this.ie) && (sValue == "")) { // IE (on PC) bug with nested layers
			if (sProperty == "top") { sValue = eval(sDiv + ".offsetTop"); } 
			else { sValue = eval(sDiv + ".offsetLeft"); } 
		};
	}
	else {
		if (this.opera) {
			docObj = docObj.style;
			if (sProperty == "height") { sValue = docObj.pixelHeight; } 
			else if (sProperty == "width") { sValue = docObj.pixelWidth; } 
		}
		else if (this.ns4) {sValue = eval("docObj.clip." + sProperty);} 
		else if (this.ns6) {sValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sProperty); } 
	    else if (this.ie) { 
			if (sProperty == "width") { sValue = eval(sDiv + ".offsetWidth"); } 
			else if (sProperty == "height") { sValue = eval(sDiv + ".offsetHeight"); } 
		}
   	}
	sValue = (sValue == "") ? 0 : sValue; 
	if (isNaN(sValue)) { if (sValue.indexOf('px') > 0) { sValue = sValue.substring(0,sValue.indexOf('px')); } } 
	return parseInt(sValue); 
}

function flevPersistentLayer() { // v3.3, Marja Ribbers-de Vroed, FlevOOware
	var sD = arguments[0], oD = eval("MM_findObj('" + sD + "')"), iWW, iWH, iSX, iSY, iT = 10, sS = "";
	if (!document.layers) {oD = oD.style;}
	if (oD.tmpTimeout != null) {clearTimeout(oD.tmpTimeout);}
	var sXL = arguments[1], sXC = arguments[2], sXR = arguments[3], sYT = arguments[4], sYC = arguments[5], sYB = arguments[6];
	var iS = (arguments.length > 7) ? parseInt(arguments[7]) : 0, iPx = (arguments.length > 8) ? parseInt(arguments[8]) : 0;
	if (window.innerWidth) { // NS4, NS6 and Opera
		var oW = window; iWW = oW.innerWidth; iWH = oW.innerHeight; iSX = oW.pageXOffset; iSY = oW.pageYOffset; }
	else if (document.documentElement && document.documentElement.clientWidth) { // IE6 in standards compliant mode
		var oDE = document.documentElement; iWW = oDE.clientWidth; iWH = oDE.clientHeight; iSX = oDE.scrollLeft; iSY = oDE.scrollTop; }
	else if (document.body) { // IE4+
		var oDB = document.body; iWW = oDB.clientWidth; iWH = oDB.clientHeight; iSX = oDB.scrollLeft; iSY = oDB.scrollTop; }
	else {return;}
	var iCX = iNX = flevDivPositionValue(sD, 'left'), iCY = iNY = flevDivPositionValue(sD, 'top');
	if (sXL != "") {iNX = iSX + parseInt(sXL);} 
	else if (sXC != "") {iNX = Math.round(iSX + (iWW/2) - (flevDivPositionValue(sD, 'width')/2));}
	else if (sXR != "") {iNX = iSX + iWW - (flevDivPositionValue(sD, 'width') + parseInt(sXR));}
	if (sYT != "") {iNY = iSY + parseInt(sYT);}
	else if (sYC != "") {iNY = Math.round(iSY + (iWH/2) - (flevDivPositionValue(sD, 'height')/2));}
	else if (sYB != "") {iNY = iSY + (iWH - flevDivPositionValue(sD, 'height') - parseInt(sYB));}
	if ((iCX != iNX) || (iCY != iNY)) {
		if (iS > 0) {
			if (iPx > 0) { iT = iS;
				var iPxX = iPx, iPxY = iPx, iMX = Math.abs(iCX - iNX), iMY = Math.abs(iCY - iNY);
				// take care of diagonal movement
				if (iMX < iMY) {iPxY = (iMX != 0) ? ((iMY/iMX)*iPx) : iPx;}
				else {iPxX = (iMY != 0) ? ((iMX/iMY)*iPx) : iPx;}
				if (iPxX >= iMX) {iPxX = Math.min(Math.ceil(iPxX), iPx);}
				if (iPxY >= iMY) {iPxY = Math.min(Math.ceil(iPxY), iPx);}
				// temporary X/Y coordinates
				if ((iCX < iNX) && (iCX + iPxX < iNX)) {iNX = iCX + iPxX;}
				if ((iCX > iNX) && (iCX - iPxX > iNX)) {iNX = iCX - iPxX;}
				if ((iCY < iNY) && (iCY + iPxY < iNY)) {iNY = iCY + iPxY;}
				if ((iCY > iNY) && (iCY - iPxY > iNY)) {iNY = iCY - iPxY;} }
			else { 
				var iMX = ((iNX - iCX) / iS), iMY = ((iNY - iCY) / iS); 
				iMX = (iMX > 0) ? Math.ceil(iMX) : Math.floor(iMX); iNX = iCX + iMX; 
				iMY = (iMY > 0) ? Math.ceil(iMY) : Math.floor(iMY); iNY = iCY + iMY; } }
		if ((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sS="px";}
		if (iMX != 0) {eval("oD.left = '" + iNX + sS + "'");}
		if (iMY != 0) {eval("oD.top = '" + iNY + sS + "'");} }
	var sF = "flevPersistentLayer('" + sD + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	oD.tmpTimeout = setTimeout(sF,10);
}

function flevInitPersistentLayer() { // v3.3, Marja Ribbers-de Vroed, FlevOOware
	if (arguments.length < 8) {return;}
	var sD = arguments[0]; if (sD == "") {return;}
	var	oD = eval("MM_findObj('" + sD + "')"); if (!oD) {return;}
	var iCSS = parseInt(arguments[1]);
	var sXL = arguments[2], sXC = arguments[3], sXR = arguments[4], sYT = arguments[5], sYC = arguments[6], sYB = arguments[7];
	var iS = (arguments.length > 8) ? parseInt(arguments[8]) : 0, iPx = (arguments.length > 9) ? parseInt(arguments[9]) : 0;
	if (iCSS != 0) { if (!document.layers) {oD = oD.style;} sXL = parseInt(oD.left), sYT = parseInt(oD.top);}
	var sF = "flevPersistentLayer('" + sD + "','" + sXL + "','" + sXC + "','" + sXR + "','" + sYT + "','" + sYC + "','" + sYB + "'," + iS + "," + iPx + ")";
	eval(sF);
}








// 문자 앞뒤 공백 제거 
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)|($\s*)/g, "");
}
/*
var a = "      문자열      ";
a.trim();
*/


// 통화표시(숫자 3자리마다 콤마표시)
function onDemand_js_1003(n) {
    return Number(String(n).replace(/\..*|[^\d]/g, "")).toLocaleString().slice(0, -3);
}

// 휴대폰 번호 검사
function onDemand_js_1004(strHpnum) {
    var head = strHpnum.substring(0, 3);
    if ((strHpnum.length == 10) || (strHpnum.length == 11)) {
        if ((head == '011') || (head == '016') || (head == '017') || (head == '018') || (head == '019') || (head == '010')) {
            return true;
        }
        else {
            return false;
        }
    }
    else {
        return false;
    }
}


// 주민등록번호 검사
function onDemand_js_1005(Jumin1, Jumin2) {
    var a = new Array(6);
    var b = new Array(7);
    var tot = 0;
    var c = 0;

    for (i = 1; i < 7; i++) {
        a[i] = Jumin1.substring(i - 1, i);
        b[i] = Jumin2.substring(i - 1, i);
        if (i < 3) {
            c = Number(b[i]) * (i + 7);
        }
        else if (i >= 3) {
            c = Number(b[i]) * ((i + 9) % 10);
        }
        tot = tot + Number(a[i]) * (i + 1) + c;
    }
    b[7] = Jumin2.substring(6, 7);
    if (Number(b[7]) != ((11 - (tot % 11)) % 10))
        return false;
    else
        return true;
}


// 이메일 주소 형식 검사
function onDemand_js_1006(addr) {
    var regDoNot = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
    var regMust = /^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3})$/;

    if (!regDoNot.test(addr) && regMust.test(addr))
        return true;
    else
        return false;
}


// 사업자 등록번호 검사
function onDemand_js_1007(ssn) {
    var calStr1 = "13713713", biVal = 0, tmpCal;
    var calLast = ssn.substring(9, 10);

    for (i = 0; i < 8; i++) {
        biVal = biVal + (parseFloat(ssn.substring(i, i + 1)) * parseFloat(calStr1.substring(i, i + 1))) % 10;
    }
    tmpCal = parseFloat(ssn.substring(8, 9)) * 5 + "0";
    chkVal = parseFloat(tmpCal.substring(0, 1)) + parseFloat(tmpCal.substring(1, 2));
    chkDigit = (10 - (biVal + chkVal) % 10) % 10;

    if (calLast != chkDigit) return false;

    return true;
}


// right 함수 정의
function onDemand_js_1008() {
    return arguments[0].substring(arguments[0].length - arguments[1]);
}


// 문자열 변환 함수
function onDemand_js_1009(str, s1, s2) {
    for (i = 0; i < str.length; i++)
        str = str.replace(s1, s2);
    return str;
}


// 한글만 입력 가능
// 사용법 : <asp:TextBox ID="txt_OnlyNum" runat="server" onkeypress="onDemand_js_1009();" onpaste="return false;"></asp:TextBox>
//  한글입력 방지구문 : style="ime-mode:disabled;"
//  수정 : 작성자-모준호, 수정일자 - 2009년 7월 20일(월)
function onDemand_js_1009() {
    event.returnValue = false;

    if (event.keyCode == 8)         // BackSpace
        event.returnValue = true;

    if ((event.keyCode < 48) || (event.keyCode > 57))
        event.returnValue = false;
    else {
        if (event.keyCode >= 48 && event.keyCode <= 57)      //알파벳
            event.returnValue = false;
        else
            event.returnValue = true;
    }
}


// 소수점 자리수 반올림 함수
function round(val, precision) {
    val = val * Math.pow(10, precision);
    val = Math.round(val);
    return val / Math.pow(10, precision);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////







//////////////////////////////////////////////////////////////// 2. Window/Layer/Table/Frame
// 팝업 열기 (모달리스)
function onDemand_js_2001(gopageURL, gopageName, gopageWidth, gopageHeight, TopPosition, LeftPosition, scroll) {
    var pop = window.open(gopageURL, gopageName,
        'width=' + gopageWidth + ', height=' + gopageHeight + ', top=' + TopPosition

        + ', left=' + LeftPosition + ', menubar=no, scrollbars=' + scroll + ', resizable=no');
    pop.focus();
}


//  팝업 정가운데 열기 (모달리스)
function onDemand_js_2002(gopageURL, gopageName, gopageWidth, gopageHeight, scroll) {
    var leftX = (document.body.clientWidth / 2) - (gopageWidth / 2);
    var topY = (document.body.clientHeight / 2) - (gopageHeight / 2);
    var pop = window.open(gopageURL, gopageName,
        'width=' + gopageWidth + ', height=' + gopageHeight + ', top=' + topY

        + ', left=' + leftX + ', menubar=no, scrollbars=' + scroll + ', resizable=no');
    pop.focus();
}


// 팝업 열기 (모달)
function onDemand_js_2003(url, argument, w, h) {
    if (argument == null) argument = window;
    window.showModalDialog(url, argument, 'dialogWidth:' + w + 'px; dialogHeight:' + h + 'px;');
}

////////////////////////////////////////////////////////////////////////////////////////////////////////



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_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_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];}
}





//////////////////////////////////////////////////////////////// 3. StatusBar/Browser Title



////////////////////////////////////////////////////////////////////////////////////////////////////////







//////////////////////////////////////////////////////////////// 4. Date/Clock/Calculator
// 월별 마지막 일수 추출
function onDemand_js_4001(nYear, nMonth) {
    if (nMonth == 4 || nMonth == 6 || nMonth == 8 || nMonth == 11) {
        return 30;
    }
    else {
        if (nMonth == 2) {
            if (nYear % 4 == 0) return 29;
            else return 28;
        }
        return 31;
    }
}


// 문자열을 날짜형으로 변환
function onDemand_js_4002(time)  //parseTime(time)
{
    var year = time.substr(0, 4);
    var month = time.substr(4, 2) - 1; // 1월=0,12월=11
    var day = time.substr(6, 2);
    var hour = time.substr(8, 2);
    var min = time.substr(10, 2);

    return new Date(year, month, day, hour, min);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////







////////////////////////////////////////////////////////////////////////////////////// 5. Image/Color
function onDemand_js_5001(url, width, height) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '" VIEWASTEXT>');
    document.write('<param name="movie" value="' + url + '">');
    document.write('<param name="quality" value="high">');
    document.write('<param name="wmode" value="transparent">');
    document.write('<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
    document.write('</object>');
}
////////////////////////////////////////////////////////////////////////////////////////////////////////







//////////////////////////////////////////////////////////////////////////////// 6. Keyboard/Mouse



////////////////////////////////////////////////////////////////////////////////////////////////////////








//////////////////////////////////////////////////////////////////////////// 7. Rollover/text effect



////////////////////////////////////////////////////////////////////////////////////////////////////////







//////////////////////////////////////////////////////////////////////////////////////////// 8. Form
// max length값 체크
function onDemand_js_8001(obj, toID) {
    if (toID == null) return;
    var maxLen = obj.getAttribute("maxlength");
    if (obj.value.length >= maxLen) {
        onDemand_js_8002(toID); // orm Object 포커스 이동함수 호출
    }
}


// Form Object 포커스 이동
function onDemand_js_8002(focusid) {
    if (document.getElementById(focusid)) {
        document.getElementById(focusid).focus();
    }
}
////////////////////////////////////////////////////////////////////////////////////////////////////////







/////////////////////////////////////////////////////////////////////////////////////// 9. Other/Etc
// 업로드전에 파일 사이즈 구하기
function onDemand_js_9001(path) {
    var fileObj = document.getElementById("tempFile");
    fileObj.dynsrc = path;
    document.getElementById("sizeReport").innerText = fileObj.fileSize;
}


// 바탕화면에 링크 저장하기
function onDemand_js_9002(url, sitename) {
    var WshShell = new ActiveXObject("WScript.Shell");
    strDesktop = WshShell.SpecialFolders("Desktop");
    var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\" + sitename + ".url");
    oUrlLink.TargetPath = url;
    oUrlLink.Save();
}


// 프린트 영역 지정해서 프린트 하기
function onDemand_js_9003() {
    bV = parseInt(navigator.appVersion);
    if (bV >= 4) window.print();
}
var tempBody;
window.onbeforeprint = function() {
    tempBody = document.body.innerHTML;
    document.body.innerHTML = pri.innerHTML;
}
window.onafterprint = function() {
    document.body.innerHTML = tempBody;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////





/*===================================================================================================================================
<summary>
텍스트박스 border color change Method
</summary>
<Description>   '포커스가 있는 텍스트박스의 테두리색 변경 </Description>
사용법 1 : <asp:TextBox ID="txt_Name" runat="server" onFocus="inFocus1(this)" onBlur="outFocus1(this)"></asp:TextBox>
사용법 2 : <asp:TextBox ID="txt_Name" runat="server" onFocus="this.style.border='1px solid #C71715';" onBlur="this.style.border='1px solid #cccccc';"></asp:TextBox>
===================================================================================================================================*/
function inFocus1(i) {
    (i).style.border = '1px solid #2f92ba';
}

function outFocus1(i) {
    (i).style.border = '1px solid #dadada';
}


/*===================================================================================================================================
<summary>
텍스트박스 옆 도움말 열기 Method
</summary>
<Description>   '포커스가 있는 텍스트박스 옆에 도움말박스 Visible 설정 </Description>
사용법 1 : <asp:TextBox ID="txt_MemberId" runat="server" onFocus="helpOn('help1');" onBlur="helpOff('help1');"></asp:TextBox>
<div id="help1" style="position : absolute; display:none; _width:300px;">
<div class="helpTxt">
<p>3~12 자의 영문 소문자, 숫자와 특수기호(_)만 사용할 수 있습니다.</p>
</div>
<span class="arrow"></span>
</div>
===================================================================================================================================*/
function helpOn(id) {
    document.getElementById(id).style.display = 'block';
}

function helpOff(id) {
    document.getElementById(id).style.display = 'none';
}


/*=================================================================================================================================== start
<summary>
비밀번호 단계별 진단을 위한 Method
</summary>
<Description>   '회원가입시 비밀번호를 입력할 경우 안전단계를 체크하는 함수모음 </Description>
<Description>   '같은 문자 5회반복시 비번등록을 막는 로직 생략 </Description>
===================================================================================================================================*/
var isCapslock = false;          // Caps Lock Key On/Off

// <summary>
// 비밀번호 안전도레벨 설정 Method
// </summary>
// <Description>   '문자열의 영어와 숫자 혼용여부를 체크 </Description>
// <Description>   사용예 onkeyup="checkShiftUp(event);checkpwd_join('upw','uid');" </Description>
// <Description>   사용예 onFocus="inFocus1(this);checkpwd_join('upw','uid');" </Description>
function checkpwd_join() {
    var upw = document.all('ctl00$ContentPlaceHolder_Body$txtMem_Pw1').value;     //비밀번호
    var uid = document.all('ctl00$ContentPlaceHolder_Body$txtMem_Id').value;                       //아이디
    var pwLevel = 0;

    if (upw.length <= 0) {
        showhelpmsg(-1);
    } else if (uid == "" || upw.length < 6) {
        showhelpmsg(1);            // 레벨 "재입력"
    } else if (uid == upw) {
        showhelpmsg(1);             // 레벨 "재입력"
    } else if (upw.length >= 6 && upw.length < 9) {
        showhelpmsg(2);            // 레벨 "낮음"
        pwLevel = 1;
    } else if (upw.length >= 9 && upw.length < 12) {
        if (compareStr(uid, upw) == true) {
            showhelpmsg(2);            // 레벨 "낮음" - 비밀번호에 아이디와 같은 문자가 있을 경우
            pwLevel = 1;
        } else if (pwCheck(upw) == true) {
            showhelpmsg(3);            // 레벨 "보통"
            pwLevel = 2;
        } else if (pwCheck(upw) == false) {
            showhelpmsg(2);            // 레벨 "낮음"
            pwLevel = 1;
        }
    } else if (upw.length >= 12 && upw.length < 16) {
        var nflag = upw.indexOf(uid);
        if (nflag != "-1") {
            showhelpmsg(2);            // 레벨 "낮음" - 비밀번호에 아이디와 같은 문자가 있을 경우
            pwLevel = 1;
        } else if (pwCheck(upw) == true) {
            showhelpmsg(4);            // 레벨 "높음"
            pwLevel = 3;
        } else if (pwCheck(upw) == false) {
            showhelpmsg(3);            // 레벨 "보통"
            pwLevel = 2;
        }
    }

    return pwLevel;
}


// <summary>
// 비밀번호 안전도레벨 설정 Method
// </summary>
// <Description>   '문자열의 영어와 숫자 혼용여부를 체크 </Description>
// <Description>   사용예 onkeyup="checkShiftUp(event);checkpwd_join('upw','uid');" </Description>
// <Description>   사용예 onFocus="inFocus1(this);checkpwd_join('upw','uid');" </Description>
function checkpwd_edit(uid) {
    var upw = document.all('ctl00$ContentPlaceHolder_Body$txtMem_Pw1').value;         //비밀번호
    //var uid = document.getElementById('Hidden_Id').value;                                                //아이디
    var pwLevel = 0;

    if (upw.length <= 0) {
        showhelpmsg(-1);
    } else if (uid == "" || upw.length < 6) {
        showhelpmsg(1);            // 레벨 "재입력"
    } else if (uid == upw) {
        showhelpmsg(1);             // 레벨 "재입력"
    } else if (upw.length >= 6 && upw.length < 9) {
        showhelpmsg(2);            // 레벨 "낮음"
        pwLevel = 1;
    } else if (upw.length >= 9 && upw.length < 12) {
        if (compareStr(uid, upw) == true) {
            showhelpmsg(2);            // 레벨 "낮음" - 비밀번호에 아이디와 같은 문자가 있을 경우
            pwLevel = 1;
        } else if (pwCheck(upw) == true) {
            showhelpmsg(3);            // 레벨 "보통"
            pwLevel = 2;
        } else if (pwCheck(upw) == false) {
            showhelpmsg(2);            // 레벨 "낮음"
            pwLevel = 1;
        }
    } else if (upw.length >= 12 && upw.length < 16) {
        var nflag = upw.indexOf(uid);
        if (nflag != "-1") {
            showhelpmsg(2);            // 레벨 "낮음" - 비밀번호에 아이디와 같은 문자가 있을 경우
            pwLevel = 1;
        } else if (pwCheck(upw) == true) {
            showhelpmsg(4);            // 레벨 "높음"
            pwLevel = 3;
        } else if (pwCheck(upw) == false) {
            showhelpmsg(3);            // 레벨 "보통"
            pwLevel = 2;
        }
    }

    return pwLevel;
}


// <summary>
// 두개의 문자에서 같은 문자열 존재여부 체크 Function
// </summary>
// <Description>   '두 문자열을 비교해서 공통된 부분이 있는지를 체크 </Description>
// <param name="strValue0">아이디</param>
// <param name="strValue1">비밀번호</param>
// <returns>true,false</returns>
function compareStr(strValue0, strValue1) {
    var compareResult = false;
    var nflag = strValue1.indexOf(strValue0);                         // 아이디와 비번을 비교한 결과값

    if (nflag != "-1") { compareResult = true; }  // 아이디와 비번이 공통된 부분이 있을 경우

    return compareResult;
}


// <summary>
// 영어,숫자 혼용여부 체크 Function
// </summary>
// <Description>   '문자열의 영어와 숫자 혼용여부를 체크 </Description>
// <param name="strValue0">비밀번호</param>
// <returns>true,false</returns>
function pwCheck(strValue0) {
    var pwLevelHigh = false;

    r0 = /[A-z]/gi;
    r1 = /[0-9]/gi;
    t0 = strValue0.search(r0);
    t1 = strValue0.search(r1);

    if (t0 != -1 && t1 != -1) { pwLevelHigh = true; }

    return pwLevelHigh;
}


// <summary>
// div 4가지중 하나만 노출
// </summary>
// <Description>   '문자열의 영어와 숫자 혼용여부를 체크 </Description>
// <Description>   사용예 onBlur="outFocus1(this);showhelpmsg(-1);" </Description>
// <param name="strValue0">비밀번호 안전성 레벨</param>
function showhelpmsg(strValue0) {
    for (g = 1; g <= 4; g++) {
        if (strValue0 == g) {
            if (!isCapslock) {
                document.getElementById('help2_' + g).style.display = "block";
                document.getElementById('help3_' + g).style.display = "none";
            } else {
                document.getElementById('help2_' + g).style.display = "none";
                document.getElementById('help3_' + g).style.display = "block";
            }
        } else {  // 파라미터값이 -1일 경우 모든 알림창 노출을 off
            document.getElementById('help2_' + g).style.display = "none";
            document.getElementById('help3_' + g).style.display = "none";
        }
    }
}


// <summary>
// 키보드에 Caps Lock 이 켜지있는지 여부 체크 Function
// </summary>
// <Description>   '키보드에 Caps Lock 이 켜지있는지 여부 체크 </Description>
// <Description>   사용예 onkeypress="capslock(event);" </Description>
// <param name="e">키보드 이벤트</param>
// <returns>true,false</returns>
function capslock(e) {
    var myKeyCode = 0;
    var myShiftKey = false;
    if (window.event) { // IE
        myKeyCode = e.keyCode; myShiftKey = e.shiftKey;
    } else if (e.which) { // netscape ff opera
        myKeyCode = e.which;
        myShiftKey = isshift;
    }
    if ((myKeyCode >= 65 && myKeyCode <= 90) && !myShiftKey) {
        isCapslock = true;
    } else if ((myKeyCode >= 97 && myKeyCode <= 122) && myShiftKey) {
        isCapslock = true;
    } else {
        isCapslock = false;
    }
}
//=================================================================================================================================== end