﻿var domain = "";
var fckObj;

/**
 * action 처리
 */
function act(_frm, _process, _target, _actionUrl) {

    _frm.action = _actionUrl;
    _frm.act.value = _process;

    if(_target!=null) {
    	_frm.target=_target;
    }

    _frm.submit();
}

function go(_frm, _url, _target, _mode) {

  _frm.action = _url;
  _frm.mode.value = _mode;
  if(_target!=null) {
    _frm.target = _target;
  }

  _frm.submit();
}

function go2(_frm, _url, _target) {
  _frm.action = _url;
 
  if(_target!=null) {
    _frm.target = _target;
  }

  _frm.submit();
}

/*
 * 함수명 : popEditor
 * 설  명 : fckEditor 팝업을 띄운다.
 * @param _obj 편집할 내용(html)
 */
function popEditor(_obj) {
	fckObj = _obj;
	var _url = "/popup/popEditor.asp";
	winEditor = window.open(_url , "winEditor",'width=800, height=680, menubar=0, resizable=1, status=0, scrollbars=1');
}

function divEditor(_obj,_idx,_mode){
	var obj = parent.document.getElementById("div_editor");
	if(obj.style.display == "none"){
		frm_editor.mode.value = _mode;
		frm_editor.name.value = _obj.name;
		frm_editor.idx.value = _idx;
		frm_editor.content.value = _obj.value;
		frm_editor.target = "ifr_editor";
		frm_editor.action = "/_master/div/editor.asp";
		frm_editor.submit();
		obj.style.display = "block";
	}else{
		parent.document.getElementById("ifr_editor").src="";
		obj.style.display = "none";
	}
}

/**
 * 주소검색
 */ 
function findZipcode(_gbn){	
	if(_gbn == null){		
		var url = "/_master/popup/find_zipcode_pop.asp";	
	}else{
		var url = "/_master/popup/find_zipcode_pop.asp?gbn=two";
	}
	//popWin(url, "zip", 440, 330, 0);
	var obj = document.getElementById("div_zipcode");

	if(obj.style.display == "none"){
		document.getElementById("ifr_zipcode").src=url;
		obj.style.display = "block";
	}else{
		document.getElementById("ifr_zipcode").src="";
		obj.style.display = "none";
	}
}


function findZipcode2(_gbn){	
	if(_gbn == null){		
		var url = "/page/member/post.asp";	
	}else{
		var url = "/page/member/post.asp?gbn=two";
	}

	popWin(url, "zip", 480, 355, 0);
}

// 담당자 팝업
function findEmp() {
	winEmp = window.open('/intra/com/findEmp.asp','choice','scrollbars=yes,width=700,height=300,left=500,top=300');
}

// 고객조회 팝업
function findCst() {
	winEmp = window.open('/intra/com/findCst.asp','choice','scrollbars=yes,width=700,height=300,left=500,top=300');
}

// 거래처조회 팝업
function findCmp() {
	winEmp = window.open('/intra/com/findCmp.asp','choice','scrollbars=yes,width=700,height=300,left=500,top=300');
}

//입금 조회
function popSettle(res_idx,idx){
	var obj = document.getElementById("div_settle");
	if(obj.style.display == "none"){
		document.getElementById("ifr_settle").src="/_master/res/res_expense.asp?res_idx="+ res_idx +"&exp_idx="+idx;
		obj.style.display = "block";
	}else{
		document.getElementById("ifr_settle").src="";
		obj.style.display = "none";
	}

	//var url = '/_master/reservation/res_expense.asp?res_idx='+ res_idx +'&exp_idx='+idx;
	//popWin(url, 'prod_settle', '659', '600', '1')
}


//입금 연동 정보 조회
	function popSettle2(res_idx,idx){

		var url = '/_master/cal/comp_ib_pop_list.asp?res_idx='+ res_idx +'&exp_idx='+idx;

		popWin(url, 'prod_settle', '900', '800', '1')
	}

//국가 선택용 체인지 셀렉트박스
function addOptionsNation(_selName, _codeCls, _objT) {
	var url = "/act/code_act.asp?act=addOptions1";
	url += "&sel_gbn=nation";
	url += "&p_code=con";
	url += "&sel_name=" + _selName;
	url += "&code_gbn=" + _codeCls;

	ifrControl.location.href = url;
}
//대륙선택
function changeOptions(_obj, _objT, _objT1) {
	
	var selName = _objT;

	obj = document.getElementById(_objT)
	obj1 = document.getElementById(_objT1)

	clearSelectRvs(obj);
	clearSelectRvs(obj1);

	addOptionsNation(selName, _obj.value, _objT);
}

//국가선택
function changeOptions1(_obj, _objC, _objT) {
	
	var selName = _objT;

	obj = document.getElementById(_objT)
	objC = document.getElementById(_objC)

	clearSelectRvs(obj);

	addOptionsNation(selName, objC.value+_obj.value, _objT);
}

//도시선택
function changeOptions2(_obj) {
	
}

/*
 * 함수명 : isEmpty
 * 설  명 : String 입력이 있는지 체크한다.
 * @param _str 문자열
 * @return boolean 입력된 문자열이 없으면 true 아니면 false
 */
function isEmpty(_str) {
    if(_str!=null && _str.length > 0) {
        return false;
    } else {
        return true;
    }
}

/*
 * 함수명 : getChecked
 * 설  명 : Radio 객체에서 체크된 항목의 value 를 반환한다.
 * @param _str (Radio, 체크)
 * @param _delim 체크된 값을 구분할 구분자
 * @return String, 체크된 항목의 value, 없을 경우 ""
 */
function getCheckedValues(_str, _delim){
    var radio = document.getElementsByName(_str);
    var result = "";

    for(var i=0; i<radio.length; i++){
        if(radio[i].checked) {
            result += radio[i].value + _delim;
        }
    }

    return result;
}

//소수점 2자리까지
	function splitData(_value, _name){
		var inputData = _value; //평균수익율 
		var splitData = inputData.split(".");
		if (splitData.length ==2){     //. 이 있을때는 
			var split1 = splitData[1].length;
			if (split1 > 2) {  //소수점 뒤가 2자리수 이상이면
				_name.value = (Math.round(inputData*100))/100; //소수전 3째자리에서 반올림 
			}
		}
	}
	
//소수점처리
function strTruncNumber(_value){

		var inputData = _value.toString(); //평균수익율 

		var ret = inputData;

		var splitData = inputData.split(".");

		if (splitData.length ==2){     //. 이 있을때는 
			var split1 = splitData[1].length;
			if (split1 > 2) {  //소수점 뒤가 2자리수 이상이면
				ret = (Math.round(inputData*100))/100; //소수전 3째자리에서 반올림 
			}
		}

	return ret;
}



	//율 계산
	function cal_rate(_no,gb,_baseAmt,_amt,_rate){

		var baseAmt = document.getElementsByName(_baseAmt);
		var rate = document.getElementsByName(_rate);
		var amt = document.getElementsByName(_amt);

		if(gb == "rate"){

			tmpRate = SelectFloat(rate[_no].value);

			if(tmpRate == 0){
				amt[_no].value = "0";
			}else{
				amt[_no].value = setComma(parseInt(Number(SelectNum(baseAmt[_no].value))*(tmpRate/100)));
			}
		}else{
			if(Number(SelectNum(amt[_no].value)) == 0){
				rate[_no].value = "0";
			}else{
				rate[_no].value = strTruncNumber((Number(SelectNum(amt[_no].value))*100)/Number(SelectNum(baseAmt[_no].value)));
			}
		}
	}
	
	
	//부가세계산
	function cal_rate2(_amt,_rate){

		return Number(_amt)*(_rate/100);
	}

	//입력값이 소수 일경우 숫자타입으로 return
	function SelectFloat(str){
		
		var ret = 0;		
		
		if(str != ""){
			tmpPot = str.lastIndexOf(".");

			if(tmpPot > 0){
				str = SelectNum(str.substr(0,tmpPot))+"."+SelectNum(str.substr(tmpPot+1,str.length+1))
			}else{
				str = SelectNum(str);
			}
		}

		if(str != "" && !isNaN(str)){	//문자체크
			ret = Number(str);
		}

		return ret;

	}

	
/*
 * 함수명 : chk_nan
 * 설  명 : input 박스안에 NaN 을 제거
*/ 
	//isNAN 변환처리
	function chk_nan(){
		//var chk_isnan = document.getElementById("chk_nan");
		var chk_input = document.getElementsByTagName("INPUT");
		
		for(var i=0; i < chk_input.length; i++){
			if(chk_input[i].value == "NaN"){ 
				chk_input[i].value = "";
			}
			if(chk_input[i].value == "Infinity"){ 
				chk_input[i].value = "";
			}
			
		}
	}


/*
 * 함수명 : checkRadio
 * 설  명 : Radio 객체를 선택한다.
 */
function checkRadio(_str, _value) {
    var radio = document.getElementsByName(_str);
    var result = "";

    for(var i=0; i<radio.length; i++){
        if(radio[i].value==_value) {
            radio[i].checked = true;
        }
    }
}

/*
 * 함수명 : checkRadio
 * 설  명 : Radio 객체를 선택한다.
 */
function checkRadioOpener(_str, _value) {
    var radio = opener.document.getElementsByName(_str);
    var result = "";

    for(var i=0; i<radio.length; i++){
        if(radio[i].value==_value) {
            radio[i].checked = true;
        }
    }
}

/*
 * 함수명 : checkRadio
 * 설  명 : Radio 객체를 선택한다.
 */
function checkRadioparent(_str, _value) {
    var radio = parent.document.getElementsByName(_str);
    var result = "";

    for(var i=0; i<radio.length; i++){
        if(radio[i].value==_value) {
            radio[i].checked = true;
        }
    }
}

