function reEmbed(cont_id)
{
	var swf_src = "http://media.inempire.com/player/ExtendASPPlayer.swf" ;
	var swf_width   	= "414";
	var swf_height  	= "340";
	var swf_version  = "9.0.47.00";
	var swf_id    = (tmp = swf_src.split("/"), tmp = tmp[tmp.length - 1], tmp.split(".swf").shift());
	var swf_fullscreen = "true";
	var swf_script   = "always";
	var swf_wmode  = "window";
	var swf_networking = "all";
	var swf_bgcolor  = "";
	var swf_vars    = "cid="+ cont_id; // pink, gray, purple, black
	var nocache    = Math.random()*3600000;

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+swf_version+'" name="'+swf_id+'" width="'+swf_width+'" height="'+swf_height+'" id="'+swf_id+'">  <param name="movie" value="'+swf_src+'?nocache='+nocache+'" /> <param name="quality" value="high" />  <param name="allowFullScreen" value="'+swf_fullscreen+'" />  <param name="bgColor" value="' + swf_bgcolor + '" /> <param name="allowScriptAccess" value="'+swf_script+'" />  <param name="allowNetworking" value="'+swf_networking+'" />  <param name="wmode" value="'+swf_wmode+'" />  <param name="FlashVars" value="'+swf_vars+'" />  <embed src="'+swf_src+'?nocache='+nocache+'" allowFullScreen="'+swf_fullscreen+'" FlashVars="'+swf_vars+'" allowScriptAccess="'+swf_script+'" allowNetworking="'+swf_networking+'" width="'+swf_width+'" height="'+swf_height+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="'+swf_id+'"></embed></object>');
}

// 객체 평션
function $(id) {
   return document.getElementById(id);
}

// Trim
function Trim(obj1)
{
	obj1 = obj1.replace(/^(\s+)|(\s+)$/g, "")
	return obj1;
}

// Input String null checking
function validFieldText(objInput, msgStr)
{
	if(Trim(objInput.value) == "") 
	{
		alert("" + msgStr + " 입력해주세요.");
		objInput.focus();
		return false;
	}

	return true;
}

// Input String null checking(with select)
function validFieldSelect(objInput, msgStr)
{
	if(Trim(objInput.value) == "") 
	{
		alert("" + msgStr + " 선택해주세요.");
		objInput.focus();
		return false;
	}

	return true;
}

// 링크 점선 테두리 한번에 없애기
function bluring()
{
	if (event.srcElement.tagName == "a" || event.srcElement.tagName == "img")	document.body.focus();
}
//document.onfocusin = bluring;

function SetNum(obj)
{
	val=obj.value;
	re=/[^0-9]/gi;
	obj.value=val.replace(re,"");
}

function validFieldTextNoMsg(objInput)
{
	if(Trim(objInput.value) == "") 
	{
		return false;
	}

	return true;
}

// Input String null checking (for English)
function validFieldTextEng(objInput, msgStr)
{
	if(Trim(objInput.value) == "") 
	{
		alert("Please enter a " + msgStr + "");
		objInput.focus();
		return false;
	}

	return true;
}

// Input Webedit null checking
function validFieldWebEdit(objInput, msgStr)
{
	if(objInput == false) 
	{
		alert("\n" + msgStr + " 입력해 주세요.");
		return false;
	}

	return true;
}

// 포맷 체크
function isValidFormat(input, format) 
{
    if (input.value.search(format) != -1) 
	{
        return true;
    }
    return false;
}

//숫자입력 체크(onblur)
function isValidNumber(theForm, firstNum) 
{
	if(Trim(theForm.value) != "") 
	{
		theForm.value=Trim(theForm.value);

		var str=theForm.value;
		for (var i = 0; i< str.length; i++) 
		{
			var ch = str.substring(i, i + 1);

			if (i==0 && ch=="-") {}
			else
			{
				if ( (ch<"0" || ch>"9") ) 
				{
					alert(firstNum+" 숫자만 입력해주세요.");
					theForm.readonly = false;
					theForm.value="";
					theForm.focus();
					return false;
				}
			}
		}
	}

	return true;
}

//날짜 형식 체크
function isValidDate(o)
{	
	if (Trim(o.value) != ""){
		if(o.value.indexOf("-") +""=="-1")
		{
			alert("잘못된 형식입니다.")
			o.focus();
			return false;
		}
	}
	return true;
}

//이메일 형식 체크
function isValidMail(o)
{
	if (Trim(o.value) != ""){
		if(o.value.indexOf("@") +""=="-1" || o.value.indexOf(".") +""=="-1")
		{
			alert("잘못된 이메일 형식입니다.")
			o.focus();
			return false;
		}
	}
	return true;
}

// 이메일 형식 체크
function CheckEmail(strEmail)
{
	var format = /^((\w|[\-\.])+)\.([A-Za-z]+)$/;
    	return isValidFormat(strEmail, format);
}

function WindowOpen(Url, popName, popwidth, popheight)
{
	var height = screen.height;
	var width = screen.width;
	var left = 0;
	var top = 0;
	popheight = popheight + 27;
	window.open(Url, popName, "width="+popwidth+",height="+popheight+",scrollbars=no,toolbar=no,left="+left+",top="+top+"")
}

