function dvf_textDateCheck(p_date) {
		var dateValue = p_date.value;
		var dateLength = dateValue.length;

		if (dateValue == false && dateValue != "0")
			return true;

		if ( !dvf_checkDateChar(dateValue) ) {
			alert("날짜 형식에 맞지 않습니다.");
			p_date.value = "";
			p_date.focus();
			return false;
		}

		if( dateLength == 8 )
		{
			if( dvf_dateCheck(dateValue) )
			{
				dateValue = dateValue.substring(0,4)+"-"+dateValue.substring(4,6)+"-"+dateValue.substring(6,8);
				p_date.value = dateValue;
				return true;
			}
			else
			{
				alert("날짜 형식에 맞지 않습니다.");
				p_date.value = "";
				p_date.focus();
				return false;
			}
		}
		else if( dateLength == 10 )
		{
			if( dvf_dateCheck10(dateValue) )
			{
				return true;
			}
			else
			{
				alert("날짜 형식에 맞지 않습니다.");
				p_date.value = "";
				p_date.focus();
				return false;
			}
		}
		else
		{
			alert("날짜 형식에 맞지 않습니다.");
			p_date.value = "";
			p_date.focus();
			return false;
		}
}

function dvf_checkNumChar(p_checkData) {
		var numReg = /[^0-9]+/g;
		return !numReg.test(p_checkData);
}

/*
 * 숫자가 마스킹 되었는지를 판단한다.
 *
 * 작성자 : 홍재훈
 * 작성일 : 2007. 09. 17
 */
function dvf_isMaskNumber(p_maskNumber) {
	if ( p_maskNumber == null || p_maskNumber.length == 0 ) return false;

	if ( p_maskNumber.indexOf(",") > 0 )
		return true;
	return false;
}

/*
 * 숫자에 들어간 ','를 없애주는 스크립트
 *
 * 작성자 : 홍재훈
 * 작성일 : 2007. 09. 17
 */
function dvf_offMaskNumber(p_maskNumber) {
	if ( p_maskNumber == null || p_maskNumber.length == 0 ) return "";

	var maskReg = /,/g;
	return p_maskNumber.replace(maskReg, "");
}

/*
 * 날자 형식에 들어간 구분 기호를 없애주는 스크립트
 *
 * 작성자 : 홍재훈
 * 작성일 : 2007. 09. 17
 */
function dvf_offMaskDate(p_maskDate) {
	if ( p_maskDate == null || p_maskDate.length == 0 ) return "";

	var maskReg = /[0-9]+/g;
	var arrResult = p_maskDate.match(maskReg);
	var result = "";
	for (var idx = 0; idx < arrResult.length; idx++)
	{
		result += arrResult[idx];
	}

	return result;
}

/*
 * 숫자에 세자리 마다 ','를 찍어주는 스크립트
 *
 * 작성자 : 홍재훈
 * 작성일 : 2007. 09. 17
 */
function dvf_maskNumber(p_srcNumber) {
	if ( typeof(p_srcNumber) == "undefined" || p_srcNumber == "" ) {
		return "0";
	}

	var val = String(p_srcNumber);
	val = dvf_offMaskNumber(val);

	if ( val == "" ) return "0";

	if ( !dvf_checkNumberChar(val) ) {
		alert("숫자만 입력하세요.");
		return "0";
	}

	var minus = "";
	var remainder = "";
	var percent = "";

	if ( val.substring(0, 1) == "-" ) {
		minus = val.substring(0, 1);
		val = val.substring(1);
	}

	while ( val.indexOf("-") != -1 )
		val = val.replace("-", "");

	if ( val.substring(val.length-1, val.length) == "%" ) {
		percent = val.substring(val.length-1, val.length);
		val = val.substring(0, val.length-1);
	}

	while ( val.indexOf("%") != -1 )
		val = val.replace("%", "");

	if ( val.indexOf(".") > 0 ) {
		// 소수점이 있는 경우
		remainder = val.substring(val.indexOf(".")+1);
		val = val.substring(0, val.indexOf("."));

		if ( remainder.indexOf(".") != -1 ) {
			alert("실수 형식이 올바르지 않습니다.");
			return "0";
		}
	}

	var len = val.length;

	if ( len < 4 ) return minus + val + ((remainder != "") ? "." + remainder : "");

	var loop = 1;
	var count = 0;
	var retVal = "";

	while ( loop < len + 1 ) {
		if ( count == 3 ) {
			count = 1;
			retVal = "," + retVal;
		}
		else
			count++;

		retVal = val.substring(len-loop, len-loop+1) + retVal;
		loop++;
	}

	return minus + retVal + ((remainder != "") ? "." + remainder : "") + percent;
}
function dvf_checkNumberChar(check){
    var inputVal = escape(check);
	var isNum = /[^0-9\-.]+/g;
	return !isNum.test(inputVal);
}

/*
 * 이 메소드를 호출한 개체에 ...
 *
 * 사용 plug-in : interface.js
 * Parameter :
 *		- p_dragDiv -
 *		- p_dropDiv -
 *		- p_callback -
 * return : void
 * 작성자 : 김경의
 * 작성일 : 2007. 09. 21
 */