/*
 * 함수명 : noneCheckRadio
 * 설  명 : Radio 객체를 선택해제 한다.
 */
function noneCheckRadio(_str) {
    var radio = document.getElementsByName(_str);
    var result = "";

		if(radio){
		
				for(var i=0; i<radio.length; i++){
					 radio[i].checked = false;
				}
		}

}


/**
 * iframe의 height를 body의 내용만큼 자동으로 늘려줌.
 */
function resizeFrame(name) {
  var oBody = document.body;
  var oFrame = parent.document.all(name);
  var min_height = 50;  //iframe의 최소높이(너무 작아지는 걸 막기위함, 픽셀단위, 편집가능)
  var min_width = 400;  //iframe의 최소너비
  var i_height = oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);
  //var i_width = oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);

  if(i_height < min_height) i_height = min_height;
  //if(i_width < min_width) i_width = min_width;
  oFrame.style.height = i_height;
  //oFrame.style.width = i_width;
}



/**
 * iframe의 height를 body의 내용만큼 자동으로 늘려줌. width는 그대로
 */
function resizeFrame2(name) {
  var oBody = document.body;
  var oFrame = parent.document.getElementById(name);
	//alert(oFrame);
	//return;
  var min_height = 50;  //iframe의 최소높이(너무 작아지는 걸 막기위함, 픽셀단위, 편집가능)
  var min_width = 400;  //iframe의 최소너비
  var i_height = oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);
  var i_width = oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);

  if(i_height < min_height) i_height = min_height;
  if(i_width < min_width) i_width = min_width;
  oFrame.style.height = i_height;
  //oFrame.style.width = i_width;
}


/**
 * iframe의 height를 body의 내용만큼 자동으로 늘려줌.
 */
function resizeFrame3(name) {
  var oBody = document.body;
  var oFrame = top.document.all(name);
  var min_height = 50;  //iframe의 최소높이(너무 작아지는 걸 막기위함, 픽셀단위, 편집가능)
  var min_width = 400;  //iframe의 최소너비
  var i_height = oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight + oBody.offsetHeight-oBody.clientHeight);
  var i_width = oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth + oBody.offsetWidth-oBody.clientWidth);

  if(i_height < min_height) i_height = min_height;
  if(i_width < min_width) i_width = min_width;
  oFrame.style.height = i_height;
  oFrame.style.width = i_width;
}


/**
 * iframe의 height를 body의 내용만큼 자동으로 늘려줌.
 * 만약 같은 이름의 아이프레임이 배열로 존재하실에..idx 값넘겨줘서 판별후에 리사이즈
 */
function resizeFrame4(name,_idx) {
  var oBody = document.body;

	var oFrame = parent.document.getElementsByName(name)[_idx];
  var min_height = 50;  //iframe의 최소높이(너무 작아지는 걸 막기위함, 픽셀단위, 편집가능)
  var min_width = 400;  //iframe의 최소너비
  var i_height = oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);
  var i_width = oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);

  if(i_height < min_height) i_height = min_height;
  if(i_width < min_width) i_width = min_width;
  oFrame.style.height = i_height;
//  oFrame.style.width = i_width;
}

/**
 * iframe의 height를 body의 내용만큼 자동으로 늘려줌.
 */
function resizeFrame5(name) {
  var oBody = document.body;
  var oFrame = parent.document.all(name);
  var min_height = 50;  //iframe의 최소높이(너무 작아지는 걸 막기위함, 픽셀단위, 편집가능)
  var min_width = 400;  //iframe의 최소너비
  var i_height = oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);
  //var i_width = oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);

  if(i_height < min_height) i_height = min_height;
  //if(i_width < min_width) i_width = min_width;
  oFrame.style.height = i_height + 100;
  //oFrame.style.width = i_width;
}


//이미지확대 대상 이미지에 style="filter:blendTrans(duration=0.5)" 추가
function changePhoto2(_img, url) {
	var bigImg=document.getElementById(_img);
	bigImg.filters.blendTrans.apply();
	bigImg.src = url
	bigImg.filters.blendTrans.play();
	return;
}

function popWin(_url, _winName, wWid, wHeig, wScl) {

	if(wWid == null)	wWid = 400;
	if(wHeig == null)	wHeig = 300;
	if(wScl == null)	wScl = 1;

    win = window.open(_url , _winName, 'width='+wWid+', height='+wHeig+', menubar=0, resizable=0, status=0, scrollbars='+wScl);

    return win;
}

/**
 * Array 에서 특정값의 index 를 구하는 함수
 *
 * @param _arr	검색대상 Array
 * @param _string 검색할 값
 */
function getArrayIndexByValue(_arr, _string) {
	for(var i=0; i < _arr.length; i++) {
		if(_string==_arr[i]) {
			return i;
		}
	}

	return -1;
}

/**
 * Array 에서 자신의 Index 를 구하는 함수
 * 존재하지 않을 경우 -1
 */
function getArrayIndex(_obj) {
	if(!_obj) return -1;
	var arr = document.getElementsByName(_obj.name);
	for(var i=0; i < arr.length; i++) {
		if(_obj.uniqueID == arr[i].uniqueID) {
			return i;
		}
	}
}

/**
 * 특정테이블에서 마지막 라인(tr) 을 복사하여 추가한다.
 */
function addRow(_table, _idx) {
	var oTable		= _table;
	//alert(oTable);

	var idx = _idx;	 // 헤더의 row수를 고려하여 변경한다.
	if(oTable.rows.length == 2 && oTable.rows(1).style.display == "none") {
		oTable.rows(1).style.display = "block";
		return oTable.rows(1);
	}
	
	if(!_idx) {
		idx = oTable.rows.length;
	}

	//alert("ar"+idx);

	var oTr			= oTable.insertRow(idx);
	var oCol		= null;
	
	// 속성복사
	oTr.mergeAttributes(oTable.rows(oTr.rowIndex - 1));
	
	// 컬럼생성
	for(var i=0; i < oTable.rows(oTr.rowIndex - 1).cells.length; i++) {
		oCol = oTr.insertCell(i);
		oCol.innerHTML = oTable.rows(oTr.rowIndex - 1).cells(i).innerHTML;
		oCol.mergeAttributes(oTable.rows(oTr.rowIndex - 1).cells(i), false);
	}

	return oTr;
}

/**
 * 특정테이블에서 마지막 전 라인(tr) 을 복사하여 추가한다.
 */
function addPreRow(_table, _idx) {
	var oTable		= _table;
	//alert(oTable);

	var idx = _idx;	 // 헤더의 row수를 고려하여 변경한다.
	if(oTable.rows.length == 2 && oTable.rows(1).style.display == "none") {
		oTable.rows(1).style.display = "block";
		return oTable.rows(1);
	}
	
	if(!_idx) {
		idx = oTable.rows.length;
	}

	//alert("apr"+idx);

	var oTr			= oTable.insertRow(idx);
	var oCol		= null;
	
	// 속성복사
	oTr.mergeAttributes(oTable.rows(oTr.rowIndex - 2));
	
	// 컬럼생성
	for(var i=0; i < oTable.rows(oTr.rowIndex - 2).cells.length; i++) {
		oCol = oTr.insertCell(i);
		oCol.innerHTML = oTable.rows(oTr.rowIndex - 2).cells(i).innerHTML;
		oCol.mergeAttributes(oTable.rows(oTr.rowIndex - 2).cells(i), false);
	}

	return oTr;
}

/**
 * 특정테이블에서 마지막 라인(tr) 을 복사하여 추가한다.
 */
function addRow3(_table, _idx) {
	var oTable		= _table;
	//alert(oTable);

	var idx = _idx;	 // 헤더의 row수를 고려하여 변경한다.
	if(oTable.rows.length == 2 && oTable.rows(1).style.display == "none") {
		oTable.rows(1).style.display = "block";
		return oTable.rows(1);
	}
	
	if(!_idx) {
		idx = oTable.rows.length;
	}

	//alert("ar"+idx);

	var oTr			= oTable.insertRow(idx);
	var oCol		= null;
	
	// 속성복사
	oTr.mergeAttributes(oTable.rows(oTr.rowIndex - 2));
	
	// 컬럼생성
	for(var i=0; i < oTable.rows(oTr.rowIndex - 2).cells.length; i++) {
		oCol = oTr.insertCell(i);
		oCol.innerHTML = oTable.rows(oTr.rowIndex - 2).cells(i).innerHTML;
		oCol.mergeAttributes(oTable.rows(oTr.rowIndex - 2).cells(i), false);
	}

	return oTr;
}

/**
 * 특정테이블에서 마지막 라인(tr) 을 복사하여 추가한다.
 */
function addRow2(_table, _idx) {

	var oTable		= _table;
	var idx = _idx;	 // 헤더의 row수를 고려하여 변경한다.
	if(oTable.rows.length == 2 && oTable.rows(1).style.display == "none") {
		oTable.rows(1).style.display = "block";
		return oTable.rows(1);
	}
	
	if(!_idx) {
		idx = oTable.rows.length-1;
	}

	var oTr			= oTable.insertRow(idx);
	var oCol		= null;
	
	// 속성복사
	oTr.mergeAttributes(oTable.rows(oTr.rowIndex - 1));
	
	// 컬럼생성
	for(var i=0; i < oTable.rows(oTr.rowIndex - 1).cells.length; i++) {
		oCol = oTr.insertCell(i);
		oCol.innerHTML = oTable.rows(oTr.rowIndex - 1).cells(i).innerHTML;
		oCol.mergeAttributes(oTable.rows(oTr.rowIndex - 1).cells(i), false);
	}

		for(i=0;i<oTable.rows(oTr.rowIndex).cells.length; i++){
			

			for(k=0;k < oTable.rows(oTr.rowIndex).cells(i).children.length;k++){

				tag = oTable.rows(oTr.rowIndex).cells(i).children.item(k).tagName.toUpperCase();

				if(tag == "INPUT" && oTable.rows(oTr.rowIndex).cells(i).children.item(k).className != "ns_InputReadOnly"){
					oTable.rows(oTr.rowIndex).cells(i).children.item(k).value = "";	//이미선택된 값이 있기때문에 리셋처리함
					oTable.rows(oTr.rowIndex).cells(i).children.item(k).readOnly = false;
					oTable.rows(oTr.rowIndex).cells(i).children.item(k).disabled = false;

					//oTable.rows(oTr.rowIndex).cells(i).children.item(k).className = "ns_InputRead_1";
				}
			}


		}


	return oTr;
}