function WindowOpenCenter(Url, popName, popwidth, popheight)
{
	var LeftPosition = (screen.width) ? (screen.width-popwidth)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-popheight)/2 : 0;
	var settings = 'height='+popheight+',width='+popwidth+',top='+TopPosition+',left='+LeftPosition+',status=no,toolbar=no,menubar=no,location=no,fullscreen=no,resizable=no,scrollbars=no';
	win = window.open(Url,popName,settings)
}

function WindowOpenCenter2(Url, popName, popwidth, popheight)
{
	var LeftPosition = (screen.width) ? (screen.width-popwidth)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-popheight)/2 : 0;
	var settings = 'height='+popheight+',width='+popwidth+',top='+TopPosition+',left='+LeftPosition+',status=no,toolbar=no,menubar=no,location=no,fullscreen=no,resizable=no,scrollbars=yes';
	win = window.open(Url,popName,settings)
}

function WindowOpenNomargin(Url, popName, popwidth, popheight)
{
	var height = screen.height;
	var width = screen.width;
	popheight = popheight + 27;
	window.open(Url, popName, "width="+popwidth+",height="+popheight+",scrollbars=no,toolbar=no,left=0,top=0")
}

// 주민등록번호 체크
function jumin_check(o, registNum1, registNum2 )
{
	var chk =0;
	var yy = registNum1.value.substring(0,2);
	var mm = registNum1.value.substring(2,4);
	var dd = registNum1.value.substring(4,6);
	var sex = registNum2.value.substring(0,1);


	if((registNum1.value.length!=6) || (yy <25||mm <1||mm>12||dd<1))
	{
		o.msg.value = "주민등록번호를 바로 입력하여 주십시오.";
		registNum1.value="";
		registNum2.value="";
		registNum1.focus();
		return true;
	}

	if((sex != 1 && sex !=2 && sex != 3 && sex != 4) || (registNum2.value.length!= 7))
	{
		o.msg.value = "주민등록번호를 바로 입력하여 주십시오.";
		registNum1.value="";
		registNum2.value="";
		registNum1.focus();
		return true;
	}

	for (var i = 0; i <=5 ; i++)
	{
		chk = chk + ((i%8+2) * parseInt(eval(registNum1.value.substring(i,(i+1)))));
	}
	for (var i = 6; i <=11 ; i++)
	{
		chk = chk + ((i%8+2) * parseInt(eval(registNum2.value.substring((i-6),(i-5)))));
	}

	chk = 11 - (chk %11);
	chk = chk % 10;

	if (chk != registNum2.value.substring(6,7))	
	{
		o.msg.value = "유효하지 않는 주민등록번호입니다.\n\n타인의 주민등록번호를 도용하거나 허위 기제할 경우 회원가입이 취소됩니다.";
		registNum1.value="";
		registNum2.value="";
		registNum1.focus();
		return true;
	}
}

// ActiveX Start //
function flashMovie(fid,src,wid,hei,fvs,wmd) 
{
	this.fPrint = '';
	this.Id = document.getElementById(fid);
	this.Src = src;
	if(wid == 0)
	{
		this.Width = '100%';
	}
	else{
		this.Width = wid;
	}
	if(hei == 0){
		this.Height = '100%';
	}
	else{
		this.Height = hei;
	}
	this.FlashVars = (fvs != undefined)? fvs :'';
	this.Wmod = (wmd != undefined)? wmd :'';
	if(isObject(Id)) 
	{
		fPrint = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
		fPrint += ' width="'+Width+'"';
		fPrint += ' height="'+Height+'">';
		fPrint += '<param name="allowScriptAccess" value="always">';
		fPrint += '<param name="movie" value="'+Src+'">';
		fPrint += '<param name="menu" value="false" />';
		fPrint += '<param name="quality" value="high">';
		fPrint += (FlashVars != null) ? '<param name="FlashVars" value="'+FlashVars+'">' : '';
		fPrint += '<param name="wmode" value="'+Wmod+'">';
		fPrint += '<embed';
		fPrint += ' src="'+Src+'"';
		fPrint += (FlashVars != null) ? ' FlashVars="'+FlashVars+'"' : '';
		fPrint += ' wmode="'+Wmod+'"' ;
		fPrint += ' quality="high"';
		fPrint += ' allowScriptAccess="always"';
		fPrint += ' pluginspage="http://www.macromedia.com/go/getflashplayer"';
		fPrint += ' type="application/x-shockwave-flash"';
		fPrint += ' width="'+Width+'"';
		fPrint += ' height="'+Height+'"';
		fPrint += '></embed>';
		fPrint += '</object>';
		Id.innerHTML = fPrint;
	}
}

function isObject(a) 
{
    return (a && typeof a == 'object');
}
// ActiveX End //

//Member Login
function LoginCheck(theForm) 
{
	if (!validFieldText(theForm.id, "아이디를"))
	{
		return ;
	}
	if (!validFieldText(theForm.pass1, "비밀번호를"))
	{
		return ;
	}

	theForm.submit();
}

//display설정 변경
function changeTb(tbName, tbCount, tbNum) 
{
	var a;
	for(i=1;i<=tbCount;i++)
	{
		a = eval("document.all."+tbName+i);

		if(i != tbNum) 
		{
			a.style.display = 'none';
		}
		else 
		{
			a.style.display = 'block';
		}
	}
}

