﻿
/********************************************************************************************************
    공통Popup 정의
    변수 정의 : pop - 파일명, width - 가로사이즈, height - 세로사이즈, flag - 0:스크롤없음, 1:스크롤있음
********************************************************************************************************/
function pop(pop,width,height,flag)
{
  var url = pop;
  var wd = width;
  var he = height;

  if ((window.navigator.userAgent.indexOf("SV1") != -1) || (window.navigator.userAgent.indexOf("MSIE 7") != -1)) {
    wd = wd + 8;
    he = he + 10;

    if (flag == "0" )    {
      window.open(url,"","toolbar=0,menubar=0,scrollbars=no,resizable=no,width=" + wd + ",height=" + he + ";");  }
    else  {
      window.open(url,"","toolbar=0,menubar=0,scrollbars=yes,resizable=no,width=" + wd + ",height=" + he + ";");  }
  }

  else {
  if (flag == "0" )    {
    window.open(url,"","toolbar=0,menubar=0,scrollbars=no,resizable=no,width=" + wd +",height=" + he + ";");  }
  else  {
    window.open(url,"","toolbar=0,menubar=0,scrollbars=yes,resizable=no,width=" + wd +",height=" + he + ";");  }
  }
}

/********************************************************************************************************
    타이틀이미지 정의
    변수 정의 : str01 - 타이틀이미지명 / str02 - 타이틀이미지 텍스트
********************************************************************************************************/
function makeTitleImg(str01,str02) {
  var titImg = str01;
  var titAlt = str02;
  var titleObject = document.getElementById("con_title");
  var titleImgPath = "/img/sk/common/title/";
  var subtxtImgPath = "/img/sk/common/subtxt/pusan/";

  var titleStr = "";

  titleStr += '<table cellpadding="0" cellspacing="0" border="0">';
  titleStr += '  <tr>';
  titleStr += '    <td><img src="' + titleImgPath + titImg + '.gif" alt="'+ titAlt +'"></td>';
  titleStr += '  </tr>';
  titleStr += '</table>';
  titleStr += '<div style="position:relative; left:0px; top:15px; width:636px background-color:#fff; z-index:100;">';
  titleStr += '<table cellpadding="0" cellspacing="0" border="0" width="636" style="background-color:#fff;">';
  titleStr += '  <tr>';
  titleStr += '    <td style="height:20px; vertical-align:top;"><img src="' + subtxtImgPath + 'subtxt_' + titImg + '01.gif" alt=""></td>';
  titleStr += '  </tr>';
  titleStr += '</table>';
  titleStr += '</div>';
  titleStr += '<div style="position:absolute; width:92px; height:257px; z-index:100; left:906px; top:372px; ">';
  titleStr += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="120" height="330">';
  titleStr += '<param name="allowScriptAccess" value="sameDomain" />';
  titleStr += '<param name="movie" value="/img/pusan/common/flash/quickMenu.swf" />';
  titleStr += '<param name="quality" value="high" />';
  titleStr += '<param name="bgcolor" value="#ffffff" />';
  titleStr += '<param name="menu" value="false" />';
  titleStr += '<param name=FlashVars value="city=pusan" /> ';
  titleStr += '<embed src="/img/pusan/common/flash/quickMenu.swf" FlashVars="city=pusan"  quality="high" bgcolor="#ffffff" width="1024" height="330" name="setParam" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>';
  titleStr += '</object>';
  titleStr += '</div>';
  titleObject.innerHTML = titleStr;
}

function ir_makeTitleImg(str01,str02) {
  var titImg = str01;
  var titAlt = str02;
  var titleObject = document.getElementById("con_title");
  var titleImgPath = "/img/sk/common/title/";
  var subtxtImgPath = "/img/sk/common/subtxt/pusan/";

  var titleStr = "";

  titleStr += '<table cellpadding="0" cellspacing="0" border="0">';
  titleStr += '  <tr>';
  titleStr += '    <td><img src="' + titleImgPath + titImg + '.gif" alt="'+ titAlt +'"></td>';
  titleStr += '  </tr>';
  titleStr += '</table>';
  titleStr += '<div style="position:relative; left:0px; top:15px; width:636px background-color:#fff; z-index:100;">';
  titleStr += '<table cellpadding="0" cellspacing="0" border="0" width="636" style="background-color:#fff;">';
  titleStr += '  <tr>';
  titleStr += '    <td style="height:20px; vertical-align:top;"><img src="' + subtxtImgPath + 'subtxt_' + titImg + '01.gif" alt=""></td>';
  titleStr += '  </tr>';
  titleStr += '</table>';
  titleStr += '</div>';
  titleStr += '<div style="position:absolute; width:92px; height:257px; z-index:100; left:906px; top:372px; ">';
  titleStr += '</div>';
  titleObject.innerHTML = titleStr;
}