/**
 * 특정테이블에서 특정 라인(tr) 을 삭제한다.
 */
function removeRow(_table, _idx) {
//	var oTable    = document.getElementById(_tableId);
	var oTable = _table

		//alert(_idx);

	/*
	if (_idx==2 && oTable.rows.length == 2) {
		oTable.rows(_idx).style.display = "none";
		*/
	//if (_idx!=null && _idx > -1 && oTable.rows.length > 2) {
	if (_idx!=null && oTable.rows.length > 2) {
		oTable.deleteRow(_idx);
	} else {
		alert('더 이상 삭제하실 수 없습니다.');
		return;
	}
}

function removeRowSelect(_table, _idx) {
//	var oTable    = document.getElementById(_tableId);
	var oTable = _table

		//alert(_idx);

	/*
	if (_idx==2 && oTable.rows.length == 2) {
		oTable.rows(_idx).style.display = "none";
		*/
	//if (_idx!=null && _idx > -1 && oTable.rows.length > 2) {
	if (_idx!=null) {
		oTable.deleteRow(_idx);
	} else {
		alert('더 이상 삭제하실 수 없습니다.');
		return;
	}
}

/**
 * 특정테이블에서 특정 2라인(tr) 을 삭제한다.
 */
function removeRows(_table, _idx) {
//	var oTable    = document.getElementById(_tableId);
	var oTable = _table


	/*
	if (_idx==2 && oTable.rows.length == 2) {
		oTable.rows(_idx).style.display = "none";
		*/
	//if (_idx!=null && _idx > -1 && oTable.rows.length > 2) {
	if (_idx!=null) {
		//alert(_idx);
		oTable.deleteRow(_idx+1);
		oTable.deleteRow(_idx);
		
	} else {
		alert('더 이상 삭제하실 수 없습니다.');
		return;
	}
}


/**
 * 대원고속관광 패키지 예약화면때문에...
 * 삭제 한 다음에 가격계산 함수 추가!!!
 */
function removeRowTicket(_table, _idx) {

//	var oTable    = document.getElementById(_tableId);
	var oTable = _table

	/*
	if (_idx==2 && oTable.rows.length == 2) {
		oTable.rows(_idx).style.display = "none";
		*/
	//if (_idx!=null && _idx > -1 && oTable.rows.length > 2) {
	if (_idx!=null) {
		oTable.deleteRow(_idx);
		prod_price2();
	} else {
		alert('더 이상 삭제하실 수 없습니다.');
		return;
	}
}

/**
 * 특정테이블에서 특정 라인(tr) 을 삭제한다.
 */
function removeRow2(_table, _idx) {
//	var oTable    = document.getElementById(_tableId);
	var oTable = _table

	/*
	if (_idx==2 && oTable.rows.length == 2) {
		oTable.rows(_idx).style.display = "none";
		*/
	//if (_idx!=null && _idx > -1 && oTable.rows.length > 2) {
	if (_idx!=null && _idx > 0) {
		idx = 0;
		oTable.deleteRow(_idx);
	} else {
		alert('더 이상 삭제하실 수 없습니다.');
		return;
	}
}

function removeRow3(_table) {
//	var oTable    = document.getElementById(_tableId);
	var oTable = _table
	if (parseInt(oTable.rows.length) > 0)
	{	
		for (i = parseInt(oTable.rows.length-1) ;i > 0 ; i--)
		{
			oTable.deleteRow([i]);
		}
	}
	/*
	if (_idx!=null && _idx > 0) {
		idx = 0;
		oTable.deleteRow(_idx);
	} else {
		alert('더 이상 삭제하실 수 없습니다.');
		return;
	}*/
}

function removeRow4(_table, _idx) {
//	var oTable    = document.getElementById(_tableId);
	var oTable = _table

	/*
	if (_idx==2 && oTable.rows.length == 2) {
		oTable.rows(_idx).style.display = "none";
		*/
	//if (_idx!=null && _idx > -1 && oTable.rows.length > 2) {
	if (_idx!=null && _idx > 0 && oTable.rows.length > 2) {
		oTable.deleteRow(_idx);
	} else {
		alert('더 이상 삭제하실 수 없습니다.');
		return;
	}
}
/**
 * 특정 태그안의 입력폼을 초기화 한다.
 * 
 * @param _obj TABLE, TR, TD 등 입력폼(INPUT, SELECT)을 가질 수 있는 태그
 * @param _arrNames 초기화할 입력폼의 이름(name) 을 포함한 Array
 * @param _arrValues 초기화할 입력폼의 기본값(value)을 포함한 Array
 * 
 * ex) name1 = value1, name2 = value2 로 초기화 시킬 때
 *     initForm(td, new Array("name1","name2"), new Array("value1","value2"));
 *
 */
function initForm(_obj, _arrNames, _arrValues) {
	var inputs = _obj.getElementsByTagName("INPUT");
	var selects = _obj.getElementsByTagName("SELECT");
	var textareas = _obj.getElementsByTagName("TEXTAREA");
	var spans = _obj.getElementsByTagName("SPAN");
	var input = null;
	var select = null;
	var textarea = null;
	var span = null;
	var defaultValue = "";
	var idx = -1;

	/* INPUT 태그의 값을 초기화 한다. */
	for(var i=0; i < inputs.length; i++) {
		input = inputs[i];
		// 기본값을 설정한다.
		idx = (getArrayIndexByValue(_arrNames, input.name));
		if(idx > -1) {
			defaultValue = _arrValues[idx];
			switch(input.type) {
				case "text" : input.value = defaultValue; break;
				case "checkbox" : input.checked = input.value == defaultValue ? true : false; break;
				/*
				   radio 의 경우 이름이 같으면 전체가 연동되기 때문에 사용이 불가능하다.
				   select 로 대체사용
				case "radio" : input.checked = input.value == defaultValue ? true : false; break;
				*/
				case "select" : input.value = defaultValue; break;
				case "hidden" : input.value = defaultValue; break;
				default :
			}
		}
	}

	/* SELECT 태그의 값을 초기화 한다. */
	for(var i=0; i < selects.length; i++) {
		select = selects[i];
		idx = getArrayIndexByValue(_arrNames, select.name);
		if(idx > -1) {
			defaultValue = _arrValues[idx];
			select.value = defaultValue;
			select.disabled = false;
			/*
			idx = getOptionIndexByValue(select.options, defaultValue);
			alert(idx);
			if(idx > -1) {
				select.options[idx].selected = true;
			}
			*/
		}
	}

	/* TEXTAREA 태그의 값을 초기화 한다. */
	for(var i=0; i < textareas.length; i++) {
		textarea = textareas[i];
		idx = getArrayIndexByValue(_arrNames, textarea.name);
		if(idx > -1) {
			defaultValue = _arrValues[idx];
			textarea.innerText = defaultValue;
		}
	}

	/* SPAN 태그의 값을 초기화 한다. */
	for(var i=0; i < spans.length; i++) {
		spans[i].innerText = "";
	}
}

/**
 * 업로드파일 추가
 * @param _filelist SELECT
 * @param _filename 파일명
 * @param _filesize 파일크기
 * @param _fileurl  파일URL
 */
function addFile(_filename, _filesize, _fileurl) {

  _filesize = parseInt(_filesize);
  var obj = document.all.filelist;
	var newRow = addRow(obj);
	var chk_file = newRow.cells[0].getElementsByTagName('INPUT');
	chk_file[0].value = _fileurl;
	newRow.cells[1].innerText = _filename;
	newRow.cells[2].innerText = setComma(_filesize);
	newRow.cells[3].innerText = _fileurl;
	newRow.cells[4].innerText = "";
	newRow.cells[5].innerText = "new";
}


/**
 * 업로드파일 추가
 * @param _filelist SELECT
 * @param _filename 파일명
 * @param _filesize 파일크기
 * @param _fileurl  파일URL
 */
function addFile_prod(_filename, _filesize, _fileurl) {	
  _filesize = parseInt(_filesize);
	
  var obj = document.all.filelist;
	
	var newRow = addRow(obj);
	var chk_file = newRow.cells[0].getElementsByTagName('INPUT');
	chk_file[0].value = _fileurl;
	
	newRow.cells[1].innerText = _filename;
	newRow.cells[2].innerText = setComma(_filesize);
	newRow.cells[3].innerText = _fileurl;
	newRow.cells[4].innerText = "";
	newRow.cells[5].innerText = "new";
	newRow.cells[6].innerHTML = "<input type='text' size='20' name='f_title'>";
	newRow.cells[7].innerHTML = "<input type='text' size='3' name='f_dp_level'>";
}


/**
 * 업로드파일 추가
 * @param _filelist SELECT
 * @param _filename 파일명
 * @param _filesize 파일크기
 * @param _fileurl  파일URL
 */