//function dvf_dragNdrop(p_dragDiv, p_dropDiv, p_callback){
	//$("."+p_dragDiv).Draggable(
	//	{
	//		revert: true,
	//		ghosting: true
	//		opacity: 0.9
	//	}
	//);
	//$(p_dropDiv).Droppable(
	//	{
	//		accept :		p_dragDiv,
	//		activeClass: 'silver',
	//		tolerance option:
	//		'pointer' - 마우스 포인터가 droppable 영역에 들어가야 drop
	//		'intersect' - drag한 영역일부가 droppable 영역에 들어가야 drop
	//		'fit' - drag한 영역전체가 droppable 영역에 들어가야 drop
	//		tolerance:		'pointer',
	//		onActivate:	function(dragged)
	//					{
	//						if (!this.shakedFirstTime){
	//							//$(this).Shake(1);
	//							this.shakedFirstTime = true;
	//						}
	//					},
	//		ondrop:	p_callback
	//	}
	//);
	//$("."+p_dragDiv).click(function(){

//		if (!this.shakedFirstTime){     
//			$(this).Shake(1);
//			this.shakedFirstTime = true;
//		}                               
		//움직일녀석 좌표
//		var tx = jQuery.iUtil.getPosition(this).x;
//		var ty = jQuery.iUtil.getPosition(this).y;
		//담길곳 좌표
//		var ttx = jQuery.iUtil.getPosition($(p_dropDiv)[0]).x;
//		var tty = jQuery.iUtil.getPosition($(p_dropDiv)[0]).y;
		//움직일녀석 크기
//		var tW = $(this).width();
//		var tH = $(this).height();
		//담길곳 크기
//		var ttW = $($(p_dropDiv)[0]).width();
//		var ttH = $($(p_dropDiv)[0]).height();
		//도착 위치
//		var ariveX = (ttx)+(ttW/2);
//		var ariveY = (tty)+(ttH/2);
//		$(this).clone()
//				.css({"position":"absolute", "top":ty, "left":tx, "background-image":"url()", "background-color": "#BDA02E"})
//				.appendTo("body")
//				.animate( { left:ariveX, top:ariveY, opacity:0.1 }, 1500 )
//				.remove();

//		
	//});
//}

function dvf_simpleGrid(p_dataset, p_grid, p_clear)
{
//	var dataBody = jQuery(p_grid).find(".data_body");
//	if (p_clear)
//	{
//		dataBody.children(":not(.row_struct)").remove();
//	}
//
//	jQuery(p_dataset).each(function() {
//		var datarec = this;
//		var row = jQuery(p_grid).find(".row_struct").clone();
//
//		row.find("datafield").each(function() {
//			if (jQuery(this).attr("bef_callback"))
//			{
//				eval(jQuery(this).attr("bef_callback") + "()");
//				//document.scripts[jQuery(this).attr("bef_callback")](val);
//			}
//
//			var val = eval("datarec." + jQuery(this).attr("id"));
//
//			if (jQuery(this).attr("aft_callback"))
//			{
//				val = eval(jQuery(this).attr("aft_callback") + "('" + val + "')");
//			}
//
//			jQuery(this).after(val);
//			jQuery(this).remove();
//			//jQuery(this).after(eval("datarec." + jQuery(this).attr("id")));
//		});
//
//		row.removeClass("row_struct");
//		row.appendTo(dataBody);
//	});
	var dataBody = jQuery(p_grid).find(".data_body");
	if (p_clear)
	{
		dataBody.children(":not(.row_struct)").remove();
	}

	var rowStruct = jQuery(p_grid).find(".row_struct");
	var rowTemp = rowStruct.clone();
	rowTemp.removeClass("row_struct");

	jQuery(p_dataset).each(function() {
		var datarec = this;
		var row = rowTemp.clone();
		//alert("row_struct=[" + row.html() + "]");

		row.find("[@datafields]").each(function() {
			var fieldSrc = $(this).html();
			var arrFields = $(this).attr("datafields").split(",");

			for (var idx = 0; idx < arrFields.length; idx++)
			{
				var fieldId = jQuery.trim(arrFields[idx]);
				//var val = eval("datarec." + fieldId);
				var val = datarec[fieldId];
				if (val == undefined)
				{
					val = "";
				}

				if (jQuery(this).attr("bef_callback"))
				{
					val = eval(jQuery(this).attr("bef_callback") + "('" + fieldId + "', '" + val + "', this)");
					//document.scripts[jQuery(this).attr("bef_callback")](val);
				}

				var regexp = new RegExp("%" + fieldId + "%", "ig");
				fieldSrc = fieldSrc.replace(regexp, val);

				if (jQuery(this).attr("aft_callback"))
				{
					eval(jQuery(this).attr("aft_callback") + "('" + fieldId + "', '" + val + "', this)");
				}
			}

			jQuery(this).removeAttr("datafields");
			jQuery(this).empty();
			jQuery(this).html(fieldSrc);
			//jQuery(this).html(fieldSrc);
		});

		row.appendTo(dataBody);
	});
}

function dvf_toggleGrid(p_dataset, p_grid, p_rowBg, p_clear)
{
	var dataBody = jQuery(p_grid).find(".data_body");
	if (p_clear)
	{
		dataBody.children(":not(.row_struct)").remove();
	}

	var rowStruct = jQuery(p_grid).find(".row_struct");
	var rowTemp = rowStruct.clone();
	rowTemp.removeClass("row_struct");

	jQuery(p_dataset).each(function() {
		var datarec = this;
		var row = rowTemp.clone();
		//alert("row_struct=[" + row.html() + "]");

		row.find("[@datafields]").each(function() {
			var fieldSrc = $(this).html();
			var arrFields = $(this).attr("datafields").split(",");

			for (var idx = 0; idx < arrFields.length; idx++)
			{
				var fieldId = jQuery.trim(arrFields[idx]);
				//var val = eval("datarec." + fieldId);
				var val = datarec[fieldId];
				if (val == undefined)
				{
					val = "";
				}

				if (jQuery(this).attr("bef_callback"))
				{
					val = eval(jQuery(this).attr("bef_callback") + "('" + fieldId + "', '" + val + "', this)");
					//document.scripts[jQuery(this).attr("bef_callback")](val);
				}

				var regexp = new RegExp("%" + fieldId + "%", "ig");
				fieldSrc = fieldSrc.replace(regexp, val);

				if (jQuery(this).attr("aft_callback"))
				{
					eval(jQuery(this).attr("aft_callback") + "('" + fieldId + "', '" + val + "', this)");
				}
			}

			jQuery(this).removeAttr("datafields");
			jQuery(this).empty();
			jQuery(this).html(fieldSrc);
			//jQuery(this).html(fieldSrc);
		});

		row.appendTo(dataBody);
	});
}