/*
 * 주민등록번호 형식 검사
 */
function checkResNo(jumin1, jumin2)
{
    var yy         = jumin1.substr(0,2);     // 년도
    var mm     = jumin1.substr(2,2);     // 월
    var dd     = jumin1.substr(4,2);     // 일
    var genda = jumin2.substr(0,1);     // 성별
    var msg, ss, cc;

 // 숫자가 아닌 것을 입력한 경우
    if (!isNumeric(jumin1))
    {
        //alert("주민등록번호 앞자리를 숫자로 입력하세요.");
        return false;
    }
 // 길이가 6이 아닌 경우
    if (jumin1.length != 6)
    {
        //alert("주민등록번호 앞자리를 다시 입력하세요.");
        return false;
    }
 // 첫번째 자료에서 연월일(YYMMDD) 형식 중 기본 구성 검사
    if (yy < "00" || yy > "99" ||
            mm < "01" || mm > "12" ||
            dd < "01" || dd > "31")
    {
        //alert("주민등록번호 앞자리를 다시 입력하세요.");
        return false;
    }
 // 숫자가 아닌 것을 입력한 경우
    if (!isNumeric(jumin2))
    {
        //alert("주민등록번호 뒷자리를 숫자로 입력하세요.");
        return false;
    }
 // 길이가 7이 아닌 경우
    if (jumin2.length != 7)
    {
        //alert("주민등록번호 뒷자리를 다시 입력하세요.");
        return false;
    }
 // 성별부분이 1 ~ 4 가 아닌 경우
    if (genda < "1" || genda > "4")
    {
        //alert("주민등록번호 뒷자리를 다시 입력하세요.");
        return false;
    }
 // 연도 계산 - 1 또는 2: 1900년대, 3 또는 4: 2000년대
    cc = (genda == "1" || genda == "2") ? "19" : "20";
 // 첫번째 자료에서 연월일(YYMMDD) 형식 중 날짜 형식 검사
    if (isYYYYMMDD(parseInt(cc+yy), parseInt(mm), parseInt(dd)) == false)
    {
        //alert("주민등록번호 앞자리를 다시 입력하세요.");
        return false;
    }
 // Check Digit 검사
    if (!isSSN(jumin1, jumin2))
    {
        return false;
    }
    return true;
}

/**
* 숫자 Check
**/
function isNumeric(s)
{
    for (i=0; i<s.length; i++)
    {
        c = s.substr(i, 1);
        if (c < "0" || c > "9") return false;
    }

    return true;
}

/**
* 날짜형식검사
**/
function isYYYYMMDD(y, m, d)
{
    switch (m)
    {
        case 2:     // 2월의 경우
            if (d > 29) return false;
            if (d == 29)
            {
                 // 2월 29의 경우 당해가 윤년인지를 확인
                if ((y % 4 != 0) || (y % 100 == 0) && (y % 400 != 0))
                    return false;
            }
            break;
        case 4:     // 작은 달의 경우
        case 6:
        case 9:
        case 11:
            if (d == 31) return false;
    }
    // 큰 달의 경우
    return true;
}

/**
*
**/
function isSSN(s1, s2)
{
    n = 2;
    sum = 0;
    for (i=0; i<s1.length; i++)
        sum += parseInt(s1.substr(i, 1)) * n++;
    for (i=0; i<s2.length-1; i++)
    {
        sum += parseInt(s2.substr(i, 1)) * n++;
        if (n == 10) n = 2;
    }
    c = 11 - sum % 11;
    if (c == 11) c = 1;
    if (c == 10) c = 0;
    if (c != parseInt(s2.substr(6, 1))) return false;
    else return true;
}