//아이프레임 자동 길이 조절 스크립트
function resizeFrame(iframeObj)
{
	var innerBody = iframeObj.contentWindow.document.body;
	oldEvent = innerBody.onclick;
	innerBody.onclick = function(){ resizeFrame(iframeObj, 1);oldEvent; };
	var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight) + 5;
	iframeObj.style.height = innerHeight;
	var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
	iframeObj.style.width = innerWidth;
	if( !arguments[1] )        /* 특정 이벤트로 인한 호출시 스크롤을 그냥 둔다. */
		this.scrollTo(1,1);
}

function clrImg(obj)
{
    obj.style.backgroundImage="";
	obj.onkeydown=obj.onmousedown=null;
}

function isEng(str)
{
	for(var i=0; i < str.length; i++)
	{
		achar = str.charCodeAt(i);
		if(achar > 255)
		{
			return false;
		}
	}

	return true;
}

function mail_check(str) 
{
	emailEx1 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z]+/;
	emailEx2 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
	emailEx3 = /[^@]+@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
	if(emailEx1.test(str)){ return true; };
	if(emailEx2.test(str)){ return true; };
	if(emailEx3.test(str)){ return true; };
	return false;
}

// 글자수 바이트로 제한
function ChkByte(objname,maxlength) 
{
	var objstr = objname.value; // 입력된 문자열을 담을 변수
	var objstrlen = objstr.length; // 전체길이

	// 변수초기화
	var maxlen = parseInt(maxlength,10); // 제한할 글자수 최대크기
	var i = 0; // for문에 사용
	var bytesize = 0; // 바이트크기
	var strlen = 0; // 입력된 문자열의 크기
	var onechar = ""; // char단위로 추출시 필요한 변수
	var objstr2 = ""; // 허용된 글자수까지만 포함한 최종문자열

	// 입력된 문자열의 총바이트수 구하기
	for(i=0; i< objstrlen; i++) 
	{
		// 한글자추출
		onechar = objstr.charAt(i);

		if (escape(onechar).length > 4) 
		{
			bytesize += 2;			// 한글이면 2를 더한다.
		} 
		else 
		{
			bytesize++;				// 그밗의 경우는 1을 더한다.
		}

		if(bytesize <= maxlen)		// 전체 크기가 maxlen를 넘지않으면
		{   
			strlen = i + 1;			// 1씩 증가
		}
	}

	// 총바이트수가 허용된 문자열의 최대값을 초과하면
	if (bytesize > maxlen)
	{
		objstr2 = objstr.substr(0, strlen);
		objname.value = '';
		return true;
	}
	return false;
}

// 모두 선택 해제
var checkAllFlag = true;

function CheckAll(A,B,C)	// CheckAll(폼이름, 개체이름, true/false)
{
	var X=eval("document.forms."+A+"."+B)
	for (c=0;c<X.length;c++)
		X[c].checked=checkAllFlag;

	checkAllFlag = !checkAllFlag;
}

// Alphabet 필드
function IsAlphabet(str)
{
	var vStr = str.toUpperCase();
	for(var i = 0; i < vStr.length; i++)
	{
		if(vStr.charAt(i) < 'A' || vStr.charAt(i) > 'Z')
		{
			return false;
		}
	}
	return true;
}

// Alphabet + Number 필드
function IsAlphaDigit(obj, str)
{
	var strTemp = obj.value.toUpperCase();
	for(var i = 0; i < strTemp.length; i++)
	{
		if(strTemp.charAt(i) < '0' || (strTemp.charAt(i) > '9' && strTemp.charAt(i) < 'A') ||  strTemp.charAt(i) > 'Z') 
		{
		    alert( str + " 입력해 주세요." );
			obj.value = "";
			obj.focus();
			return false;
		}
	}
	return true;
}

// Number 필드
function comFuncIsDigit(obj, str)
{
	for (i=0; i < obj.value.length; i++)
	{
		if (obj.value.charAt(i) < '0' || obj.value.charAt(i) > '9')
		{
			alert( str + " 숫자만 입력해 주세요." );
			obj.value = "";
			obj.focus();
			return false;
		}
	}
	return true;
}

// 필드 Length
function CheckLength(obj, min, max, str)
{
	var iLength = obj.value.length;
	if(iLength < min || iLength > max) 
	{
		alert(str + " " + min + "자 이상 " + max + "자 이내로 입력해 주세요.");
		obj.focus();
		return false;
	}
	else return true;
}

// 필드 Length
function CheckLength1(obj, strNum, str)
{
	var iLength = obj.value.length;
	if(iLength < strNum || iLength > strNum) 
	{
		alert( str + " " + strNum + "자로 입력해 주세요." );
		obj.focus();
		return false;
	}
	else return true;
}

// 트랙백 복사하기
function SelectCopy(s)
{
    var doc = document.body.createTextRange();
    doc.moveToElementText(document.all(s));
    doc.select();
    doc.execCommand('copy');
    alert('주소가 복사되었습니다.\n\n주소창에 Ctrl + V 를 눌러주세요.');
}

// 레이어 처리 스크립트
var previd = null;