function addFile_prod99(_filename, _filesize, _fileurl) {

  _filesize = parseInt(_filesize);
  var obj = document.getElementById("filelist99");//'document.all.filelist;
	var newRow = addRow(obj);
	var chk_file = newRow.cells[0].getElementsByTagName('INPUT');
	chk_file[0].value = _fileurl;
	newRow.cells[1].innerText = _filename;
	newRow.cells[2].innerText = setComma(_filesize);
	newRow.cells[3].innerText = _fileurl;
	newRow.cells[4].innerText = "";
	newRow.cells[5].innerText = "new";
	newRow.cells[6].innerHTML = "<input type='text' size='20' name='f_title'>";
	newRow.cells[7].innerHTML = "<input type='text' size='3' name='f_dp_level'>";
}



/**
 * 업로드파일 추가
 * @param _filelist SELECT
 * @param _filename 파일명
 * @param _filesize 파일크기
 * @param _fileurl  파일URL
 */
function addFile_info(_filename, _filesize, _fileurl, _title) {

  _filesize = parseInt(_filesize);
  var obj = document.all.filelist;
	var newRow = addRow(obj);
	var chk_file = newRow.cells[0].getElementsByTagName('INPUT');
	chk_file[0].value = _fileurl;
	newRow.cells[1].innerHTML = "<img src=/uploads/info/"+ _fileurl +" width=45 height=37 border=0 /><br><center>" + _filename + "</center>";
	newRow.cells[2].innerText = _filename;
	newRow.cells[3].innerText = setComma(_filesize);
	newRow.cells[4].innerText = _fileurl;	
	newRow.cells[5].innerText = "";
	newRow.cells[6].innerText = "new";
	newRow.cells[7].innerHTML = "<input style='width:60%' class=form1 type=text name='f_title' size=10><select class=form1 name='f_gbn'><option value='Y' selected>갤러리노출</option><option value='N'>노출안함</option></select><br /><textarea name='f_content' style='width:95%;' cols='10' rows='4' class=form1 onDblClick='popEditor(this);'></textarea>";
}

/**
 * 업로드파일 삭제 (실제파일 삭제 후에 화면의 목록 처리)
 *
 * 목록에 삭제표시 후 숨김
 */
function delFile() {
	if(!confirm("선택파일을 삭제하시겠습니까?")) return;
	var obj = document.getElementById('filelist');
	var chk = document.getElementsByName('chk_file');
	var cnt = chk.length;

	for(var i=cnt; i > 0; i--) {
		if(chk[i-1].checked) {
			obj.rows[i].cells[5].innerText = "del";
			var chk_file = obj.rows[i].cells[0].getElementsByTagName('INPUT');
			chk_file[0].checked = false;
			obj.rows[i].style.display = "none";
			//removeRow(obj, i+1);
		}
	}
}

/**
 * 앞에 이미지 보여주는 파일형식일시
 * 업로드파일 삭제 (실제파일 삭제 후에 화면의 목록 처리)
 *
 * 목록에 삭제표시 후 숨김
 */
function delFile2() {
	if(!confirm("선택파일을 삭제하시겠습니까?")) return;
	var obj = document.getElementById('filelist');
	var chk = document.getElementsByName('chk_file');
	var cnt = chk.length;



	for(var i=cnt; i > 0; i--) {
		if(chk[i-1].checked) {
			obj.rows[i].cells[6].innerText = "del";
			var chk_file = obj.rows[i].cells[0].getElementsByTagName('INPUT');
			chk_file[0].checked = false;
			obj.rows[i].style.display = "none";
			//removeRow(obj, i+1);
		}
	}
}


/**
 * 전체파일사이즈를 구한다. 
 */
function getFileSize() {
  var obj = document.all.filelist;
  var filesize = 0;
  for(var i=1; i < obj.length; i++) {
    var txt = obj[i].value.split("|"); //Array
    filesize += parseInt(txt[1]);
  }
  return filesize;
}

/**
 * 파일확장자 검사
 * @param fileName 파일명
 * @param extension 확장자('|'로 구분된 문자열 : 'gif|png|jpg')
 */
function validateFileExtension(fileName, extension) {
    if(fileName==null || extension==null) return false;

    var ext = fileName.substring(fileName.lastIndexOf(".") + 1);
    if(extension.toLowerCase().lastIndexOf(ext.toLowerCase()) < 0) {
    	alert("Invalid extension");
    	return false;
    }
	//var pattern = new RegExp("[zip|rar|doc|xls|ppt|pdf|hwp]$","i");
    //if(!pattern.test(fileName)) {
    //    alert("Invalid extension");
    //    return false;
    //}
    return true;
}

/**
 * 이미지 리사이즈
 */
function resizeImg(imgObj, max_width, max_height) {
	var width, height;

	width	= parseInt(imgObj.width);

	if(width == 0) {
		return false;
	}

	height	= parseInt(imgObj.height);
	if(height > max_height) {
		imgObj.style.width		= Math.ceil(width * max_height / height);
		imgObj.style.height	= max_height;
	}
	if(width > max_width) {
		imgObj.style.height	= Math.ceil(height * max_width / width);
		imgObj.style.width		= max_width;
	}

	return true;
}

/**
 * 이미지 리사이즈 비율로 가로세로, 둘중 하나 기준.
 */
function resizeImg2(imgObj, max_width, max_height) {
	var width, height;

	width	= parseInt(imgObj.width);

	if(width == 0) {
		return false;
	}

	height	= parseInt(imgObj.height);

	if(height > width){ //세로이미지
		imgObj.style.height	= max_height;
	}else{
		imgObj.style.width		= max_width;
	}

	return true;
}

/*
 * 문자열 객체에 trim 메소드 설정
 * ex) str.value.trim()
 */
String.prototype.trim = function(str){
	str = this != window ? this : str;
	return str.replace(/^\s+/g,'').replace(/\s+$/g,'');
}

/*
 * String 의 Byte 수를 Count 하는 함수
 */
function byteLength(str) {
	var charCnt = 0;

	for(var i = 0; i < str.length; i++) {
		var chr = str.substr(i,1);
		chr = escape(chr);
		var key_eg = chr.charAt(1);

		switch(key_eg) {
			case "u":
				key_num = chr.substr(2,(chr.length - 1));

				charCnt += 2;
				break;
			case "B":
				charCnt += 2;
				break;
			default:
				charCnt += 1;
		}
	}

	return charCnt;
}

	function chkStringLen(obj,pLen){
		var ret = true;
		var cLen = Number(byteLength(obj.value));

		if(cLen > Number(pLen)){
			alert("입력가능한 길이를 초과하였습니다. 기준: "+ pLen +"byte  입력: "+ cLen +"byte");
			ret = false;
		}
		return ret;
	}
/*
 * 숫자만 입력했는지 여부를 체크
 */
function checkNumeric(field) {
	var pattern = /^[0-9]+$/;
    var str = field.value.trim();
	if(str.length > 0 && !pattern.test(str)) {
        alert("숫자로 입력해주세요!");
				field.value = "";
        return field.focus();
    }
}

// 숫자만 입력 가능하도록 하는 함수(소숫점포함)
function isNumber(input) {
	if( input.value.search(/[^0-9.]/) >= 0 ) { 
		return false;
	} else
		return true;
}

/**
 * ID형식 체크
 */
function validateId(field) {
    // 첫문자는 영문자
	var pattern = /^[a-z|A-Z][a-z|A-Z|0-9]+$/;
    var str = field.value.trim();

    if(str.length < 1) {
    } else if(str.length < 3 || str.length > 20) {
        alert("아이디는 3자이상 이어야합니다.");
        return field.focus();
    } else if(!pattern.test(str)) {
        alert("아이디의 첫문자는 영문자이어야 하고 한글 및 특수문자는 사용할 수 없습니다.");
        return field.focus();
    }
}

/**
 * Password형식 체크
 */
function validatePassword(field) {
    var str = field.value.trim();
    if(str.length < 1) {
    } else if(str.length < 6 || str.length > 10) {
        alert("Invalid");
        return field.focus();
    }
}

/*
 * 숫자형태의 문자열 3자리마다 콤마 설정
 */
function setComma(fieldValue){
	var str = String(fieldValue);
	str = str.trim();
	var pattern = /^(-?\d+)(\d{3})($|\..*$)/;
	if (pattern.test(str)){
		return str.replace(pattern,
				function(str1,p1,p2,p3) {
					return setComma(p1) + "," + p2 + p3;
				}
		);
	}else{
		return str;
	}
}

/*
 * 문자열 바꾸기
 * @param _str 	원본 문장
 * @param _src  원본 문자열
 * @param _dest 바뀔 문자열
 */
function replaceAll(_str, _src, _dest){
	var str = _str.trim();
	var temp_str = "";

  if (str != "" && _src != _dest){
		temp_str = str;
		while (temp_str.indexOf(_src) > -1){
			temp_str = temp_str.replace(_src, _dest);
		}
	}
	return temp_str;
}

/*
 * checkbox 전체 토글
 * @param 
 */
function checkAll(_obj, _chkName) {
	var chkList = document.getElementsByName(_chkName);
	var cnt = chkList.length;
	for(var i=0; i < cnt; i++) {
		chkList[i].checked = _obj.checked;
	}
}

/*
 * select 전체 토글
 * @param 
 */
function selectAll(_val, _selName) {
	var selList = document.getElementsByName(_selName);
	var cnt = selList.length;
	
	for(var i=0; i < cnt; i++) {
		if(selList[i].style.display != "none"){
				selList[i].value = _val;
		}
		
	}
	if(frmSearch.proc_status.value != null){
			frmSearch.proc_status.value = "";
	}
}

/*
 * checkbox 전체 토글
 * @param 
 */