//== $4-1 =======================================================================================================
// 기   능 : null 체크
// 사용 예 : isNullValue(inputValue)
//-------------------------------------------------------------------------------------------------------------
function isNullValue(inputValue){	
	if (inputValue == null || inputValue.length == 0 || inputValue == ""){
		return true;
	}else{
/*		inputValue = trim(inputValue);
		if (inputValue == null || inputValue.length == 0 || inputValue == ""){
			return true;
		}else{		
			return false;
		}
*/		
		return false;
	}
}

//== $11 ======================================================================================================
// 기   능 : 날자 입력받을때 '/' 삽입하기
// 사용 예 : <input type="text" onKeyUp="javascript: toDateFormat(this, '시작일자');">
//			<input type="text" onKeyUp="javascript: toDateFormat(this);">
//-------------------------------------------------------------------------------------------------------------
function toDateFormat(inputElement, title){
	
	var inputDate = inputElement.value;
	var inputDateWithoutMark = "";
	var sectionMark = "-";
	var returnValue = "";
	
	if( event != null && (event.keyCode == '37' || event.keyCode == '39' || event.keyCode == '27' || event.keyCode == '8' || event.keyCode == '46') ) return;
	if(isNullValue(inputDate)) return;
// sectionMark를 제거하는 루프문
	for(i=0; i<inputDate.length; i++){
		if (inputDate.substr(i,1) != sectionMark && inputDate.substr(i,1) != " "){
			inputDateWithoutMark += inputDate.substr(i,1);
		}
	}	
	
	// 숫자체크 : 문자가 입력되었으면 함수 종료하고 input에 포커스
	if (isNaN(inputDateWithoutMark) == true){ // 숫자가 아니면
		if(isNullValue(title)){
			alert("날자 입력에는 숫자만 입력 가능합니다.");
		} else {
			alert("\"" + title + "\" 에는 숫자만 입력 가능합니다.");
		}
		inputElement.value = "";
		inputElement.focus();
		return;
	}
	
	if( event != null && (event.keyCode == '32') ){
		spaceIndex = inputDate.indexOf(" ");
		inputElement.value = inputDate.substring(0, spaceIndex) + inputDate.substring(spaceIndex +1);
		inputElement.focus();
		return;
	}	    	

	if(inputDateWithoutMark.length > 4 && inputDateWithoutMark.length < 8) {
		firstMonthNo = inputDateWithoutMark.substr(4,1);
		// "월"의 첫자리 숫자가 "1" 이하일 때 
		if( inputDate.length > 4 && inputDateWithoutMark.length > 4 && inputDate.indexOf(sectionMark) == 4 && inputDateWithoutMark.length < 8 && firstMonthNo >= 2 && firstMonthNo < 10 ){				
				inputDateWithoutMark = inputDateWithoutMark.substring(0, 4) + "0" + firstMonthNo;
		}
	}	
	if( inputDateWithoutMark.length > 6 && inputDateWithoutMark.length < 9 ) {	
		firstDayNo = inputDateWithoutMark.substr(6,1);
		//일자의 첫자리 숫자가 "3" 이하일 때		
		if( inputDate.indexOf(sectionMark) == 4 && inputDate.lastIndexOf(sectionMark) == 7 && inputDateWithoutMark.length > 6 && inputDateWithoutMark.length < 8 && firstDayNo > 3 && firstDayNo < 10) {
			inputDateWithoutMark = inputDateWithoutMark.substring(0, 6) + "0" + firstDayNo;
		}
	}
	if ((inputDate.indexOf(sectionMark) == -1 || inputDate.indexOf(sectionMark) > 3) && inputDateWithoutMark.length > 3 && inputDateWithoutMark.length < 9) {
		returnValue = inputDateWithoutMark.substr(0,4) + sectionMark + inputDateWithoutMark.substr(4,2);
		if (inputDateWithoutMark.substr(5,1) != ""){
			returnValue += sectionMark +  inputDateWithoutMark.substr(6,2);
		}	
		inputElement.value = returnValue;
	}
	
	// 입력된 값이 8자 일 때 "월일" 을 sectionMark로 구분해 부고 9자리 이상일때는 잉여자리 삭제한다.
	if (inputDateWithoutMark.length >= 8) {
//		alert("8 자리 숫자로 입력하세요.");
		inputElement.value = inputDateWithoutMark.substring(0, 4) + sectionMark + inputDateWithoutMark.substring(4, 6) + sectionMark + inputDateWithoutMark.substring(6, 8);
		inputElement.focus(); 
	}	
}