function displaysub(subid) 
{
	if (previd != null) 
	{
		if (previd != subid) 
		{
			previd.style.display = "none";
		}
	}

	if (subid.style.display == "none") 
	{
		subid.style.display = "block";
	} 
	else 
	{
		subid.style.display = "none";
	}
	previd = subid;
}

// 달력 시작////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var target;																	// 호출한 Object의 저장
var stime;
document.write("<div id='minical' oncontextmenu='return false' ondragstart='return false' onselectstart='return false' style='background-color:white; margin-top:2px;margin-left:-50px;width:121px;display:none;position: absolute; z-index: 100; '></div>");
document.write("<div id='minical_bg' oncontextmenu='return false' ondragstart='return false' onselectstart='return false' style='background-color:white; margin-top:2px;margin-left:-50px;width:121px;display:none;position: absolute; z-index: 99; '><iframe style='width:121px; height:120px;'></iframe></div>");

function Calendar(obj) {														// jucke
	var now = obj.value.split("-");
	var x, y;
	
	target = obj;																// Object 저장;

	x = (document.layers) ? loc.pageX : event.clientX;
	y = (document.layers) ? loc.pageY : event.clientY;

	minical.style.pixelTop	= y+5;
	minical.style.pixelLeft	= x-50;
	minical.style.display = (minical.style.display == "block") ? "none" : "block";

	minical_bg.style.pixelTop	= y+5;
	minical_bg.style.pixelLeft	= x-50;
	minical_bg.style.display = (minical_bg.style.display == "block") ? "none" : "block";

	if (now.length == 3) {														// 정확한지 검사
		Show_cal(now[0],now[1],now[2]);											// 넘어온 값을 년월일로 분리
	} else {
		now = new Date();
		Show_cal(now.getFullYear(), now.getMonth()+1, now.getDate());			// 현재 년/월/일을 설정하여 넘김
	}
}

function doOver() {																// 마우스가 칼렌다위에 있으면
	var el = window.event.srcElement;
	cal_Day = el.title;

	if (cal_Day.length > 7) {													// 날짜 값이 있으면
		el.style.borderTopColor = el.style.borderLeftColor = "buttonhighlight";
		el.style.borderRightColor = el.style.borderBottomColor = "buttonshadow";
	}
	window.clearTimeout(stime);													// Clear
}

function doClick() {															// 날짜를 선택하였을 경우
	cal_Day = window.event.srcElement.title;
	window.event.srcElement.style.borderColor = "red";							// 테두리 색을 빨간색으로
	if (cal_Day.length > 7) {													// 날짜 값이있으면
		target.value = cal_Day													// 값 설정
	}
	minical.style.display='none';												// 화면에서 지움
	minical_bg.style.display='none';
	if (cal_Day.length > 7)
	{
		target.fireEvent("onChange");
	}
}

function doOut() {
	var el = window.event.fromElement;
	cal_Day = el.title;

	if (cal_Day.length > 7) {
		el.style.borderColor = "white";
	}
	//stime=window.setTimeout("minical.style.display='none';", 200);
}

function day2(d) {																// 2자리 숫자로 변경
	var str = new String();
	
	if (parseInt(d) < 10) {
		str = "0" + parseInt(d);
	} else {
		str = "" + parseInt(d);
	}
	return str;
}