function checkAll2(_chkName) {
	var chkList = document.getElementsByName(_chkName);
	var cnt = chkList.length;
	for(var i=0; i < cnt; i++) {
			if(chkList[i].checked == true){
				chkList[i].checked = false;
			}else{
				chkList[i].checked = true;
			}
	}
}

/*
 * 문자열의 숫자형 변환, 변환에 실패할 경우 0
 */
function getNumber(_str) {
	var pattern = /^[0-9]+$/;
	var result = 0
	
	if(_str.length < 1) {
		result = 0;
  } else {
		if(!pattern.test(_str)) {
			result = 0;
		} else {
			result = parseInt(_str);
		}
	}
	
	return result;
}

/*
 * 왼쪽에 ch 문자 채우기
 */
function lpad(newValue, len, ch){
	var strlen = newValue.toString().length;
	var ret = "";
	var alen = len - strlen;
	var astr = ""; 
	
	//부족한 숫자만큼  len 크기로 ch 문자로 채우기
	for (i=0; i<alen; ++i) {
		astr = astr + ch;
	}
	
	ret = astr + newValue; //앞에서 채우기
	return ret;
}

/*
 *	오른쪽에 ch문자로 채우기
 */
function rpad(newValue, len, ch){
	//////////////////////////////////////////

	var strlen = newValue.trim().length;
	var ret = "";
	var alen = len - strlen;
	var astr = ""; 
	
	//부족한 숫자만큼  len 크기로 ch 문자로 채우기
	for (i=0; i<alen; ++i) {
		astr = astr + ch;
	}
	
	ret = newValue.trim() + astr; //뒤에서 채우기
	return ret;
}

// 예약정보 보기(이동)
function goViewRes(_res_no, res_gbn) {

	var link_url = "";
	
	switch(res_gbn) {
		case "A": // 항공권
			link_url = "/intra/air/air_edit.asp?air_idx=" + _res_no;
			break;
		case "R": // 패키지
			link_url = "/intra/prod/prod_res_edit.asp?prod_res_no=" + _res_no;
			break;
		case "V": // 여권/비자
			link_url = "/intra/visa/visa.asp?mode=req_view&res_no=" + _res_no;
			break;
		default:
			alert("예약번호를 구분할 수 없습니다.");
	}
	
	if(res_gbn != "") {	// 페이지 이동
		location.href = link_url;
	}
}


	//고객조회
	function popCstList(_obj) {
		if(_obj.value.length < 1) return;
		var url = '/_master/sys/popCstList.asp';
		var value = _obj.value;
		var pars = "?name=" + (_obj.value);
		eventObj = _obj;
		div = document.getElementById("divEmpList");
		ifrList.location.href = url + pars;
	}

	//고객조회
	function popCstList33(_obj) {
		if(_obj.value.length < 1) return;
		var url = '/_master/sys/popCstList33.asp';
		var value = _obj.value;
		var pars = "?name=" + (_obj.value);
		eventObj = _obj;
		div = document.getElementById("divEmpList");
		ifrList.location.href = url + pars;
	}

	//달력 다른 날짜 조회
	function popAnotherList(_val) {
		
		var url = '/shin_admin/com/popCalendar.asp';
		var value = _val;
		var pars = "?sale_prod_code=" + (_obj.value);		
		div = document.getElementById("divCstList");
		showList();
		ifrAnotherList.location.href = url + pars;
	}


	function showList() {	
		var end = eventObj.offsetWidth;
		var left = calculateOffset(eventObj, "offsetLeft");
		var top = calculateOffset(eventObj, "offsetTop") + eventObj.offsetHeight;

		div.style.left = left + "px";
		
		var evtY ;
		try{
			evtY = event.y;
		}catch(e){
			
		}

		if(evtY){
			if(evtY < 300){
				div.style.top = evtY;
			}else{
				div.style.top = evtY-150;
			}

		}else{
			div.style.top = top + "px";
		}
		
		div.style.visibility = "visible";

		if(left + div.scrollWidth > document.body.clientWidth) {
			div.style.left = (document.body.clientWidth - div.scrollWidth) + "px" ;
		}	
		eventObj.select();
	}
			
	
	function calculateOffset(field, attr) {
		var offset = 0;
		while(field) {
			offset += field[attr]; 
			field = field.offsetParent;
		}
		return offset;
	}


	function BtnDisabled(id, flag){
		
		var obj = eval("document.all."+id);
		var objSpan = eval("document.all.bs_"+id);

		try{
			var imgNm = id;
			var imgPath = "/_master/img/main/";

			if(flag == true){
				imgNm = id+"_";
			}

			objSpan.style.backgroundImage="url"+"('"+imgPath+imgNm+".gif"+"')";

			obj.disabled = flag;
		}catch(e){}

	}


	function tbAddRow(tId, rowCnt, colCnt) {

		var obj = document.all(tId)

		for(i=1;i<=rowCnt;i++){
			oRow = obj.insertRow();
			oRow.id="trList";	
			for(j=1;j<=colCnt;j++){
				oCell1 = oRow.insertCell();
				oCell1.className = "trBase";
				oCell1.innerHTML = "&nbsp";
			}


		}

	}
	function tbDelRow(tId) {

		var str = document.all(tId)

		for( var i = str.rows.length-1; i >= 1; i-- ) {
		   str.deleteRow(i);

		}
			
	}


//이미지버튼
function ImgButton(btnNm, bWidth, bHeight, brnEvent, flag)
{	 
	if(flag == "") flag = false;
 
	str = "<span id="+btnNm+" style=\"overflow:hidden;width:"+bWidth+";height:"+bHeight+";background-image:url('/_master/img/main/"+btnNm+".gif');\">"
	str += "<input type=button name="+btnNm+" style=\"cursor:hand;width:"+bWidth+";height:"+bHeight+";filter:alpha(opacity=0);\" "+brnEvent+" onfocus=\"blur();\">"
	str += "</span>"

	document.write (str);

	BtnDisabled(btnNm, flag);
}


//Select 리셋
function clearSelect(obj)
{
	if(obj){
		sel_len = obj.length
		
		for(i = 0 ; i < sel_len; i++)
		{			
			obj.options[0] = null;
		}
	}
	return ;
	
}

//Select 리셋
function clearSelectRvs(obj)
{

	if(obj){
		sel_len = obj.length
		
		for(i = sel_len ; i > 0; i--)
		{			
			obj.options[i] = null;
		}
	}
	return ;
	
}


function chkChangeFlag(obj){

	var chkObj = document.getElementsByName(obj);  

	if(chkObj[0].checked){
		flag = true
	}else{
		flag = false	
	}

	for(i=1;i<chkObj.length;i++){
		chkObj[i].checked = flag
	}
}

function chkChangeFla2g(_obj, obj){

	var chkObj = document.getElementsByName(obj);  

	if(_obj.checked){
		flag = true
	}else{
		flag = false	
	}

	for(i=0;i<chkObj.length;i++){
		chkObj[i].checked = flag
	}
}

//submit
function winPopSubmit(formNm,targetNm,pWidth,pHeight,pLeft,pTop,pScl){

	if(!(pLeft)){ pLeft='125'; }
	if(!(pTop)){ pTop='187'; }
	if(!(pScl)){ pScl='1'; }

	var winNm = replaceAll(targetNm,"/","");
				
		tform = eval("document."+formNm);
		window.open("",winNm,"toolbar=no, location=no, width="+pWidth+", height="+pHeight+", top="+pTop+", left="+pLeft+", scrollbars="+pScl);		
		tform.target = winNm;            
		tform.action = targetNm+".asp";
		tform.method = "post";
		tform.submit(); 
}

function popSubmit(_frmNm, _popNm, _width, _height,_left,_top, _scroll){
	
	var winNm = replaceAll(_popNm,".","");
	var optStr = "width=" + _width + ", height=" + _height + ", top=" + _top + ", left=" + _left + ",scrollbars=" + _scroll;
	window.open("",winNm,optStr);
	tFrm = eval("document."+_frmNm);
	tFrm.target = winNm;	
	tFrm.action = _popNm;
	tFrm.submit();
}

function strSubStringLast(str,sLen){
	
	return str.substring(0,str.length-Number(sLen))

}


//숫자 세자리단위로 콤마
function replaceAddComma(objId){
	var obj = document.getElementById(objId);
	var tmpStr;

	tmpStr = obj.value;

	commaSplit(tmpStr,obj,objId);
}
function commaSplit(srcNumber,obj,objId) {//숫자 세자리단위로 콤마 & 숫자체크
	var txtNumber = '' + srcNumber;

		txtNumber = replaceAll(txtNumber,",","");
		
	if (isNaN(txtNumber)) {
		alert("숫자만 입력하세요.");
		var ch = document.getElementById(objId);
		obj.value = '';
		ch.value = '';
		obj.select();
		obj.focus();
	
	}else{

		var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');

		var arrNumber = txtNumber.split('.');
		arrNumber[0] += '.';
		
		do {
			arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
		} while (rxSplit.test(arrNumber[0]));
		
		if (arrNumber.length > 1) {
			
			obj.value =  arrNumber.join('');
		
		}else{
		
			obj.value =  arrNumber[0].split('.')[0];
		}
   }
}
//숫자 세자리단위로 콤마