//== $11 ======================================================================================================
// 기   능 : 날자 입력받을때 '-' 삽입하기
// 사용 예 : var dt = toDateFormatValue('20060602');
//-------------------------------------------------------------------------------------------------------------
function toDateFormatValue( inputDate ){
	var inputDateWithoutMark = "";
	var sectionMark = "-";
	var returnValue = "";
	
	if(isNullValue(inputDate)) return;
	
// sectionMark를 제거하는 루프문
	for(i=0; i < inputDate.length; i++){
		if (inputDate.substr(i,1) != sectionMark && inputDate.substr(i,1) != " "){
			inputDateWithoutMark += inputDate.substr(i,1);
		}
	}	
	
	// 숫자체크 : 문자가 입력되었으면 함수 종료하고 input에 포커스
	if (isNaN(inputDateWithoutMark) == true){ // 숫자가 아니면
		return returnValue;
	}

	if(inputDateWithoutMark.length > 4 && inputDateWithoutMark.length < 8) {
		firstMonthNo = inputDateWithoutMark.substr(4,1);
		// "월"의 첫자리 숫자가 "1" 이하일 때 
		if( inputDate.length > 4 && inputDateWithoutMark.length > 4 && inputDate.indexOf(sectionMark) == 4 && inputDateWithoutMark.length < 8 && firstMonthNo >= 2 && firstMonthNo < 10 ){				
		    inputDateWithoutMark = inputDateWithoutMark.substring(0, 4) + "0" + firstMonthNo;
		}
	}	
	if( inputDateWithoutMark.length > 6 && inputDateWithoutMark.length < 9 ) {	
		firstDayNo = inputDateWithoutMark.substr(6,1);
		//일자의 첫자리 숫자가 "3" 이하일 때		
		if( inputDate.indexOf(sectionMark) == 4 && inputDate.lastIndexOf(sectionMark) == 7 && inputDateWithoutMark.length > 6 && inputDateWithoutMark.length < 8 && firstDayNo > 3 && firstDayNo < 10) {
			inputDateWithoutMark = inputDateWithoutMark.substring(0, 6) + "0" + firstDayNo;
		}
	}
	if ((inputDate.indexOf(sectionMark) == -1 || inputDate.indexOf(sectionMark) > 3) && inputDateWithoutMark.length > 3 && inputDateWithoutMark.length < 9) {
		returnValue = inputDateWithoutMark.substr(0,4) + sectionMark + inputDateWithoutMark.substr(4,2);
		if (inputDateWithoutMark.substr(5,1) != ""){
			returnValue += sectionMark +  inputDateWithoutMark.substr(6,2);
		}	
	}
	
	// 입력된 값이 8자 일 때 "월일" 을 sectionMark로 구분해 부고 9자리 이상일때는 잉여자리 삭제한다.
	if (inputDateWithoutMark.length >= 8) {
		returnValue = inputDateWithoutMark.substring(0, 4) + sectionMark + inputDateWithoutMark.substring(4, 6) + sectionMark + inputDateWithoutMark.substring(6, 8);
	}	
	
	return returnValue;
}