function Show_cal(sYear, sMonth, sDay) {
	var Months_day = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31)
	var Weekday_name = new Array("일", "월", "화", "수", "목", "금", "토");
	var intThisYear = new Number(), intThisMonth = new Number(), intThisDay = new Number();
	document.all.minical.innerHTML = "";
	datToday = new Date();													// 현재 날짜 설정

	intThisYear		= parseInt(sYear);
	intThisMonth	= parseInt(sMonth, 10);
	intThisDay		= parseInt(sDay);

	if (intThisYear	== 0) intThisYear	= datToday.getFullYear();				// 값이 없을 경우
	if (intThisMonth == 0) intThisMonth	= parseInt(datToday.getMonth()+1);		// 월 값은 실제값 보다 -1 한 값이 되돌려 진다.
	if (intThisDay == 0) intThisDay		= datToday.getDate();
	
	switch(intThisMonth) {
		case 1:
				intPrevYear = intThisYear -1;
				intPrevMonth = 12;
				intNextYear = intThisYear;
				intNextMonth = 2;
				break;
		case 12:
				intPrevYear = intThisYear;
				intPrevMonth = 11;
				intNextYear = intThisYear + 1;
				intNextMonth = 1;
				break;
		default:
				intPrevYear = intThisYear;
				intPrevMonth = parseInt(intThisMonth) - 1;
				intNextYear = intThisYear;
				intNextMonth = parseInt(intThisMonth) + 1;
				break;
	}

	NowThisYear = datToday.getFullYear();										// 현재 년
	NowThisMonth = datToday.getMonth()+1;										// 현재 월
	NowThisDay = datToday.getDate();											// 현재 일
	
	datFirstDay = new Date(intThisYear, intThisMonth-1, 1);						// 현재 달의 1일로 날짜 객체 생성(월은 0부터 11까지의 정수(1월부터 12월))
	intFirstWeekday = datFirstDay.getDay();										// 현재 달 1일의 요일을 구함 (0:일요일, 1:월요일)
	
	intSecondWeekday = intFirstWeekday;
	intThirdWeekday = intFirstWeekday;
	
	datThisDay = new Date(intThisYear, intThisMonth, intThisDay);				// 넘어온 값의 날짜 생성
	intThisWeekday = datThisDay.getDay();										// 넘어온 날짜의 주 요일

	varThisWeekday = Weekday_name[intThisWeekday];								// 현재 요일 저장
	
	intPrintDay = 1																// 달의 시작 일자
	secondPrintDay = 1
	thirdPrintDay = 1
	
	Stop_Flag = 0
	
	if ((intThisYear % 4)==0) {													// 4년마다 1번이면 (사로나누어 떨어지면)
		if ((intThisYear % 100) == 0) {
			if ((intThisYear % 400) == 0) {
				Months_day[2] = 29;
			}
		} else {
			Months_day[2] = 29;
		}
	}
	intLastDay = Months_day[intThisMonth];										// 마지막 일자 구함
	Stop_flag = 0
	
	intPrevYear1 = intPrevYear - 1												// 이전연도
	intNextYear1 = intNextYear + 1												// 다음연도

	Cal_HTML = "<table cellspacing='0' cellpadding='0' border='0' class='calnder' width='121' style='table-layout:fixed;border:1px solid #000000;'>"
			+ "<tr align='middle' valign='top'>"
			+ "<td colspan='7' align='center' height='25px'>"
			+ "<table cellspacing='0' cellpadding='0' border='0' align='center'>"
			+ "<tr>"
			+ "<td class='year'>"+get_Yearinfo(intThisYear,intThisMonth,intThisDay)+"</td>" 
			+ "<td style='padding:0 0 0 3px;width:8px;font-size:6px;'>"
			+ "<span title='NextYear' style='cursor:hand;' onclick='Show_cal("+intNextYear1+","+intThisMonth+","+sDay+");'>▲</span>"
			+ "<span title='PrevYear' style='cursor:hand;' onclick='Show_cal("+intPrevYear1+","+intThisMonth+","+sDay+");'>▼</span>"
			+ "</td>"
			+ "<td class='month'>"+get_Monthinfo(intThisYear,intThisMonth,intThisDay)+"</td>"
			+ "<td style='padding:0 0 0 3px;width:8px;font-size:6px;'>"
			+ "<span title='NextMonth' style='cursor:hand;' onclick='Show_cal("+intNextYear+","+intNextMonth+","+sDay+");'>▲</span>"
			+ "<span title='PrevMonth' style='cursor:hand;' onclick='Show_cal("+intPrevYear+","+intPrevMonth+","+sDay+");'>▼</span>"
			+ "</td></tr></table>"
			+ "</td></tr>"
			+ "<tr class='week'>"
			+ "<td class='week2'>일</td><td>월</td><td>화</td><td>수</td><td>목</td><td>금</td><td class='week3'>토</td></tr>";
			
	for (intLoopWeek=1; intLoopWeek < 7; intLoopWeek++) {						// 주단위 루프 시작, 최대 6주
		Cal_HTML += "<TR ALIGN=RIGHT BGCOLOR=WHITE>"
		for (intLoopDay=1; intLoopDay <= 7; intLoopDay++) {						// 요일단위 루프 시작, 일요일 부터
			if (intThirdWeekday > 0) {											// 첫주 시작일이 1보다 크면
				Cal_HTML += "<TD onClick=doClick();>";
				intThirdWeekday--;
			} else {
				if (thirdPrintDay > intLastDay) {								// 입력 날짝 월말보다 크다면
					Cal_HTML += "<TD onClick=doClick();>";
				} else {														// 입력날짜가 현재월에 해당 되면
					Cal_HTML += "<TD onClick=doClick(); title="+intThisYear+"-"+day2(intThisMonth).toString()+"-"+day2(thirdPrintDay).toString()+" STYLE=\"cursor:Hand;border:1px solid white;";
					if (intThisYear == sYear && intThisMonth == sMonth && thirdPrintDay == sDay) {
						Cal_HTML += "background-color:black; color:white;";
					} else {
					
						switch(intLoopDay) {
							case 1:													// 일요일이면 빨간 색으로
								Cal_HTML += "color:red;"
								break;
							case 7:
								Cal_HTML += "color:blue;"
								break;
							default:
								Cal_HTML += "color:black;"
								break;

						}
					}

					Cal_HTML += "\">"+thirdPrintDay;
					
				}
				thirdPrintDay++;
				
				if (thirdPrintDay > intLastDay) {								// 만약 날짜 값이 월말 값보다 크면 루프문 탈출
					Stop_Flag = 1;
				}
			}
			Cal_HTML += "</TD>";
		}
		Cal_HTML += "</TR>";
		if (Stop_Flag==1) break;
	}
	Cal_HTML += "</TABLE>";

	document.all.minical.innerHTML = Cal_HTML;
}

function get_Yearinfo(year,month,day) {											// 년 정보
	var str = new String();
	
	str = parseInt(year);
	return str;
}