//입력받은 글자수 체크
function fc_chk_byte(aro_name,ari_max){
		 var ls_str     = aro_name.value; // 이벤트가 일어난 컨트롤의 value 값
		 var li_str_len = ls_str.length;  // 전체길이
	
		 // 변수초기화
		 var li_max      = ari_max; // 제한할 글자수 크기
		 var i           = 0;  // for문에 사용
		 var li_byte     = 0;  // 한글일경우는 2 그밗에는 1을 더함
		 var li_len      = 0;  // substring하기 위해서 사용
		 var ls_one_char = ""; // 한글자씩 검사한다
		 var ls_str2     = ""; // 글자수를 초과하면 제한할수 글자전까지만 보여준다.
	
		 for(i=0; i< li_str_len; i++) {
				ls_one_char = ls_str.charAt(i);
				// 한글이면 2를 더한다.
				if (escape(ls_one_char).length > 4){
					 li_byte += 2;
				}else{
					 li_byte++;
				}
				// 전체 크기가 li_max를 넘지않으면
				if(li_byte <= li_max){
					 li_len = i + 1;
				}
		 }
		 
		 // 전체길이를 초과하면
		 if(li_byte > li_max){
				alert( li_max + " 글자를 초과 입력할수 없습니다. \n 초과된 내용은 자동으로 삭제 됩니다. ");
				ls_str2 = ls_str.substr(0, li_len);
				aro_name.value = ls_str2;
		 }
		 aro_name.focus();   
	}



//권한체크 
// lev : 페이지에 대한 개인등급 vLev: 페이지의 기준등급
function chkAuth(lev, vLev){
	
	var ret = true;

	//권한체크
	if(Number(lev) < vLev){
		//alert("변경권한이 없습니다.");
		//ret = false;
	}

	return ret;
}


//팁조회
function tipStr(_obj,_gbn,_name) {
	
	var url = '/intra/com/popTip.asp';
	var pars = "?gbn=" + _gbn + "&name=" + _name;

	eventObj = _obj;
	div = document.getElementById("divTip");

	showList();
	ifrTip.location.href = url + pars;
}




/* ----------------------------------------------------------------------------
 * 특정 날짜에 대해 지정한 값만큼 가감(+-)한 날짜를 반환

 * 

 * 입력 파라미터 -----
 * pInterval : "yyyy" 는 연도 가감, "m" 은 월 가감, "d" 는 일 가감
 * pAddVal  : 가감 하고자 하는 값 (정수형)
 * pYyyymmdd : 가감의 기준이 되는 날짜
 * pDelimiter : pYyyymmdd 값에 사용된 구분자를 설정 (없으면 "" 입력)

 * 

 * 반환값 ----

 * yyyymmdd 또는 함수 입력시 지정된 구분자를 가지는 yyyy?mm?dd 값
 *

 * 사용예 ---

 * 2008-01-01 에 3 일 더하기 ==> addDate("d", 3, "2008-08-01", "-");

 * 20080301 에 8 개월 더하기 ==> addDate("m", 8, "20080301", "");
 --------------------------------------------------------------------------- */
function addDate(pInterval, pAddVal, pYyyymmdd, pDelimiter)
{
 var yyyy;
 var mm;
 var dd;
 var cDate;
 var oDate;
 var cYear, cMonth, cDay;
 
 if (pDelimiter != "") {
  pYyyymmdd = pYyyymmdd.replace(eval("/\\" + pDelimiter + "/g"), "");
 }

 yyyy = pYyyymmdd.substr(0, 4);
 mm  = pYyyymmdd.substr(4, 2);
 dd  = pYyyymmdd.substr(6, 2);
 
 if (pInterval == "yyyy") {
  yyyy = (yyyy * 1) + (pAddVal * 1); 
 } else if (pInterval == "m") {
  mm  = (mm * 1) + (pAddVal * 1);
 } else if (pInterval == "d") {
  dd  = (dd * 1) + (pAddVal * 1);
 }
 
 cDate = new Date(yyyy, mm - 1, dd) // 12월, 31일을 초과하는 입력값에 대해 자동으로 계산된 날짜가 만들어짐.

 cYear = cDate.getFullYear();
 cMonth = cDate.getMonth() + 1;
 cDay = cDate.getDate();
 
 cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
 cDay = cDay < 10 ? "0" + cDay : cDay;

 if (pDelimiter != "") {
	
  return cYear + pDelimiter + cMonth + pDelimiter + cDay;
 } else {
  return cYear + cMonth + cDay;
 }
 
}

//asp에 left 함수와 right함수와같은 기능

function left(str,n){
	if(n <= 0){
		return "";
	}else if(n > String(str).length){
		return str;
	}else{
		return; String(str).substring(0,n);
	}			
}

function right(str,n){
	if(n <= 0){
		return "";
	}else if(n > String(str).length){
		return str;
	}else{
		var iLen = String(str).length;
		return String(str).substring(iLen,iLen - n);
	}	
}

//요일 구하기 20100508
function getSatSun(_from, _to, _yoil) {
	var sDate=formatDate(_from);
	var eDate=formatDate(_to);
	var yoil=_yoil;
	return countDay(sDate,eDate,yoil);
}
	
function formatDate(d) {
	return new Date(d.substr(0,4),Number(d.substr(4,2))-1,Number(d.substr(6)));
}

function countDay(d1,d2,yoil) {
	
	var tmpDay = null;
	var count=0;
	var tmp;
	for (var i=0; i<=(d2-d1)/1000/60/60/24; i++) {
		tmp=new Date(d1);
		tmp.setDate(tmp.getDate()+i);

			
		if(yoil.indexOf("0") != -1 ){
			if (tmp.getDay()==0) {
				cYear = String(tmp.getFullYear());
				cMonth = String(tmp.getMonth() + 1);
				cDay = String(tmp.getDate());
				
				cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
				cDay = cDay < 10 ? "0" + cDay : cDay;
				
				if(tmpDay == null){
					tmpDay = cYear + cMonth + cDay;
				}else{
					tmpDay = tmpDay + "," + cYear + cMonth + cDay;					
				}
								
				count++;
			}
		}
		
		if(yoil.indexOf("1") != -1){
			if (tmp.getDay()==1) {
				cYear = String(tmp.getFullYear());
				cMonth = String(tmp.getMonth() + 1);
				cDay = String(tmp.getDate());

				cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
				cDay = cDay < 10 ? "0" + cDay : cDay;
				
				if(tmpDay == null){
					tmpDay = cYear + cMonth + cDay;
				}else{
					tmpDay = tmpDay + "," + cYear + cMonth + cDay;					
				}
				
				count++;
			}
		}
		if(yoil.indexOf("2") != -1){
			if (tmp.getDay()==2) {
				cYear = String(tmp.getFullYear());
				cMonth = String(tmp.getMonth() + 1);
				cDay = String(tmp.getDate());
				
				cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
				cDay = cDay < 10 ? "0" + cDay : cDay;
				
				if(tmpDay == null){
					tmpDay = cYear + cMonth + cDay;
				}else{
					tmpDay = tmpDay + "," + cYear + cMonth + cDay;					
				}
				
				count++;
			}
		}
		if(yoil.indexOf("3") != -1){
			if (tmp.getDay()==3) {
				cYear = String(tmp.getFullYear());
				cMonth = String(tmp.getMonth() + 1);
				cDay = String(tmp.getDate());
				
				cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
				cDay = cDay < 10 ? "0" + cDay : cDay;
				
				if(tmpDay == null){
					tmpDay = cYear + cMonth + cDay;
				}else{
					tmpDay = tmpDay + "," + cYear + cMonth + cDay;					
				}
				
				count++;
			}
		}
		if(yoil.indexOf("4") != -1){
			if (tmp.getDay()==4) {
				cYear = String(tmp.getFullYear());
				cMonth = String(tmp.getMonth() + 1);
				cDay = String(tmp.getDate());

				cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
				cDay = cDay < 10 ? "0" + cDay : cDay;
				
				if(tmpDay == null){
					tmpDay = cYear + cMonth + cDay;
				}else{
					tmpDay = tmpDay + "," + cYear + cMonth + cDay;					
				}
				
				count++;
			}
		}
		if(yoil.indexOf("5") != -1){
			if (tmp.getDay()==5) {
				cYear = String(tmp.getFullYear());
				cMonth = String(tmp.getMonth() + 1);
				cDay = String(tmp.getDate());
				
				cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
				cDay = cDay < 10 ? "0" + cDay : cDay;
				
				if(tmpDay == null){
					tmpDay = cYear + cMonth + cDay;
				}else{
					tmpDay = tmpDay + "," + cYear + cMonth + cDay;					
				}
				
				count++;
			}
		}
		if(yoil.indexOf("6") != -1){
			if (tmp.getDay()==6) {
				cYear = String(tmp.getFullYear());
				cMonth = String(tmp.getMonth() + 1);
				cDay = String(tmp.getDate());
				
				cMonth = cMonth < 10 ? "0" + cMonth : cMonth;
				cDay = cDay < 10 ? "0" + cDay : cDay;
				
				if(tmpDay == null){
					tmpDay = cYear + cMonth + cDay;
				}else{
					tmpDay = tmpDay + "," + cYear + cMonth + cDay;					
				}
				
				count++;
			}
		}
		
	} 
	return tmpDay;
}

// 2007-01-01 문자열을날짜객체로변환
function getDateObjectFromDashStr(dateStr){

	var dateinfo = dateStr.split("-");

	return new Date(dateinfo[0] , dateinfo[1] -1 , dateinfo[2]);

}

//Date 객체를 2007-01-01 형식문자열로변환

function getDateStrFromDateObject(dateObject){

	var str = null;



	var month = dateObject.getMonth();

	var day = dateObject.getDate();



	if(month <  10)

		month = '0' + month;

	if(day < 10)

		day = '0' + day;

	str = dateObject.getYear() + '-' + month + '-' + day;

	return str;

}