//== $12 ======================================================================================================
// 기   능 : 날자("년월일") 형식에 맞는지 확인하기 (날자입력에 년,월,일 구분마다 sectionMark가 삽입되어 있는지, 정확한 날자인지 확인하기)
// 사용 예 : if( checkDateFormat(document.form1.startDate, '회계일자') == true ) send('insert', 'IGEDAA_end.jsp'); 
//			if( checkDateFormat(document.form1.startDate) == true ) send('insert', 'IGEDAA_end.jsp');
//-------------------------------------------------------------------------------------------------------------
function checkDateFormat(inputElement, title) {
	var sectionMark = "-";
	
	var inputDate = inputElement.value;

	var year, month, day;
	var dateObj, rDD;
	if(isNullValue(inputDate) == true) {     // 아무것도 입력하지 않았을 때에는 성공 -> 별도의 null check 필요
		return true;		
	}
	
	if (inputDate.length != 10){
		// 입력된 값이 8자 이상일때 에러메시지
		if(isNullValue(title)){		
			alert("입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2006-07-23\" 형식으로 수정하여 주십시요.");
		} else {
			alert("\"" + title + "\" 에 입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2006-07-23\" 형식으로 수정하여 주십시요.");
		}
		inputElement.focus();
		return false;
	}
	
	if(inputDate.indexOf(" ") != -1){
		if(isNullValue(title)){
			alert("날자 입력에는 공백을 사용하실 수 없습니다.");
		} else {
			alert("\"" + title + "\" 의 날자 입력에는 공백을 사용하실 수 없습니다.");
		}
		inputElement.focus();
		return false;
	}
		
	for(i=0, nIndex=-1; i<2; i++){
		nIndex = inputDate.indexOf(sectionMark, nIndex + 1);
		if(nIndex == -1) {
			if(isNullValue(title)){
				alert("입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2006-07-23\" 형식으로 수정하여 주십시요.");
			} else {
				alert("\"" + title + "\" 에 입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2006-07-23\" 형식으로 수정하여 주십시요.");
			}
			inputElement.focus();
			return false;
		}
		if(i == 0 && nIndex == 4) { 
			year = inputDate.substr(0, 4);
		} else if(i == 1 && nIndex == 7) {
			month = inputDate.substr(5, 2);
			day = inputDate.substr(8, 2);
		}
	}
	
	if (isNullValue(year) || isNullValue(month) || isNullValue(day)) {
		if(isNullValue(title)){		
			alert("입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2006-07-23\" 형식으로 수정하여 주십시요.");
		} else {
			alert("\"" + title + "\" 에 입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2006-07-23\" 형식으로 수정하여 주십시요.");
		}
		inputElement.focus();
		return false;
	}		
	if (isNaN(year)) {
		if(isNullValue(title)){
			alert("입력하신 년도\"" + year + "\" 에는 숫자만 사용 가능 합니다.");
		} else {
			alert("\"" + title + "\" 입력값 :\"" + year + "\" <- \"" + title + "\" 에는 숫자만 입력 가능합니다.");
		}
		inputElement.focus(); 
		return false;			                                                                                                  
	}
	if (year.length > 0 && year.length != 4) {
		if(isNullValue(title)){
			alert("입력하신 년도\"" + year + "\" 은(는) 잘못된 년도 입니다.");
		} else {
			alert("\"" + title + "\" 에 입력하신 \"" + year + "\" 은(는) 잘못된 년도 입니다.");
		}
		inputElement.focus(); 
		return false;
	}	
	
	if (isNaN(month)) {
		if(isNullValue(title)){
			alert("입력하신 월\"" + month + "\" 에는 숫자만 사용 가능 합니다.");
		} else {
			alert("\"" + title + "\" 입력값 :\"" + month + "\" <- \"" + title + "\" 에는 숫자만 입력 가능합니다.");
		}
		inputElement.focus(); 
		return false;			                                                                                                  
	}
	
	if (month > 12 || month < 1) {
		if(isNullValue(title)){
			alert("입력하신 \"" + month + "\" 은(는) 잘못된 \"월\"입니다.");                                                                        
		} else {
			alert("\"" + title + "\" 에 입력하신 \"" + month + "\" 은(는) 잘못된 \"월\"입니다.");
		}
		inputElement.focus();   
		return false;
	} 
		
	dateObj = new Date( inputDate.replace(sectionMark,"/") );
	rDD = dateObj.getDate();                                         
	if (isNaN(day)) {
		if(isNullValue(title)){
			alert("입력하신 일\"" + day + "\" 에는 숫자만 사용 가능 합니다.");
		} else {
			alert("\"" + title + "\" 입력값 :\"" + day + "\" <- \"" + title + "\" 에는 숫자만 입력 가능합니다.");
		}
		inputElement.focus(); 
		return false;			                                                                                                  
	}
	
	if (day != rDD ) {                                                                                                 
		if(isNullValue(title)){
			alert("입력하신 \"" + day + "\" 은(는) 잘못된 \"일\" 입니다.");                                                                  
		} else {
			alert("\"" + title + "\" 에 입력하신 \"" + day + "\" 은(는) 잘못된 \"일\" 입니다.");
		}	
		inputElement.focus();   
		return false;                                                               
	}                                                                                                 	     
	return true;                                                                                                        
}