function dvf_simpleGridClear(p_grid)
{
	var dataBody = jQuery(p_grid).find(".data_body");
	dataBody.children(":not(.row_struct)").remove();
}
/*
function dvf_betterGrid(p_dataset, p_grid, p_colInfo, p_clear)
{
	var dataBody = jQuery(p_grid).find(".data_body");
	if (p_clear)
	{
		dataBody.children(":not(.row_struct)").remove();
	}

	//alert("aa");
	var rowStruct = "";
	if (jQuery(p_grid).find(".row_struct"))
	{
		if (jQuery(p_grid).find(".row_struct")[0].outerHTML)
		{
			rowStruct = jQuery(p_grid).find(".row_struct")[0].outerHTML;
		}
		else
		{
			rowStruct = (new XMLSerializer).serializeToString(jQuery(p_grid).find(".row_struct")[0]);
		}
	}
	rowStruct = rowStruct.replace("row_struct", "");

	//jQuery(p_dataset).each(function() {
	for (var idx = 0; idx < p_dataset.length; idx++)
	{
		var datarec = p_dataset[idx];
		//var row = rowTemp.clone();
		//alert("row_struct=[" + row.html() + "]");
        var rowHtml = rowStruct;

        for (var jdx = 0; jdx < p_colInfo.columns.length; jdx++)
        {
            var fldID = p_colInfo.columns[jdx].colName;

            //var val = eval("datarec." + fldID);
			var val = datarec[fldID];
            if (val == undefined)
            {
                val = "";
            }

            if (p_colInfo.columns[jdx].befCallback)
            {
                val = p_colInfo.columns[jdx].befCallback(fldID, val);
            }

            var regexp = new RegExp("%" + p_colInfo.columns[jdx].colName + "%", "ig");
            rowHtml = rowHtml.replace(regexp, val);
        }

		//row.removeClass("row_struct");

		dataBody.append($(rowHtml));
        //row.appendTo(dataBody);
	}
	//});
}
function dvf_betterGrid(p_dataset, p_grid, p_colInfo, p_clear)
{
	var dataBody = jQuery(p_grid).find(".data_body");
	if (p_clear)
	{
		dataBody.children(":not(.row_struct)").remove();
	}

	var rowStruct = "";
	if (jQuery(p_grid).find(".row_struct"))
	{
		if (jQuery(p_grid).find(".row_struct")[0].outerHTML)
		{
			rowStruct = jQuery(p_grid).find(".row_struct")[0].outerHTML;
		}
		else
		{
			rowStruct = (new XMLSerializer).serializeToString(jQuery(p_grid).find(".row_struct")[0]);
		}
	}
	rowStruct = rowStruct.replace("row_struct", "");

	var arrReplacePos = new Array();
	for (var idx = 0; idx < p_colInfo.columns.length; idx++)
	{
            var regexp = new RegExp("%" + p_colInfo.columns[idx].colName + "%", "ig");
			arrReplacePos[idx] = rowStruct.search(regexp);
            rowStruct = rowStruct.replace(regexp, "");
	}

	//jQuery(p_dataset).each(function() {
	for (var idx = 0; idx < p_dataset.length; idx++)
	{
		var datarec = p_dataset[idx];
		//var row = rowTemp.clone();
		//alert("row_struct=[" + row.html() + "]");
        var rowHtml = rowStruct;

        for (var jdx = p_colInfo.columns.length - 1; jdx >= 0; jdx--)
        {
            var fldID = p_colInfo.columns[jdx].colName;

            //var val = eval("datarec." + fldID);
			var val = datarec[fldID];
            if (val == undefined)
            {
                val = "";
            }

            if (p_colInfo.columns[jdx].befCallback)
            {
                val = p_colInfo.columns[jdx].befCallback(fldID, val);
            }

            //var regexp = new RegExp("%" + p_colInfo.columns[jdx].colName + "%", "ig");
            rowHtml = rowHtml.substr(0, arrReplacePos[jdx]) + val + rowHtml.substr(arrReplacePos[jdx]);
        }

		//row.removeClass("row_struct");

		dataBody.append($(rowHtml));
        //row.appendTo(dataBody);
	}
	//});
}
*/

function dvf_checkDateChar(check)
{
    var inputVal = escape(check);
	var dateReg = /[^0-9\-\/.]+/g;
	return !dateReg.test(inputVal);
}