function consoGbn(_val){
	
	var val = "";
	if(_val == "1"){
		val = "all";
	}else if(_val == "2"){
		val = "ㄱ";		
	}else if(_val == "3"){
		val = "ㄴ";				
	}else if(_val == "4"){
		val = "ㄷ";				
	}else if(_val == "5"){
		val = "ㄹ";				
	}else if(_val == "6"){
		val = "ㅁ";				
	}else if(_val == "7"){
		val = "ㅂ";				
	}else if(_val == "8"){
		val = "ㅅ";				
	}else if(_val == "9"){
		val = "ㅇ";				
	}else if(_val == "10"){
		val = "ㅈ";				
	}else if(_val == "11"){
		val = "ㅊ";				
	}else if(_val == "12"){
		val = "ㅋ";				
	}else if(_val == "13"){
		val = "ㅌ";				
	}else if(_val == "14"){
		val = "ㅍ";				
	}else if(_val == "15"){
		val = "ㅎ";				
	}else if(_val == "16"){
		val = "A";				
	}else if(_val == "17"){
		val = "1";				
	}
	return val;
}

function consoGbn2(_val){
	
	var val = "";

	if(_val == "ㄱ"){
		val = "ㄴ";				
	}else if(_val == "ㄴ"){
		val = "ㄷ";				
	}else if(_val == "ㄷ"){
		val = "ㄹ";				
	}else if(_val == "ㄹ"){
		val = "ㅁ";				
	}else if(_val == "ㅁ"){
		val = "ㅂ";				
	}else if(_val == "ㅂ"){
		val = "ㅅ";				
	}else if(_val == "ㅅ"){
		val = "ㅇ";				
	}else if(_val == "ㅇ"){
		val = "ㅈ";				
	}else if(_val == "ㅈ"){
		val = "ㅊ";				
	}else if(_val == "ㅊ"){
		val = "ㅋ";				
	}else if(_val == "ㅋ"){
		val = "ㅌ";				
	}else if(_val == "ㅌ"){
		val = "ㅍ";				
	}else if(_val == "ㅍ"){
		val = "ㅎ";				
	}
	return val;
}


// 소수점(float) 형 반올림
function roundXL(n, digits) {
  if (digits >= 0) return parseFloat(n.toFixed(digits)); // 소수부 반올림

  digits = Math.pow(10, digits); // 정수부 반올림
  var t = Math.round(n * digits) / digits;

  return parseFloat(t.toFixed(0));
}

// div none or block
function DivShow(_id){
	var div = document.getElementById(_id);
	if(div.style.display == "block"){
		document.getElementById(_id).style.display = "none";
	}else{
		document.getElementById(_id).style.display = "block";
	}
}




//셀렉트 박스selected
function selectForm(form_name){
	var f=eval("document."+form_name);
    var nLen;   // form 요소의 갯수
    var ival;   // 각 요소의 default value 값 즉! 초기화하고자 하는값
    var fTyp;   // form 요소의 타입(select, radio, checkbox...)
	var fLen = f.elements.length;
	
    for (var i = 0; i < fLen; i++) {
		fObj = f.elements[i];
        fTyp = toUpperCase(f.elements[i].type);
		ival = fObj.getAttribute("ival");
        if (ival && fTyp == "SELECT-ONE") {
            nLen = f.elements[i].options.length;
            for (var j = 0; j < nLen; j++) {
                if (f.elements[i].options[j].value == ival)
                    f.elements[i].options[j].selected = true;
            }
        }
        if (fTyp == "SELECT-MULTIPLE") {
            nLen = f.elements[i].options.length;
            for (var j = 0; j < nLen; j++) {
                if (f.elements[i].options[j].value == f.elements[i].options[j].ival)
                    f.elements[i].options[j].selected = true;
            }
        }
		
        if (ival && (fTyp == "RADIO" || fTyp == "CHECKBOX")) {
            if (f.elements[i].value == ival)
                f.elements[i].checked = true;
        }
    }
    return true;
}

// 대문자 변환 ex) toUpperCase(문자)
function toUpperCase(str) {
    var ret;
    str != null ? ret = str.toUpperCase() : ret = "";
    return ret;
}


//대문자변화
function upper_eng(_val){
	var obj = document.getElementById(_val);
	obj.value = obj.value.toUpperCase();
	
}


//요일 (0,1,2,3...) 을 받아서 일,월,화... 로 반환
function ReturnWeekSting(str){
	var weekStr = "";
	if(str.length > 0){
			var arr = str.split(",")
			for(i=0; i < arr.length; i++){
				switch(arr[i].trim()){
					case "0" : 
							if(weekStr == ""){
								weekStr = "일";
							}else{
								weekStr = weekStr + ", 일";
							}
						break;
					case "1" : 
							if(weekStr == ""){
								weekStr = "월";
							}else{
								weekStr = weekStr + ", 월";
							}
						break;
					case "2" : 
							if(weekStr == ""){
								weekStr = "화";
							}else{
								weekStr = weekStr + ", 화";
							}
						break;
					case "3" : 
							if(weekStr == ""){
								weekStr = "수";
							}else{
								weekStr = weekStr + ", 수";
							}
						break;
					case "4" : 
							if(weekStr == ""){
								weekStr = "목";
							}else{
								weekStr = weekStr + ", 목";
							}
						break;
					case "5" : 
							if(weekStr == ""){
								weekStr = "금";
							}else{
								weekStr = weekStr + ", 금";
							}
						break;
					case "6" : 
							if(weekStr == ""){
								weekStr = "토";
							}else{
								weekStr = weekStr + ", 토";
							}
						break;

				}
			} //for
		
	}//end if
	document.write(weekStr);
}

// ***************************************************************************************
// * 함수설명 : 레이어로 팝업창 뛰우기                                        *
//* 변수설명 : s=url,w=width,h=height
// ***************************************************************************************
//Ajax 로드시 레이어 띄우기
function popupLayer99(s,w,h)
{
	if (!w) w = 207; //값이 없으면 강제 셋팅
	if (!h) h = 204;

	var pixelBorder = 0;//픽셀 보더값
	var titleHeight = 0;//타이틀의 높이값
	w += pixelBorder * 2;//창넓이에 픽셀보더값*2 를 더한값
	h += pixelBorder * 2 + titleHeight;//높이값 재설정

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//

	var posX = (bodyW - w) / 2;
	var posY = (bodyH - h) / 2;

//	hiddenSelectBox('hidden');

	/*** 백그라운드 레이어 ***/
	var obj = document.createElement("div");//div를 생성
	with (obj.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;//높이는 스크롤의 높이
		backgroundColor = "#000000";
		filter = "Alpha(Opacity=30)";
		opacity = "0.3";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);// ------------------------------------

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = posX + document.body.scrollLeft;
		top = posY + document.body.scrollTop;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.frameBorder = 0;
	ifrm.src = s;
	obj.appendChild(ifrm);
}

// ***************************************************************************************
// * 함수설명 : 레이어로 팝업창 뛰우기                                        *
//* 변수설명 : s=url,w=width,h=height
// ***************************************************************************************

function popupLayer(s,w,h)
{
	if (!w) w = 406; //값이 없으면 강제 셋팅
	if (!h) h = 356;

	var pixelBorder = 0;//픽셀 보더값
	var titleHeight = 0;//타이틀의 높이값
	w += pixelBorder * 2;//창넓이에 픽셀보더값*2 를 더한값
	h += pixelBorder * 2 + titleHeight;//높이값 재설정

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//

	var posX = (bodyW - w) / 2;
	var posY = (bodyH - h) / 2;

//	hiddenSelectBox('hidden');

	/*** 백그라운드 레이어 ***/
	var obj = document.createElement("div");//div를 생성
	with (obj.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;//높이는 스크롤의 높이
		backgroundColor = "#000000";
		filter = "Alpha(Opacity=30)";
		opacity = "0.3";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);// ------------------------------------

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = posX + document.body.scrollLeft;
		top = posY + document.body.scrollTop;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);

	/*** 타이틀바 레이어 **
	var bottom = document.createElement("div");
	with (bottom.style){
		position = "absolute";
		width = w - pixelBorder * 2;
		height = titleHeight;
		left = 0;
		top = h - titleHeight - pixelBorder * 3;
		padding = "0 0 0 0";
		textAlign = "right";
		backgroundColor = "#000000";
		color = "#ffffff";
		font = "bold 11px tahoma";
	}
	//bottom.innerHTML = "<a href='javascript:closeLayer()' class=white>close</a>&nbsp;&nbsp;&nbsp;";
	//obj.appendChild(bottom);
*/
	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
		//border = "3 solid #000000";
	}
	ifrm.frameBorder = 0;
	ifrm.src = s;
	obj.appendChild(ifrm);
}
function closeLayer()
{
	_ID('objPopupLayer').parentNode.removeChild( _ID('objPopupLayer') );
	_ID('objPopupLayerBg').parentNode.removeChild( _ID('objPopupLayerBg') );
}

function closeLayer2(_obj){
	_ID(_obj).parentNode.removeChild( _ID(_obj) );
}

function _ID(obj){return document.getElementById(obj)}



/* 리조트예약 레이어 */
function popupLayerResort(url)
{
	if(_ID('objPopupLayerResrot')){
		_ID('objPopupLayerResrot').parentNode.removeChild( _ID('objPopupLayerResrot') );
	}
	
	w = 388; 
	h = 276;

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);
	
	
	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "objPopupLayerResrot";
	//obj.onMouseUp = DivPopMouseUp("objPopupLayerResrot");
	//obj.onMouseMove = DivPopMouseMove("objPopupLayerResrot");
	//obj.onMouseDown = DivPopMouseDown('');
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}


/* 할인항공예약 레이어 */
function popupLayerRentCar(url)
{
	if(_ID('popupLayerRentCar')){
		_ID('popupLayerRentCar').parentNode.removeChild( _ID('popupLayerRentCar') );
	}
	
	w = 270; 
	h = 150;

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "popupLayerRentCar";
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.id = "popupLayerRentCar";
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}