//== $11-1 ======================================================================================================
// 기   능 : 년월 입력받을때 '-' 삽입하기
// 사용 예 : <input type="text" onKeyUp="javascript: toYearMonthFormat(this, '시작일자');">
//			<input type="text" onKeyUp="javascript: toYearMonthFormat(this);">
//-------------------------------------------------------------------------------------------------------------
function toYearMonthFormat(inputElement, title){
	
	var inputDate = inputElement.value;
	var inputDateWithoutMark = "";
	var returnValue = "";
	
	if(event.keyCode == '37' || event.keyCode == '39' || event.keyCode == '27' || event.keyCode == '8' || event.keyCode == '46') return;
	if(isNullValue(inputDate)) return;
// '-'를 제거하는 루프문
	for(i=0; i<inputDate.length; i++){
		if (inputDate.substr(i,1) != "-" && inputDate.substr(i,1) != " "){
			inputDateWithoutMark += inputDate.substr(i,1);
		}
	}	
	
	// 숫자체크 : 문자가 입력되었으면 함수 종료하고 input에 포커스
	if (isNaN(inputDateWithoutMark) == true){ // 숫자가 아니면
		if(isNullValue(title)){
			alert("날자 입력에는 숫자만 입력 가능합니다.");
		} else {
			alert("\"" + title + "\" 에는 숫자만 입력 가능합니다.");
		}
		inputElement.focus();
		return;
	}	 
	if(event.keyCode == '32') {
		spaceIndex = inputDate.indexOf(" ");
		inputElement.value = inputDate.substring(0, spaceIndex) + inputDate.substring(spaceIndex +1);
		inputElement.focus();
		return;
	}	
/*	
	if(inputDate.indexOf("/") != -1 && inputDate.indexOf("/") < 4){
		alert(inputDate.substring(0, inputDate.indexOf("/")) + "는 잘못된 년도 입니다.");
		inputElement.focus();
		return;	
	}
*/	
	if(inputDateWithoutMark.length > 4 && inputDateWithoutMark.length < 6) {
		firstMonthNo = inputDateWithoutMark.substr(4,1);
		// "월"의 첫자리 숫자가 "1" 이하일 때 
		if( inputDate.length > 4 && inputDateWithoutMark.length > 4 && inputDate.indexOf("-") == 4 && inputDateWithoutMark.length < 6 && firstMonthNo >= 2 && firstMonthNo < 10 ){				
				inputDateWithoutMark = inputDateWithoutMark.substring(0, 4) + "0" + firstMonthNo;
		}
/*		if( inputDateWithoutMark.length > 5 ){ 
			month = inputDateWithoutMark.substr(4,2);
			if (isNaN(month) || month < 1 || month > 12) {
				alert(month + "는 잘못된 월입니다.");
				inputElement.focus();
				return;	
			}
		}	
	}	
*/		
	}
	if (  ( (inputDate.indexOf("-") == -1 || inputDate.indexOf("-") > 3) && inputDateWithoutMark.length > 3 )  
			|| inputDateWithoutMark.length > 3   )  {
		inputElement.value = inputDateWithoutMark.substr(0,4) + '-' + inputDateWithoutMark.substr(4,2);
	}	
}