function dvf_dateCheck(dateVal) {
    var ymd = dateVal;
    var year;
    var month;
    var day;
    var febEndday;

    if( dateVal.length == 0 )   return true;
    if( dateVal.length != 8 )   return false;

    year = ymd.substring(0,4);                  // 년도
    month = ymd.substring(4,6);                 // 월
    day = ymd.substring(6,8);                       // 일

    if (month > 12 || month < 01 || ymd.length < 08 || isNaN(ymd) || day <= 00)
    {
        return false;                           // 월>12,월<1,년월일:8자리이하,년월일:Non Numeric, 일:00 이하     -> return false
    }
    else if (month == 01 || month == 03 || month == 05 || month == 07 ||
        month == 08 || month == 10 || month == 12)
    {
        if (day > 31)
            return false;                       // 1월 3월 5월 7월 8월 10월 12월: 일 -> 31 초과이면 return false
    }
    else if (month == 04 || month == 06 || month == 09 || month == 11)
    {
        if (day > 30)
            return false;                       // 4월 6월 9월 11월: 일 -> 30 초과이면 return false
    }
    else if (month == 02)                       // 2월인 경우
    {
        if (year % 400 == 0)
            febEndday = 29;                     // 년도가 400으로 나눠질 경우 마지막날은 29일
        else if (year % 100 == 0)
            febEndday = 28;                     // 년도가 100으로 나눠질 경우 마지막날은 28일
        else if (year % 4   == 0)
            febEndday = 29;                     // 년도가   4  로 나눠질 경우 마지막날은 29일
        else
            febEndday = 28;                     // 나머지 경우의 마지막날은 28일

        if (day > febEndday)
            return false;                       // 일이 마지막날보다 크면 return false;
    }
    return true;
}

function dvf_dateCheck10(dateVal) {
    var ymd = dateVal;
    var year;
    var month;
    var day;
    var febEndday;

    if( dateVal.length == 0 )   return true;
    if( dateVal.length != 10 )  return false;

    year = ymd.substring(0,4);                  // 년도
    month = ymd.substring(5,7);                 // 월
    day = ymd.substring(8,10);                  // 일

    if ( !dvf_checkNumChar(year) )
        return false;

    if ( !dvf_checkNumChar(month) )
        return false;

    if ( !dvf_checkNumChar(day) )
        return false;

    if (month > 12 || month < 01 || ymd.length < 08 || day <= 00)
    {
        return false;                           // 월>12,월<1,년월일:8자리이하,년월일:Non Numeric, 일:00이하        -> return false
    }
    else if (month == 01 || month == 03 || month == 05 || month == 07 ||
        month == 08 || month == 10 || month == 12)
    {
        if (day > 31)
        {
            return false;                       // 1월 3월 5월 7월 8월 10월 12월: 일 -> 31 초과이면 return false
        }
    }
    else if (month == 04 || month == 06 || month == 09 || month == 11)
    {
        if (day > 30)
        {
            return false;                       // 4월 6월 9월 11월: 일 -> 30 초과이면 return false
        }
    }
    else if (month == 02)                       // 2월인 경우
    {
        if (year % 400 == 0)
            febEndday = 29;                     // 년도가 400으로 나눠질 경우 마지막날은 29일
        else if (year % 100 == 0)
            febEndday = 28;                     // 년도가 100으로 나눠질 경우 마지막날은 28일
        else if (year % 4   == 0)
            febEndday = 29;                     // 년도가   4  로 나눠질 경우 마지막날은 29일
        else
            febEndday = 28;                     // 나머지 경우의 마지막날은 28일

        if (day > febEndday)
        {
            return false;                       // 일이 마지막날보다 크면 return false;
        }
    }
    return true;
}

function dvf_pageload(p_hash)
{
	var loadtype = typeof(jQuery.iae_pageload);
	if (loadtype.toUpperCase() == "FUNCTION")
	{
		jQuery.iae_pageload(p_hash);
	}
}

function dvf_setHistory()
{
//	var loadtype = typeof(p_loadHandler);
//	if (loadtype.toUpperCase() == "FUNCTION")
//	{
//		// Initialize history plugin.
//		// The callback is called at once by present location.hash.
//		jQuery.historyInit(p_loadHandler);
//	}

	// jQuery.iad_pageload를 바로 historyInit에 적용 안하는 이유는
	// 아래 구문을 실행할 때 jQuery.iad_pageload 함수를 인식하지 못하면
	// 오류가 발생하므로 위에서 정의한 dvf_pageload 함수로 Initial 한다.
	jQuery.historyInit(dvf_pageload);
}