function get_Monthinfo(year,month,day) {										// 월 정보
	var str = new String();
	
	str = parseInt(month);
	return str;
}
// 달력 끝////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// 댓글 시작//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 댓글 입력
function insertBBSTail()
{
	var f = document.frmTail;
	if (!validFieldText(f.tailContents, "내용을"))
	{
		return false;
	}
	if (f.tailContents.length <= 0 || f.tailContents.value == "로그인 하셔야 댓글을 등록할 수 있습니다." ) 
	{
		alert("내용을 입력하세요.");
		f.tailContents.focus();
		f.tailContents.value = "";
		return false;
	}
	loadAjaxXML("/share/proc/TailProc.asp", "Code="+tblCode+"&NoPkid="+NoPkid+"&TailContents="+escape(f.tailContents.value), BBSTailWriteSuccess, AjaxFail);
	return false;
}

function BBSTailWriteSuccess(originalRequest)
{
	var f = document.frmTail;
	alert("등록되었습니다.");
	getBBSTailList()
	f.tailContents.value = "";
}

// 댓글 삭제
function deleteBBSTail(TailPkid)
{
	var Return;

	Return = confirm("삭제 하시겠습니까?");
	if(Return == true)
	{
		loadAjaxXML("/share/proc/TailDelProc.asp", "Code="+tblCode+"&TailPkid="+TailPkid, BBSTailDeleteSuccess, AjaxFail);
	}
}

function BBSTailDeleteSuccess(originalRequest)
{
	alert("삭제되었습니다.");
	getBBSTailList();
}

// 댓글 목록
function getBBSTailList()
{
	loadAjaxXML("/share/proc/BBSTailList.asp", "Code="+tblCode+"&NoPkid="+NoPkid, BBSTailListSuccess, AjaxFail);
}

function BBSTailListSuccess(originalRequest)
{
	var docXML = originalRequest.responseXML;
	var totalCount = 0;

	var innerText = "";

	if(docXML.getElementsByTagName("list").length > 0) 
	{
		innerText = innerText + "<table width=\"638\">\n";
		for (var i = 0; i < docXML.getElementsByTagName("list").length; i++) 
		{
			innerText = innerText + "<tr>\n";
			innerText = innerText + "	<td width=\"100\" height=\"25\">"+docXML.getElementsByTagName("UserID").item(i).firstChild.nodeValue+"</td>\n";
			innerText = innerText + "	<td width=\"548\">"+docXML.getElementsByTagName("TailContents").item(i).firstChild.nodeValue+"&nbsp;&nbsp;&nbsp;<span class=\"F11\">"+docXML.getElementsByTagName("RegDate").item(i).firstChild.nodeValue+"</span><a href=\"javascript:deleteBBSTail('"+docXML.getElementsByTagName("Pkid").item(i).firstChild.nodeValue+"')\" style=\"padding-left:3px;\"><img src=\"/images/icn/icn_x.gif\" width=\"11\" height=\"11\" alt=\"\"></a></td>\n";
			innerText = innerText + "</tr>\n";
			innerText = innerText + "<tr>\n";
			innerText = innerText + "	<td colspan=\"2\" bgcolor=\"#87B3EC\" height=\"1\"></td>\n";
			innerText = innerText + "</tr>\n";
		}

	}
	else
	{
		innerText = innerText + "<table width=\"638\">\n";
		innerText = innerText + "	<tr>\n";
		innerText = innerText + "		<td height=\"24\" align=\"center\">등록된 글이 없습니다.</td>\n";
		innerText = innerText + "	</tr>\n";
	}
		innerText = innerText + "</table>\n";

	document.getElementById("TailList").innerHTML = innerText;
}