//== $12-1 ======================================================================================================
// 기   능 : 날자("년월") 형식에 맞는지 확인하기 (날자입력에 년,월 구분에 "/"가 삽입되어 있는지, 정확한 날자인지 확인하기)
// 사용 예 : if( checkYearMonthFormat(document.form1.startDate, '회계일자') == true ) send('insert', 'IGEDAA_end.jsp'); 
//			if( checkYearMonthFormat(document.form1.startDate) == true ) send('insert', 'IGEDAA_end.jsp');
//-------------------------------------------------------------------------------------------------------------
function checkYearMonthFormat(inputElement, title) {
	
	var inputDate = inputElement.value;
/*alert("inputDate : " + inputDate);	
alert("inputDate.length : " + inputDate.length);
alert("isNullValue(inputDate) : " + isNullValue(inputDate));
*/
	var year, month, day;
	var dateObj, rDD;
	if(isNullValue(inputDate) == true) {     // 아무것도 입력하지 않았을 때에는 성공 -> 별도의 null check 필요
		return true;		
	}
	
	if (inputDate.length != 7){
		// 입력된 값이 8자 이상일때 에러메시지
		if(isNullValue(title)){		
			alert("입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2001-07\" 형식으로 수정하여 주십시요.");
		} else {
			alert("\"" + title + "\" 에 입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2001-07\" 형식으로 수정하여 주십시요.");
		}
		inputElement.focus();
		return false;
	}
	
	if(inputDate.indexOf(" ") != -1){
		if(isNullValue(title)){
			alert("날자 입력에는 공백을 사용하실 수 없습니다.");
		} else {
			alert("\"" + title + "\" 의 날자 입력에는 공백을 사용하실 수 없습니다.");
		}
		inputElement.focus();
		return false;
	}
		
	nIndex = inputDate.indexOf("-");
	if(nIndex != 4) {
		if(isNullValue(title)){
			alert("입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2001-07\" 형식으로 수정하여 주십시요.");
		} else {
			alert("\"" + title + "\" 에 입력하신 날자 \"" + inputDate + "\" 을(를)  ->  \"2001-07\" 형식으로 수정하여 주십시요.");
		}
		inputElement.focus();
		return false;
	} else if(nIndex == 4) { 
		year = inputDate.substr(0, 4);
		month = inputDate.substr(5, 2);
	}
			
	if (isNullValue(year) || isNullValue(month)) {
		if(isNullValue(title)){		
			alert("입력하신 일자(년-월) \"" + inputDate + "\" 을(를)  ->  \"2001-07\" 형식으로 수정하여 주십시요.");
		} else {
			alert("\"" + title + "\" 에 입력하신 일자(년-월) \"" + inputDate + "\" 을(를)  ->  \"2001-07\" 형식으로 수정하여 주십시요.");
		}
		inputElement.focus();
		return false;
	}
	
	if (isNaN(year)) {
		if(isNullValue(title)){
			alert("입력하신 년도\"" + year + "\" 에는 숫자만 사용 가능 합니다.");
		} else {
			alert("\"" + title + "\" 입력값 :\"" + year + "\" <- \"" + title + "\" 에는 숫자만 입력 가능합니다.");
		}
		inputElement.focus(); 
		return false;			                                                                                                  
	}
	if (year.length > 0 && year.length != 4) {
		if(isNullValue(title)){
			alert("입력하신 년도\"" + year + "\" 은(는) 잘못된 년도 입니다.");
		} else {
			alert("\"" + title + "\" 에 입력하신 \"" + year + "\" 은(는) 잘못된 년도 입니다.");
		}
		inputElement.focus(); 
		return false;
	}
	if (isNaN(month)) {
		if(isNullValue(title)){
			alert("입력하신 월\"" + month + "\" 에는 숫자만 사용 가능 합니다.");
		} else {
			alert("\"" + title + "\" 입력값 :\"" + month + "\" <- \"" + title + "\" 에는 숫자만 입력 가능합니다.");
		}
		inputElement.focus(); 
		return false;			                                                                                                  
	}
	
	if (month > 12 || month < 1) {
		if(isNullValue(title)){
			alert("입력하신 \"" + month + "\" 은(는) 잘못된 \"월\"입니다.");                                                                        
		} else {
			alert("\"" + title + "\" 에 입력하신 \"" + month + "\" 은(는) 잘못된 \"월\"입니다.");
		}
		inputElement.focus();   
		return false;
	}
			     
	return true;                                                                                                        
}



function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);
  }function checkPasswdPolicy(pwd)	{	var validPwd = /^[A-Za-z][A-Za-z]{7,19}$/;	var validPwd2 = /^[0-9_-][0-9_-]{7,19}$/;	if (validPwd.test(pwd) || validPwd2.test(pwd) || pwd.length < 8) {		alert('비밀번호를 다시 입력해 주세요!\n비밀번호는 영문숫자 조합으로 8~20자까지 가능합니다.');		return false;	}	// 연속된 숫자 체크	var tmpTarget = "";	var ckNum = "0123456789";	for(i=0;i < ckNum.length - 3; i++){		tmpTarget = ckNum.substring(i,i+3);       					if(pwd.indexOf(tmpTarget)>-1) {			alert("패스워드에 연속된 숫자를 입력하실 수 없습니다.");			return false;		}	}			ckNum = "9876543210";	for(i=0;i < ckNum.length - 3; i++){		tmpTarget = ckNum.substring(i,i+3);				if(pwd.indexOf(tmpTarget)>-1) {			alert("패스워드에 연속된 숫자를 입력하실 수 없습니다.");			return false;		}	}		return true;}