function dvf_historyHandler()
{
    //
    var hash = this.href;
    hash = hash.replace(/^.*#/, '');

    // moves to a new page.
    // pageload is called at once.
    jQuery.historyLoad(hash);
    return false;
}

function dvf_pushHistory(p_url)
{
	var hash = p_url;
	var hash = hash.replace(/^.*#/, '');

    // moves to a new page.
    // pageload is called at once.
    jQuery.historyLoad(hash);
	return false;
}

// 외부에 open되는 함수라서 함수명 전치사 dvf_ 대신 f_로 함.
function f_openPopup(p_url, p_target, p_width, p_height, p_scrollbar)
{
	LeftPos = (screen.width) ? (screen.width-180)/2 : 0;
	TopPos = (screen.height) ? (screen.height-280)/2 : 0;
	var popup_win = window.open(p_url ,p_target, "left="+LeftPos+",top="+TopPos+",width="+p_width+",height="+p_height+",location=no,toolbar=no,menubar=no,status=no,resizable=no,scrollbars="+ p_scrollbar);

	return popup_win;
}

function f_openPopup2(p_url, p_target, p_width, p_height, p_scrollbar)
{
	LeftPos = (screen.width) ? (screen.width-1024)/2 : 0;
	TopPos = (screen.height) ? (screen.height-487)/2 : 0;
	var popup_win = window.open(p_url ,p_target, "left="+LeftPos+",top="+TopPos+",width="+p_width+",height="+p_height+",location=no,toolbar=no,menubar=no,status=no,resizable=no,scrollbars="+ p_scrollbar);

	return popup_win;
}

//p_idZipcode : 우편번호 받을 ID, p_idAddress : 주소 받을 ID 
//p_intraGroupCode : 담당지사코드 받을 ID, p_intraGroupName : 담당지사이름 받을 ID, 
function dvf_viewPopbestform(arg){
	//window.showModelessDialog('pop_sch_view.asp?best_cd='+arg,'','help=no; scroll=yes; dialogWidth=800px; dialogHeight:600px; center:yes; ');
	window.open('/study_info/pop_sch_view.asp?best_cd='+arg,'','width=800,height=600,scrollbars=yes,resizable=yes');
}

function dvf_viewPoplangform(arg){
	//window.showModelessDialog('pop_sch_view.asp?best_cd='+arg,'','help=no; scroll=yes; dialogWidth=800px; dialogHeight:600px; center:yes; ');
	window.open('/study_info/pop_langsch_view.asp?school_index_code='+arg,'','width=852,height=600,scrollbars=yes,resizable=yes');
}

function dvf_viewPopunijapform(arg){
	//window.showModelessDialog('pop_sch_view.asp?best_cd='+arg,'','help=no; scroll=yes; dialogWidth=800px; dialogHeight:600px; center:yes; ');
	window.open('/study_info/pop_unisch_jp_view.asp?school_index_code='+arg,'','width=852,height=600,scrollbars=yes,resizable=yes');
}

//학교상담팝업
function dvf_viewPopCounsel(schCd){
    var arrSchIndex = schCd.split(",");
    var pop_Qwin;
    if (arrSchIndex.length > 1)
    {
    	pop_Qwin = window.open('/counsel/pop_qna_write.asp?qna_type=5&list_pickSch='+ schCd,'Qwin','width=640,height=760,scrollbars=yes');
    }
    else
    {
    	pop_Qwin = window.open('/counsel/pop_qna_write.asp?school_index_code='+ schCd,'Qwin','width=640,height=760,scrollbars=yes');
    }
    pop_Qwin.focus();
}
//학교자료요청팝업
function dvf_viewPopUserReq(schCd){
	var pop_Rwin = window.open('/user_req/pop_multisch_req_dm_write.asp?list_pickSch='+ schCd,'Rwin','width=640,height=760,scrollbars=yes');
    pop_Rwin.focus();
}


function dvf_byteLength(p_val)
{
	return (p_val.length + (escape(p_val)+"%u").match(/%u/g).length - 1);
}

function dvf_cut2ByteStr(p_src, p_len)
{
	var l = 0;
	for (var i=0; i < p_src.length; i++) {
		l += (p_src.charCodeAt(i) > 128) ? 2 : 1;
		if (l > p_len)
			return p_src.substring(0,i);
	}

	return p_src
}

function dvf_getCookieValue(p_cookieName)
{
    var allCookies=document.cookie.split('; ');  // cookies are separated by semicolons
    for (var idx = 0; idx < allCookies.length; idx++)
	{
        cookieArray = allCookies[idx].split('='); // a name/value pair (a crumb) is separated by an equal sign
        if (p_cookieName == cookieArray[0])
			return unescape(cookieArray[1]);
    }

	return null;
}

function dvf_webcall(p_url, p_callback)
{
	$.ajax({
		url: p_url,
		type: 'POST',
		data: '',
		dataType: 'json',
		async: false,
		//timeout: 3000,
		error: function() {
			alert("Login 정보 확인 중 오류 발생.");
		},
		success: function(p_data) {
			if (p_data.is_login)
			{
				//f_liveact_btn(p_data.now_hour, p_data.user_seq);
				if (typeof(p_callback) == "function")
				{
					p_callback();
				}
				else
				{
					// callback 함수가 지정안됐으면 default 함수가 정의됐는지 check하여 있으면 호출.
					if (typeof(open_webcall_win) == "function")
					{
						open_webcall_win();
					}
				}
			}
			else
			{
				alert('로그인 또는 회원가입후 사용하실 수 있습니다');
			}
		}
	});
}

function dvf_intSchProcSession(p_proc, p_schIndex, p_url)
{
	var param = "proc="+ p_proc +"&schIndex="+ p_schIndex;
	$.ajax({
		url: p_url,
		type: 'POST',
		data: param,
		dataType: 'json',
		error: function() {
			alert("Error loading");
		},
		success: function(p_data) {
			if (p_data.result == "Success"){
				alert("관심학교 리스트에 담았습니다.");
			}else if(p_data.result == "Fail1"){
				alert("DB저장 실패했습니다.");
			}
			else if(p_data.result == "Fail2"){
				alert("DB삭제 실패했습니다.");
			}
			else if(p_data.result == "Fail3"){
				alert("세션정보가 없습니다.");
			}
			else if(p_data.result == "Fail4"){
				alert("보관되어 있는 학교입니다.");
			}
		}
	});
}

function dvf_html2entity(p_src)
{
	var result = "";
	if (p_src != null && p_src != undefined)
	{
		result = p_src.replace(/&/g, "&amp;").replace(/\?/g, "&#63;").replace(/:/g, "&#58;").replace(/\//g, "&#47;").replace(/'/g, "&apos;").replace(/"/g, "&quot;").replace(/\./g, "&#46;");
	}

	return result;
}

function dvf_getPosition(obj){
	var curleft = obj.offsetLeft || 0;
	var curtop = obj.offsetTop || 0;
	while (obj = obj.offsetParent)
	{
		curleft += obj.offsetLeft
		curtop += obj.offsetTop
	}
	return {x:curleft,y:curtop};

}

jQuery.fn.extend({
	/*
	 * 메소드를 호출한 DOM 개체 위에 화면상의 중심 방향으로 확대되는 Popup widget의 좌측 상단 좌표 계산
	 *
	 * 작성자 : 홍재훈
	 * 작성일 : 2007. 09. 17
	 */
	dvf_extWindowPos: function(p_param) {
		var settings = jQuery.extend({
			srcContainer:jQuery("body"),
			extWgtWidth: 0,
			extWgtHeight: 0
		}, p_param);

		var srcWidget = jQuery(this);

		// Source Widget의 중앙 위치 계산
		var hCenter = (settings.srcContainer.width() / 2) + jQuery.iUtil.getPosition(settings.srcContainer[0]).x;
		var vCenter = (settings.srcContainer.height() / 2) + jQuery.iUtil.getPosition(settings.srcContainer[0]).y;

		var wgtPos = jQuery.iUtil.getPosition(srcWidget[0]);

		var popWinX = wgtPos.x;
		var popWinY = wgtPos.y;

		// widget의 left 위치가 widget 배열의 container 우측에 있을 경우엔 popup window가 좌측으로 확장되게 위치를 지정.
		if (wgtPos.x > hCenter)
		{
			if (settings.extWgtWidth > 0)
			{
				popWinX = wgtPos.x - settings.extWgtWidth + srcWidget.width();
			}
		}

		if (wgtPos.y > vCenter)
		{
			if (settings.extWgtHeight > 0)
			{
				popWinY = wgtPos.y - settings.extWgtHeight + srcWidget.height();
			}
		}

		var result = new Array();
		result[0] = popWinX;
		result[1] = popWinY;
		//extWin.css("top", String(popWinY) + "px");
		//extWin.css("left", String(popWinX) + "px");

		return result;
	},

	/*
	 * 이 메소드를 호출한 개체에 scroll event를 설정하여 수직방향으로 개체의 가장 밑바닥까지 scroll 되었을 경우
	 * parameter로 전달된 callback 함수를 호출한다.
	 *
	 * 사용 plug-in :
	 * 작성자 : 홍재훈
	 * 작성일 : 2007. 09. 17
	 */
	dvf_vScrollBottom: function(p_callback) {
		jQuery(this).scroll(function(p_event) {
			// p_event.stopPropagation();
			if ( (p_event.target.scrollHeight - p_event.target.scrollTop) <= p_event.target.offsetHeight )
			{
				if (p_callback != undefined && !jQuery.isPaging)
				{
					if (jQuery.isPaging == undefined)
					{
						jQuery.extend({ isPaging: true });
					}
					else
					{
						jQuery.isPaging = true;
					}

					p_callback(p_event);
				}
				else
				{
					//alert("paging...");
				}
			}
		});
	},
        
	/*
	 * 데이터쌍을 셀렉트박스 형식으로 반환
	 *
	 * 작성자 : 김학성
	 * 작성일 : 2007. 10. 07
	 *
	 *    $(this).dvf_getSelectTag({
	 *			srcContainer:jQuery("#codeSelectBox"),
	 *			serviceSrc: '<%=gsServiceURL%>/common/svc_code_list.asp',
	 *			param: "code=1087&lang_div=0&notInCodes=",
	 *			jsonName: "codeDatas",
	 *			codeField: "code",
	 *			dataField: "codeName",
	 *          selectTagID: "",
	 *			ment: "",
	 *          changeHandler: function(_arg){ alert(_arg);}
	 *    });
	 *
	 *     <div id="codeSelectBox"></div>
	 */
	dvf_getSelectTag: function(p_param) {
		var settings = jQuery.extend({
			srcContainer: null,
			serviceSrc: "",
			param: "",
			jsonName: "",
			codeField: "",
			dataField: "",
            selectTagID: "",
			ment: "",
            changeHandler: function(_arg){
                                return;
                           }
		}, p_param);

        $.ajax({
            url: settings.serviceSrc,
            type: 'POST',
            data: settings.param,
            dataType: 'json',
            //timeout: 3000,
			async: false,
            error: function() {
                alert("Error loading SelectBox List");
            },
            success: function(_data) {
                fnGetContent(_data, settings);
            }
        });

        function fnGetContent(p_data, p_settings){
            p_settings.srcContainer.empty();

            if (eval("p_data."+p_settings.jsonName) != undefined){
                var select = $("<select id='"+ p_settings.selectTagID +"'></select>");
                var option, code, codeName;

                if (p_settings.ment != "")
                {
                    select.append($("<option value=''>"+ p_settings.ment +"</option>"));
                }

                $(eval("p_data."+p_settings.jsonName)).each(function() {
                    code = eval("this."+p_settings.codeField);
                    codeName = unescape(eval("this."+p_settings.dataField));

                    option = $("<option value='"+ code +"'>"+ codeName +"</option>");

                    select.append(option);
                });
                if (p_settings.changeHandler != undefined)
                {
                    //select.change(p_settings.changeHandler);
                    select.change(function() { p_settings.changeHandler(select.val()); });
                }

                select[0].selectedIndex = 0;

                p_settings.srcContainer.append(select);
                p_settings.srcContainer.show();
            }else{
                p_settings.srcContainer.hide();
            }
        }
    },

	/*
	 * Accordion 메뉴 설정
	 *
	 * 작성자 : 홍재훈
	 * 작성일 : 2007. 10. 08
	 */
	dvf_accordion: function(p_param)
	{
		var accordionContainer = jQuery(this);
		var maxHeight = 0;
		accordionContainer.find(".acrd_elm_content").each(function() {
			if (jQuery(this).height() > maxHeight)
			{
				maxHeight = jQuery(this).height();
			}
		});

		accordionContainer.find(".acrd_elm_content").hide();
		accordionContainer.find(".acrd_elem_head").click(function() {
			var toHide = accordionContainer.find(".acrd_elm_content:visible");	// 현재 열려있는 accordion content
			var toShow = jQuery(this).parent(".acrd_element").children(".acrd_elm_content");	// 사용자가 클릭한 accordion head와 관계된 accordion content

			// 현재 열려있는 accordion content와 새로 클릭한 accordion content가 동일한 경우에 대한 처리.
			if (toHide[0] == toShow[0])
			{
				// Library화 할때는 flag를 이용하여 항시 open 여부를 설정할 수 있게 하여
				// 항시 open으로 설정되었으면 그냥 return, 아니면 hide 처리한다.
				if (p_param.alwaysOpen)
				{
					return;
				}
				else
				{
					toHide.hide("slow");
					return;
				}
			}

			if (toHide != undefined && toHide.length > 0)
			{
				toShow.css({ height: 0, overflow: 'hidden' }).show();
				toHide.animate({height:"hide"},{
					step: function(n){
						toShow.height(Math.ceil(maxHeight - ($.fn.stop ? n * maxHeight : n)));
					},
					duration: 1000,
					complete: function() { toShow.height(maxHeight); }
				});
			}
			else
			{
				toShow.height(maxHeight);
				toShow.show("slow");
			}
		});
	}
});

/*
 * 툴팁 띄워주는 스크립트
 * "김학성과장님"이 만는것을 수정.....
 * 작성자 : 김경의
 * 작성일 : 2007. 11. 14
 */
function dvf_read_help(p_target, p_helpCd, p_boxWidth, p_boxheight, p_title, p_contents)
{
    var tooltipWin;
    $("#"+ p_target).bind("mouseover", function(e){
        tooltipWin = dvf_help_contents(e, p_helpCd, p_boxWidth, p_boxheight, p_title, p_contents);
        tooltipWin.show();
    }).css("cursor", "pointer");

    $("#"+ p_target).mouseout(function(){
		//$(this).unbind("mouseover");
		tooltipWin.hide();
    });
}

function dvf_read_help_click(p_target, p_helpCd, p_boxWidth, p_boxheight, p_title, p_contents)
{
    var tooltipWin;
    $("#"+ p_target).toggle(function(e) {
        tooltipWin = dvf_help_contents(e, p_helpCd, p_boxWidth, p_boxheight, p_title, p_contents);
        tooltipWin.show();
    }, function(){tooltipWin.hide();}).css("cursor", "pointer");
}

function dvf_help_contents(e, p_helpCd, p_boxWidth, p_boxheight, p_title, p_contents)
{
    var mouseEvt = e ? e : window.event;
    var x = mouseEvt.clientX;
    var y = mouseEvt.clientY;
	var topOffset;
	var leftOffset;
	topOffset = y + document.body.scrollTop;
	leftOffset = x + document.body.scrollLeft;
	var winTop = (y > p_boxheight ? topOffset - p_boxheight - 10 : topOffset + 10);
	var winLeft = (x > p_boxWidth/2 ? leftOffset - p_boxWidth/2 : leftOffset);
	// 툴팁이 1024를 벗어날 경우 위치 이동
	var ttRightPoint = winLeft + p_boxWidth;
	if (ttRightPoint > 1024){
		winLeft = winLeft - (ttRightPoint - 1000);
	}
	//툴팁화살표 표시 유동적으로
	var ttArrowPos = x - winLeft;

	winLeft += "px";
	winTop += "px";
	//alert(winLeft +'|'+ttRightPoint);
    var brHelp = $("<div style='display:none;z-index:102;'></div>");
    var brHelpHtml="<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
                    "  <tr>"+
                    "    <td width=\"4\" height=\"4\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_tl.gif\" width=\"4\" height=\"4\"></td>"+
                    "    <td height=\"4\" background=\"http://image.eduhouse.net/iaeweb/img/ball_box_tbg.gif\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_tbg.gif\" width=\"4\" height=\"4\"></td>"+
                    "    <td width=\"4\" height=\"4\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_tr.gif\" width=\"4\" height=\"4\"></td>"+
                    "  </tr>"+
                    "  <tr>"+
                    "    <td width=\"4\" background=\"http://image.eduhouse.net/iaeweb/img/ball_box_lbg.gif\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_lbg.gif\" width=\"4\" height=\"4\"></td>"+
                    "    <td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">"+
                    "        <tr>"+
                    "          <td height=\"30\" background=\"http://image.eduhouse.net/iaeweb/img/ball_box_gra.gif\"  style=\"padding:5 5 5 5\" class=\"qa_sch_line\">%help_title%</td>"+
                    "        </tr>"+
                    "        <tr>"+
                    "          <td height=\"2\" background=\"http://image.eduhouse.net/iaeweb/img/ball_box_line.gif\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_line.gif\" width=\"2\" height=\"2\"></td>"+
                    "        </tr>"+
                    "        <tr>"+
                    "          <td style=\"padding:5 5 5 5\" class=\"co_list\">%help_contents%</td>"+
                    "        </tr>"+
                    "      </table></td>"+
                    "    <td width=\"4\" background=\"http://image.eduhouse.net/iaeweb/img/ball_box_rbg.gif\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_rbg.gif\" width=\"4\" height=\"4\"></td>"+
                    "  </tr>"+
                    "  <tr>"+
                    "    <td width=\"4\" height=\"7\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_bl.gif\" width=\"4\" height=\"6\"></td>"+
                    "    <td height=\"7\" background=\"http://image.eduhouse.net/iaeweb/img/ball_box_bbg.gif\"><img style=\"margin-left: "+ ttArrowPos +"px;\" src=\"http://image.eduhouse.net/iaeweb/img/ball_box_barr.gif\" width=\"8\" height=\"7\"></td>"+
                    "    <td width=\"4\" height=\"7\"><img src=\"http://image.eduhouse.net/iaeweb/img/ball_box_br.gif\" width=\"4\" height=\"6\"></td>"+
                    "  </tr>"+
                    "</table>";

    brHelpHtml = brHelpHtml.replace(/%help_title%/ig, p_title);
    brHelpHtml = brHelpHtml.replace(/%help_contents%/ig, p_contents);

    brHelp.append(brHelpHtml);
	var brHelpPan = "<iframe id='brHelpFrm' src='about:blank' mce_src='about:blank' scrolling='no' frameborder='0'></iframe>";
	brHelp.before(brHelpPan);
	$("body").append(brHelp);
	$("#brHelpFrm").css({width:p_boxWidth,
                       height:p_boxheight,
                       top:winTop,
                       left:winLeft,
						position:"absolute"});

	return brHelp.css({width:p_boxWidth,
                       height:p_boxheight,
                       top:winTop,
                       left:winLeft,
					   backgroundColor:"#fff",
                       position:"absolute"});
}


//에러 발생시 메일 발송
function sendErrMsg(p_user_msg,p_real_msg){
	//if (confirm(p_user_msg +"\n불편을 드려 죄송합니다.\n관리자에게 오류 알림 메일을 발송하시겠습니까?"))
	//{
		alert(p_user_msg);
		var param = "errUserMsg="+ String(p_user_msg);
		param += "&errRealMsg="+ String(p_real_msg);
		$.ajax({
			url: '/service/svc_transferErr.asp',
			type: 'POST',
			async: false,
			data: param,
			dataType: 'json',
			error: function() {
				alert("관리자에게 메일 발송 실패하였습니다.\n고객게시판이나 전화(1588-1377)를 통해서 문의바랍니다.");
			},
			success: function(p_data) {
				if (p_data.result != undefined && p_data.result.length > 0)
				{
					if (p_data.result == "y")
					{
						alert("관리자에게 메일 발송 하였습니다.");
					}
					else
					{
						alert("관리자에게 메일 발송 실패하였습니다.\n고객게시판이나 전화(1588-1377)를 통해서 문의바랍니다.");
					}

				}
				else
				{
					alert("관리자에게 메일 발송 실패하였습니다.\n고객게시판이나 전화(1588-1377)를 통해서 문의바랍니다.");
				}
			}
		});
	//}
}

//박람회참가예약 팝업(로그인첵크)
function F_popExhiReserv(){
	//임시 신청페이지 가기
	//var pop_Lwin = window.open('/event/ex/inc/pop_event_login.asp?evt_code=687','Lwin','top=0, left=0, width=632,height=450,resizable=no,scrollbars=yes');

	//박람회 신청 페이지 가기
	 var pop_Lwin = window.open('/event/ex/index.asp','Lwin','top=0, left=0, width=1000,height=730,resizable=yes,scrollbars=yes'); 
	pop_Lwin.focus();

	//var pop_Lwin = window.open('/event/ex/wef2010/index.asp','Lwin','top=0, left=0, width=1020,height=730,resizable=yes,scrollbars=yes');
	//2008 추계 코엑스 박람회 전용링크
    //var pop_Lwin = window.open('/event/ex/index_coex.asp','Lwin','top=0, left=0, width=971,height=768,resizable=no,scrollbars=yes');
        
	//alert("제103회 세계 유학 박람회 준비중입니다\n박람회기간 : 4월 24일(금)~25일(토)\n\n3월 27일(금) 오전 11시부터 신청 가능합니다.");
    //alert("신청가능한 박람회가 없습니다.");
}

function F_popExhiReserv_exhitemp(){
	var pop_Lwin = window.open('/event/ex/sub_01.asp?mnu_code=1','Lwin','top=0, left=0, width=1000,height=730,resizable=yes,scrollbars=yes');
	pop_Lwin.focus();
}

//박람회참가예약 팝업(로그인첵크)
function F_popExhiReserv_evtCode(_evtCode){
	//임시 신청페이지 가기
	//var pop_Lwin = window.open('/event/ex/inc/pop_event_login.asp?evt_code='+_evtCode,'Lwin','top=0, left=0, width=632,height=450,resizable=no,scrollbars=yes');

	//박람회 신청 페이지 가기
	//var pop_Lwin = window.open('/event/ex/index.asp?evt_code=' + _evtCode,'Lwin','top=0, left=0, width=1000,height=730,resizable=yes,scrollbars=yes');
    //pop_Lwin.focus();

	//2008 추계 코엑스 박람회 전용링크
    //var pop_Lwin = window.open('/event/ex/index_coex.asp','Lwin','top=0, left=0, width=971,height=768,resizable=no,scrollbars=yes');
    
	//alert("제103회 세계 유학 박람회 준비중입니다\n박람회기간 : 4월 24일(금)~25일(토)\n\n3월 27일(금) 오전 11시부터 신청 가능합니다.");
    alert("신청가능한 박람회가 없습니다.");
}

function F_popExhiReservIlsan_evtCode(_evtCode){ 
	//임시 신청페이지 가기_일산지사
	//var pop_Lwin = window.open('/event/ex/pop_ex_join_req.asp?evt_code='+_evtCode,'Lwin','top=0, left=0, width=632,height=450,resizable=no,scrollbars=yes');
    alert("신청가능한 박람회가 없습니다.");
}