// 댓글 페이징
function mkPage(nowPage, totalRecords) 
{
	tableLimit = 5;
	pageList = document.all.paging; // 페이지 목록이 뿌려질 곳 <td>
    pageList.innerHTML = '';

    totalPages = Math.ceil(totalRecords/tableLimit); // 총페이지수


    blockPage = 0; // 1,11,21,...각 블럭 들의 첫페이지 1~10 까지가 한블럭
    blockSize = 10; // 보여줄 페이지 갯수, 이전 x개, 다음 x개

    //블럭의 첫번째 페이지 구하기
    blockPage = Math.floor((nowPage-1)/blockSize);
    blockPage = blockPage * blockSize + 1;


	link=window.location.href
	if(!window.location.search) link+="?"
	else link=link.replace(/&pg=([0-9]*)/,'')

	var pagestr = "";
	var l_iStartPage = "";

    //이전 10개구문
	l_iStartPage = parseInt((nowPage)/blockSize)*blockSize + 1
	if(l_iStartPage == 1 || l_iStartPage == "")
		pagestr += "<img src=\"/images/btn/btn_prev02.gif\" width=\"16\" height=\"17\" hspace=\"2\" align=\"absmiddle\" />";
	else
		pagestr += "<a href=\"javascript:getTailList("+(l_iStartPage-1)+");\"><img src=\"/images/btn/btn_prev02.gif\" width=\"16\" height=\"17\" hspace=\"2\" align=\"absmiddle\" /></a>";

	//이전글
	if(nowPage <= 1)
		pagestr += "<img src=\"/images/btn/btn_prev.gif\" width=\"35\" height=\"17\" align=\"absmiddle\"/>&nbsp;";
	else
		pagestr += "<a href=\"javascript:getTailList("+(nowPage-1)+");\"><img src=\"/images/btn/btn_prev.gif\" width=\"35\" height=\"17\" align=\"absmiddle\"/></a>&nbsp;";

    //페이지리스트, blockPage++
    for(i=1; i<=blockSize; i++, blockPage++)
	{
		// 마지막 페이지와 같다면..
		if(blockPage == totalPages || totalPages ==0)
			i = blockSize+1; // 이러면 다음차례에는 for문을 빠져나가겠져?

		// 블럭페이지와 현재페이지가 같으면 링크없다.
		if(blockPage == nowPage)
		{
			pagestr += "<span class=\"a_o\">" + blockPage + "</span>";
		}
		else
		{
			pagestr += "<a href=\"javascript:getTailList("+blockPage+");\" >";
			pagestr += blockPage;
			pagestr += "</a>";
		}

		// 마지막 페이지와 같다면..
		if(i < blockSize)
			pagestr += " | ";
    }

	l_iPageCount = parseInt(totalRecords/ tableLimit)

	//다음글
	if(nowPage > l_iPageCount)
		pagestr += "&nbsp;<img src=\"/images/btn/btn_next.gif\" width=\"35\" height=\"17\" hspace=\"2\" align=\"absmiddle\"/>";
	else
		pagestr += "&nbsp;<a href=\"javascript:getTailList("+(nowPage+1)+");\"><img src=\"/images/btn/btn_next.gif\" width=\"35\" height=\"17\" hspace=\"2\" align=\"absmiddle\"/></a>";

	//다음 10개구문
	l_iLastPage = l_iStartPage + blockSize - 1
	if(l_iLastPage >= l_iPageCount)
		l_iLastPage = l_iPageCount

	if(l_iLastPage >= l_iPageCount)
		pagestr += "<img src=\"/images/btn/btn_next02.gif\" width=\"16\" height=\"17\" align=\"absmiddle\" />";
	else
		pagestr += "<a href=\"javascript:getTailList("+(l_iStartPage+blockSize)+");\"><img src=\"/images/btn/btn_next02.gif\" width=\"16\" height=\"17\" align=\"absmiddle\" /></a>";

	pageList.insertAdjacentHTML("beforeEnd",pagestr);
	document.getElementById("closebtn").style.visibility = "visible";
}
// 댓글 끝////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


// openPopup /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function openPopup(goUrl, PName, PWidth, PHeight, PScroll)
{
	var winLeft	= (screen.width - PWidth) / 2;
	var winTop	= (screen.height - PHeight) / 2;
	
	window.open(goUrl, PName, 'width='+PWidth+',height='+PHeight+',statusbar=no,scrollbars='+PScroll+',toolbar=no,resizable=no,left='+winLeft+',top='+winTop);
}

// PrintPopup /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function PrintPopup(goUrl, PWidth, PHeight)
{
	var winLeft	= (screen.width - PWidth) / 2;
	var winTop	= (screen.height - PHeight) / 2;
	
	window.open(goUrl, 'popup', 'width='+PWidth+',height='+PHeight+',statusbar=no,scrollbars=yes,toolbar=no,resizable=no,left='+winLeft+',top='+winTop);
}


// 숫자만 입력 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 사용 : <input type='text' name='name' maxLength=10 onKeyDown="JavaScript:onlyNumber(this);">
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////s
function onlyNumber(inbuf)
{
var e = window.event;

	if (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode == 8 || e.keyCode == 46 || e.keyCode >= 35 && e.keyCode <= 39 || e.keyCode == 9)
	{
		if (e.keyCode == 48 || e.keyCode == 96)
		{
//			if (inbuf.value == '')
//				e.returnValue = false;
//			else
				return;
		} else
			return;
	} else
		e.returnValue = false;
}


/*  Function Equivalent to java.net.URLEncoder.encode(String, "UTF-8")
	 Copyright (C) 2002, Cresc Corp.
	 Version: 1.0
 */
 function encodeURL(str){
	 var s0, i, s, u;
	 s0 = "";                // encoded str
	 for (i = 0; i < str.length; i++){   // scan the source
		 s = str.charAt(i);
		 u = str.charCodeAt(i);          // get unicode of the char
		 if (s == " "){s0 += "+";}       // SP should be converted to "+"
		 else {
			 if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
				 s0 = s0 + s;            // don't escape
			 }
			 else {                  // escape
				 if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
					 s = "0"+u.toString(16);
					 s0 += "%"+ s.substr(s.length-2);
				 }
				 else if (u > 0x1fffff){     // quaternary byte format (extended)
					 s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
					 s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
					 s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
					 s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
				 }
				 else if (u > 0x7ff){        // triple byte format
					 s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
					 s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
					 s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
				 }
				 else {                      // double byte format
					 s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
					 s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
				 }
			 }
		 }
	 }
	 return s0;
 }