/* 할인항공예약 레이어 */
function popupLayerAir(url)
{
	if(_ID('popupLayerAir')){
		_ID('popupLayerAir').parentNode.removeChild( _ID('popupLayerAir') );
	}
	
	w = 270; 
	h = 150;

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "popupLayerAir";
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.id = "popupLayerAir";
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}


/* 할인항공예약 레이어 */
function popupLayerRent(url)
{
	if(_ID('objPopupLayerRent')){
		_ID('objPopupLayerRent').parentNode.removeChild( _ID('objPopupLayerRent') );
	}
	
	w = 480; 
	h = 400;

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "objPopupLayerRent";
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.id = "objPopupFrameRent";
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}

/* 할인항공예약 레이어 */
function popupLayerAccom(url)
{
	if(_ID('popupLayerAccom')){
		_ID('popupLayerAccom').parentNode.removeChild( _ID('popupLayerAccom') );
	}
	
	w = 200; 
	h = 140;

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "popupLayerAccom";
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.id = "popupLayerAccom";
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}

/* 스파예약 레이어 */
function popupLayerSpa2(url)
{
	if(_ID('objPopupLayerSpa')){
		_ID('objPopupLayerSpa').parentNode.removeChild( _ID('objPopupLayerSpa') );
	}
	
//	w = 360; 
//	h = 208;

	w = 415; 
	h = 300;


	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);
	
	
	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "objPopupLayerSpa";
	//obj.onMouseUp = DivPopMouseUp("objPopupLayerResrot");
	//obj.onMouseMove = DivPopMouseMove("objPopupLayerResrot");
	//obj.onMouseDown = DivPopMouseDown('');
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}


/* 할인항공예약 레이어 */
function popupLayerSpa(url)
{
	if(_ID('popupLayerSpa')){
		_ID('popupLayerSpa').parentNode.removeChild( _ID('popupLayerSpa') );
	}
	
	w = 225; 
	h = 140;

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "popupLayerSpa";
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.id = "popupLayerSpa";
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}

function popupLayerSpa3(url)
{
	if(_ID('objPopupLayerSpa')){
		_ID('objPopupLayerSpa').parentNode.removeChild( _ID('objPopupLayerSpa') );
	}
	
//	w = 360; 
//	h = 208;

	w = 418; 
	h = 300;


	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);
	
	
	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
		overflow = "hidden";
	}
	obj.id = "objPopupLayerSpa";
	//obj.onMouseUp = DivPopMouseUp("objPopupLayerResrot");
	//obj.onMouseMove = DivPopMouseMove("objPopupLayerResrot");
	//obj.onMouseDown = DivPopMouseDown('');
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}



/* 할인항공예약 레이어 */
function popupLayerIb(url)
{
	if(_ID('popupLayerIb')){
		_ID('popupLayerIb').parentNode.removeChild( _ID('popupLayerIb') );
	}
	
	w = 265; 
	h = 140;

	var bodyW = document.body.clientWidth;//
	var bodyH = document.body.clientHeight;//
	
	var _top = document.body.clientTop + event.y + document.body.scrollTop;
	var _left = document.body.clientLeft + event.x -  document.body.scrollLeft - w;

	if( (bodyW+document.body.scrollLeft) < (_left+w) ){//화면밖으로 넘어가는경우 처리
		gab = (_left+w) - (bodyW+document.body.scrollLeft);
		_left = _left - gab;
	}
	//alert(document.body.scrollTop);
	//alert(_top);
	//alert(bodyH);
	//alert(_top+h);
	if( bodyH < (_top+h) ){//화면밖으로 넘어가는경우 처리
		gab = (_top+h) - bodyH;
		//_top = _top - (gab);
		//alert(gab);
	}
	//alert(_top);

	/*** 내용프레임 레이어 ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = _left;
		top = _top;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = 0;//"1px solid #000000";
	}
	obj.id = "popupLayerIb";
	document.body.appendChild(obj);

	/*** 아이프레임 ***///페이지가 들어가 프레임 생성
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w;
		height = h;
	}
	ifrm.id = "popupLayerIb";
	ifrm.frameBorder = 0;
	ifrm.src = url;
	obj.appendChild(ifrm);
}

//시간 반환 2010-03-22, 09:00:00, 2010-03-23, 09:00:00
function get_hours(s_date, s_time, e_date, e_time){
	var s_date = s_date.split('-');
	var s_time = s_time.split(':');
	var e_date = e_date.split('-');
	var e_time = e_time.split(':');
	var sdate = new Date(eval(s_date[0]), eval(s_date[1])-1, eval(s_date[2]), s_time[0], s_time[1], s_time[2]);
	var edate = new Date(eval(e_date[0]), eval(e_date[1])-1, eval(e_date[2]), e_time[0], e_time[1], e_time[2]);
	var term = edate.getTime() - sdate.getTime();
	if (term > 0) return Math.ceil(term / (1000 * 60 * 60));
	else return 0;
}

//라디오 버튼 옆에 설명 텍스트를 눌렀을때 체크 되게 하는 함수
function chkRadio2(_obj,_value){
	
	var obj = document.getElementsByName(_obj);

	for(i = 0; i < obj.length; i++){
		if(obj[i].value == _value){
			obj[i].checked = true;
		}
	}
}

//라디오 버튼 옆에 설명 텍스트를 눌렀을때 체크 되게 하는 함수
function chkDisRadio(_obj){
	
	var obj = document.getElementsByName(_obj);

	for(i = 0; i < obj.length; i++){		
		
		obj[i].checked = false;		
	}
}


/*
*	선택된 라디오 버튼 값 가져오기
*/
function getRaioValue(_objName){
	var obj = document.getElementsByName(_objName)
	var cnt = obj.length;
	var val = '';

	for(nn = 0; nn < cnt; nn++){
		if(obj[nn].checked){
			val = obj[nn].value;

		}
	}

	return val;
}

function popLocWindow(url){
	var win = popWin(url, "editWin", 350, 290, 0);
}


//자리수가 되었으면 다음폼으로 포커스 이동
function nextFocusChange(_obj, _cnt, _Nobj){
	var _value = _obj.value;
	if(_value.length >= Number(_cnt)){ _Nobj.focus(); }
}

//자리수가 되었으면 다음폼으로 포커스 이동 폼네임 다중 -
function nextFocusChangeNames(_obj, _cnt, _Nobj, _idx){
	var _value = _obj.value;
	var obj = document.getElementsByName(_Nobj);
	//alert(_idx);
	if(_value.length >= Number(_cnt)){ obj[_idx].focus(); }
}

//보이기
function showLayer(layerID){
	document.getElementById(layerID).style.display = "block"
}

//숨기기
function hideLayer(layerID){
	document.getElementById(layerID).style.display = "none"
}

//숫자를 한글로 표기
function intconverchar(_str) {
    if (this == 0) return '영';
    var phonemic = ['','일','이','삼','사','오','육','칠','팔','구'];
    var unit = ['','','십','백','천','만','십만','백만','천만','억','십억','백억','천억','조','십조','백조'];

    var ret = '';
    var part = new Array();
    for (var x=0; x<String(_str).length; x++) part[x] = String(_str).substring(x,x+1);
    for (var i=0, cnt = String(_str).length; cnt > 0; --cnt,++i) {
        p = phonemic[part[i]];
        p+= (p) ? (cnt>4 && phonemic[part[i+1]]) ? unit[cnt].substring(0,1) : unit[cnt] : '';
        ret+= p;
    }
    return ret;
}


 	// 로그아웃
function comp_logout() {
		location.href="/manager/login/logout.asp";	
}


//submit
function winPopSubmit33(formNm,targetNm,pWidth,pHeight,pLeft,pTop,pScl){

	if(!(pLeft)){ pLeft='125'; }
	if(!(pTop)){ pTop='187'; }
	if(!(pScl)){ pScl='1'; }

	var winNm = replaceAll(targetNm,"/","");
				
		tform = eval("document."+formNm);
		window.open("",winNm,"toolbar=no, location=no, width="+pWidth+", height="+pHeight+", top="+pTop+", left="+pLeft+", scrollbars="+pScl);		
		tform.target = winNm;            
		tform.action = targetNm+".asp";
		tform.method = "post";
		tform.submit(); 
}

//OnKeyUp 이벤트시 콤마 처리 & 숫자 체크
function setCommaKeyUp(obj){
	var chkNum = "" + obj.value;
	chkNum = replaceAll(chkNum,",","");

	if(isNaN(chkNum)){
		alert("숫자만 입력하세요.");
		obj.value = "";
		obj.select();
		obj.focus();
	}else{
		var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
		var arrNumber = chkNum.split('.');
		arrNumber[0] += '.';

		do {
			arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
		} while (rxSplit.test(arrNumber[0]));

		if (arrNumber.length > 1) {			
			obj.value =  arrNumber.join('');		
		}else{		
			obj.value =  arrNumber[0].split('.')[0];
		}
	}
}

//중복이름 체크박스 선택한거만 체크/해제
function chkCheckBoxs(_name,_value){
	var objs = document.getElementsByName(_name);

	for(i=0; i<objs.length; i++){
		if(objs[i].value == _value){
			if(objs[i].checked){
				objs[i].checked = false;
			}else{
				objs[i].checked = true;
			}
		}
	}
}

function showPhotoDiv(_gbn,_code){
	var obj = document.getElementById("div_photo");
	if(obj){
		if(obj.style.display == "none"){
			document.getElementById("ifr_photo").src="/inc/photo.asp?gbn="+_gbn+"&code=" + _code;
			obj.style.display = "block";
		}else{
			document.getElementById("ifr_photo").src="";
			obj.style.display = "none";
		}
	}
}

function downFile2(_url, _file){
	location.href = "/inc/download.asp?url=" + _url + "&file=" + _file;
}