/*  Function Equivalent to java.net.URLDecoder.decode(String, "UTF-8")
	 Copyright (C) 2002, Cresc Corp.
	 Version: 1.0
 */
 function decodeURL(str){
	 var s0, i, j, s, ss, u, n, f;
	 s0 = "";                // decoded str
	 for (i = 0; i < str.length; i++){   // scan the source str
		 s = str.charAt(i);
		 if (s == "+"){s0 += " ";}       // "+" should be changed to SP
		 else {
			 if (s != "%"){s0 += s;}     // add an unescaped char
			 else{               // escape sequence decoding
				 u = 0;          // unicode of the character
				 f = 1;          // escape flag, zero means end of this sequence
				 while (true) {
					 ss = "";        // local str to parse as int
						 for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse
							 sss = str.charAt(++i);
							 if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
								 ss += sss;      // if hex, add the hex character
							 } else {--i; break;}    // not a hex char., exit the loop
						 }
					 n = parseInt(ss, 16);           // parse the hex str as byte
					 if (n <= 0x7f){u = n; f = 1;}   // single byte format
					 if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format
					 if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format
					 if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)
					 if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits
					 if (f <= 1){break;}         // end of the utf byte sequence
					 if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte
					 else {break;}                   // abnormal, format error
				 }
			 s0 += String.fromCharCode(u);           // add the escaped character
			 }
		 }
	 }
	 return s0;
 }

 
//ID 찾기 체크
function idcheck(obj)
{
	var comp = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
	var str = Trim(obj.value);
	var len = str.length;

	if (len > 0) {
		for(i=0;i<len;i++) {
			if (comp.indexOf(str.substring(i,i+1))<0) {
				alert("허용된 문자가 아닙니다. 다시 입력해 주십시오");
				obj.focus();
				return false;
			}
		}

		if (len <4) {
			alert("아이디는 4자이상입니다.");
			obj.focus();
			return false;
		} else if (len > 12) {
			alert("아이디는 12자이하입니다.");
			obj.focus();
			return false;
		}
	}

	if(str == ""){
		alert("먼저 아이디를 입력해주세요.");
		obj.focus();
		return false;
	}

	return true;
}

//************************ Selection Function
function SelOpt(selObj, pvalue, opt)
{
	if (selObj)
	{
		for (var i=0; i<selObj.options.length; i++)
		{
			var tval;

			if (opt==1)	tval = selObj.options[i].text;
			else		tval = selObj.options[i].value;

			if (tval==pvalue)
			{
				selObj.options[i].selected = true;
				return;
			}
		}
	}
}
function SelRdo(rdoObj, pvalue)
{
	if (rdoObj)
	{
		if (rdoObj.length)
		{
			for (var i=0; i<rdoObj.length; i++)
			{
				if (rdoObj[i].value==pvalue)
				{
					rdoObj[i].checked=true;
					return;
				}
			}
		}
	}
}
function SelChk(chkObj, pvalues)
{
	// Init
	for (var i=0; i<chkObj.length; i++)
	{
		chkObj[i].checked=false;
	}

	//---------------------
	pvalues=Trim(pvalues);
	if (pvalues=="") return;

	var ar_values=pvalues.split(",");

	for (var i=0; i<ar_values.length; i++)
	{
		ar_values[i]=Trim(ar_values[i]);
	}

	if (chkObj)
	{
		if (chkObj.length)
		{
			for (var i=0; i<chkObj.length; i++)
			{
				if (ar_values.indexOf(chkObj[i].value)>-1)
				{
					chkObj[i].checked=true;
				}
			}
		}
		else
		{
			if (ar_values.indexOf(chkObj.value)>-1)
			{
				chkObj.checked=true;
			}
		}
	}
}
Array.prototype.indexOf=function(pVal) {
	for (var i=0; i<this.length; i++)
	{
		if (this[i]==pVal) return i;
	}
	return -1;
}
function InitRdo(oRdo)
{
	if (oRdo)
	{
		if (oRdo.length)
		{
			for (var i=0; i<oRdo.length; i++)
			{
				oRdo[i].checked=false;
			}
		}
		else
		{
			oRdo.checked=false;
		}
	}
}

// 템플스테이 동영상 팝업
function templeinfo_vod_popup111(cont_id) 
{
	var openUrl = "/Share/vod_view.asp?cont_id="+ cont_id;
	window.open(openUrl, "target", "height=460,width=450 status=no, location=no, toolbar=no");
}

// 불교이야기 > 사찰에서는 이렇게 팝업
function vod_popup(Pkid) 
{
	var openUrl = "/Share/vod_view2.asp?Pkid="+ Pkid;
	window.open(openUrl, "target", "height=492,width=780 status=no, location=no, toolbar=no");
}


// 템플스테이란 팝업 띄우기
function templeinfo() {
	WindowOpenCenter("/tsInfo/templestay_info.asp", "templeinfo", 900, 650)
}

// VR 팝업띄우기
function viewVR(mmd_seq) {
	mmdPopup = window.open("http://www.koreatemple.co.kr/common/commonwindow/vrPopup.asp?mmd_seq=" + mmd_seq, "mmdPopup", "left=0,top=0");
	mmdPopup.focus();

}

// 용어사전 팝업
function popDic(num) {
	WindowOpenCenter2("/popup/popup_link_service.asp?chk=1&pkid="+ num, "popdic", 450, 400)
}

// 인물사전 팝업
function popPeople(num) {
	WindowOpenCenter2("/popup/popup_link_service.asp?chk=2&pkid="+ num, "popdic", 450, 400)
}

// body 이미지 크기 조정
function imgresize(wid, hei) {

	for (i=0;i< document.images.length;i++ )
	{
		if (wid > 0)
		{
			if(document.images[i].width > wid) {
				document.images[i].width = wid;
			}
		}

		if (hei > 0)
		{
			if(document.images[i].height > hei) {
				document.images[i].height = hei;
			}
		}
	}	
}

//************************// Selection Function