var favorite_url = "http://www.hoteltrees.com"   //Áñ°ÜÃ£±â¿¡ Ãß°¡ÇÒ È¨ ÁÖ¼Ò

var favorite_title = "¼¼°è È£ÅÚ¿¹¾à Àü¹®±â¾÷ 'È£ÅÚÆ®¸®½º'"   // Áñ°ÜÃ£±â¿¡ ±â·ÏÇÒ ÀÌ¸§(Á¦¸ñ)À» ±â·Ï

window.status = "Àü ¼¼°è È£ÅÚ¿¹¾à Àü¹®±â¾÷ 'È£ÅÚÆ®¸®½º'";

function add_favorites(){

if (document.all)

window.external.AddFavorite(favorite_url,favorite_title)

}
document.write( '<div id=lyrpre_view style="font-size:9pt; border:1 solid #5256ac; position:absolute; visibility:hidden; display:none; z-Index:10; padding:5px; background-color:#FFFFEC"></div>' );

//ÇÁ·¹ÀÓ ¸®»çÀÌÁî
function sendSize() {
window.clipboardData.setData('Text', document.body.scrollWidth+"|"+document.body.scrollHeight);
}

function URLdecode(temp)
{
	var dec = decodeURI(temp);
	for(i=0; i<3000; i++)
	{
		dec = dec.replace("%3A", ":");
		dec = dec.replace("%3F", "?");
		dec = dec.replace("%40", "@");
		dec = dec.replace("%23", "#");
		dec = dec.replace("%24", "$");
		dec = dec.replace("%26", "&");
		dec = dec.replace("%2C", ",");
		dec = dec.replace("%3D", "=");
		dec = dec.replace("%2F", "/");
		dec = dec.replace("%20"," ");
		dec = dec.replace("%3B",";");
		dec = dec.replace("%2B","+");
		dec = dec.replace("%24","$");
	}
   return dec;
}

function URLencode(temp)
{
   return encodeURIComponent(temp);
}

function mouseOnTD(seq, bool)
{

	var oTD = eval("document.all.listID" + seq);
	var len = oTD.length;
	var borderStyle = "1 solid slategray";

	if (bool){
		for(var i =0; i < len ; i++){
			oTD[i].style.borderTop = borderStyle;
			oTD[i].style.borderBottom = borderStyle;
			oTD[i].style.cursor = "default";
		}

	//	oTD[0].style.borderLeft = borderStyle;
		oTD[0].style.backgroundColor = "#F5F9FE";
		oTD[len-1].style.borderRight = borderStyle;

	}else{

		for(var i =0; i < len; i++){
			oTD[i].style.border = "";
		}
		oTD[0].style.backgroundColor = "";
	}

}

function mouseOnTD2(seq, bool, listNm)
{
	var oTD = eval("document.all." + listNm + seq);
	var len = oTD.length;
	var borderStyle = "1 solid slategray";

	if (bool){
		for(var i =0; i < len ; i++){
			oTD[i].style.borderTop = borderStyle;
			oTD[i].style.borderBottom = borderStyle;
			oTD[i].style.cursor = "default";
		}
		oTD[0].style.backgroundColor = "#F5F9FE";
		oTD[len-1].style.borderRight = borderStyle;

	}else{

		for(var i =0; i < len; i++){
			oTD[i].style.border = "";
		}
		oTD[0].style.backgroundColor = "";
	}
}


function getHnC(sentance)
{
	var gH01 = sentance.split(":>");
	var gH02 = gH01[0].split("<:");
	var gC00 = sentance.split("<:"+gH02[1]+":>");

	var gHnC = new Array();
	if (gH02[1])
		gHnC["header"] = gH02[1].replace(/(^\s*)|(\s*$)/g, "");
	else
		gHnC["header"] = "&nbsp;";
	
	if (gC00[1])
		gHnC["content"] = gC00[1].replace(/(^\s*)|(\s*$)/g, "");
	else
		gHnC["content"] = "&nbsp;";

	return gHnC;
}

// Ãß°¡ ÇÏ±â
function SelectAdd(selTag, aText, aValue) {
    // OPTION Element »ý¼º
    var opt		= document.createElement("OPTION");
    opt.text	= aText;
    opt.value	= aValue;
    // »ý¼ºÇÑ Element¸¦ ÄÞº¸ ¹Ú½º¿¡ Ãß°¡
    selTag.add(opt);
}

// »èÁ¦ ÇÏ±â
function SelectDel(selTag, aValue) {
    // ÄÞº¸ ¹Ú½ºÀÇ Å©±â¸¸Å­ ¹Ýº¹
    for(i = 0; i < selTag.length; i++) {        // °ªÀÌ °°À» °æ¿ì
        if (selTag.options[i].value == aValue)
            selTag.options[i] = null;			// »èÁ¦
    }
}

// ÀüÃ¼ »èÁ¦ ÇÏ±â
function SelectDelAll(selTag) {
    // ÄÞº¸ ¹Ú½º¿¡ ³»¿ëÀÌ ÀÖÀ» ¶§¸¸ ½ÇÇà
    if ( selTag.length > 0 ) {
        for (i =0 ; selTag.options.length ; i++)
        {
            var selCh = selTag.children(0);		// ¸Ç À§¿¡ ÀÖ´Â °Í °®°í ¿À±â
            selTag.removeChild(selCh);
        }
    }
}

// °ø¹é Á¦°Å
function fnTrim(chStr) {
	var nStrCheck; 
	nStrCheck = chStr.indexOf(" ");     
	while (nStrCheck != -1) 
	{ 
		chStr = chStr.replace(" ", ""); 
		nStrCheck  = chStr.indexOf(" "); 
	} 
	return chStr;
}

// ·Î±×ÀÎ
function fnLogin()
{
	var uid = document.getElementById("uid").value;
	var passwd = document.getElementById("passwd").value;
	var nexturl = document.getElementById("nexturl").value;

	if(uid=="")
	{
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("uid").focus();
		return;
	}

/*
	if (uid.indexOf(".")<3) 
	{
		alert("ÀÌ¸ÞÀÏÀÇ Çü½ÄÀÌ Àß¸øµÇ¾ú½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä")
		document.getElementById("uid").value = "";
		document.getElementById("uid").focus();
		return;
	}
*/
	if(passwd=="")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("passwd").focus();
		return;
	}
	if(passwd.length<4)
	{
		alert("ºñ¹Ð¹øÈ£´Â 4~12ÀÚ·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("passwd").focus();
		return;
	}

	var rUrl = '/member/member_ok.asp';
	var Parms  = '?mode=login';
		Parms += '&uid=' + uid;
		Parms += '&passwd=' + passwd;

	var res = dynamic.loadText(rUrl + Parms);

	if(res=="OK")
	{
		if(nexturl)
		{
			location.href=nexturl;
		}else{
			location.href="/index.asp";
		}
		return;
	}else{
		if(res=="OK")
		{
			if(nexturl)
			{
				location.href=nexturl;
			}else{
				location.href="/index.asp";
			}
		}else if(res=="ID_error")
		{
			alert("µî·ÏµÇÁö ¾ÊÀº ¾ÆÀÌµðÀÔ´Ï´Ù.");
			document.getElementById("uid").value = "";
			document.getElementById("uid").focus();
			return;
		}else if(res=="PWD_error")
		{
			alert("ºñ¹Ð¹øÈ£°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.");
			document.getElementById("passwd").value = "";
			document.getElementById("passwd").focus();
			return;
		}else{
			alert(res);
			return;
		}
	}

}

// ºñÈ¸¿ø·Î±×ÀÎ
function fnLogin2()
{
	var email = document.getElementById("email").value;
	var hp = document.getElementById("hp").value;

	if(email=="")
	{
		alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("email").focus();
		return;
	}

	if (email.indexOf(".")<3) 
	{
		alert("ÀÌ¸ÞÀÏÀÇ Çü½ÄÀÌ Àß¸øµÇ¾ú½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä")
		document.getElementById("email").value = "";
		document.getElementById("email").focus();
		return;
	}

	if(hp=="")
	{
		alert("ÈÞ´ëÆù¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("hp").focus();
		return;
	} 
// Ãß°¡ ºÎºÐ 2¶óÀÎ
	document.frmlogin.mode.value= "GUEST_LOGIN";
	frmlogin.submit();
/*  SSL °ü·Ã Á¦°Å ÁÖ¼®Ã³¸®ÇÑ ºÎºÐ
	var rUrl = '/member/member_ok.asp';
	var Parms  = '?mode=GUEST_LOGIN';
		Parms += '&uid=' + email;
		Parms += '&hp=' + hp;

	var res = dynamic.loadText(rUrl + Parms);

	if(res=="OK")
	{
		location.href="/agent/mypage/reservation.asp";
		return;
	}else{
		if(res=="NO")
		{
			alert("¿¹¾à ³»¿ªÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
			document.getElementById("uid").value = "";
			document.getElementById("uid").focus();
			return;
		}else{
			alert(res);
			return;
		}
	}
*/
}

// ·Î±×ÀÎ
function fnLogin3()
{
	var uid = document.getElementById("uid").value;
	var passwd = document.getElementById("passwd").value;

	if(uid=="")
	{
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("uid").focus();
		return;
	}
	if(passwd=="")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("passwd").focus();
		return;
	}
	if(passwd.length<4)
	{
		alert("ºñ¹Ð¹øÈ£´Â 4~12ÀÚ·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.getElementById("passwd").focus();
		return;
	}

	document.frmAdminlogin.mode.value= "TOP_LOGIN";
	frmAdminlogin.submit();

}
// ·Î±×¾Æ¿ô
function fnLogout()
{
	var rUrl = '/member/member_ok.asp';
	var Parms  = '?mode=logout';
	var res = dynamic.loadText(rUrl + Parms);

	if(res=="OK")
	{
		alert("ÀÌ¿ëÇØ ÁÖ¼Å¼­ °¨»çÇÕ´Ï´Ù.");
		location.href="/index.asp";
	}else{
		alert("¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù.");
	}

}

// °ü¸®ÀÚ·Î±×¾Æ¿ô
function fnAdminLogout()
{
	var rUrl = '/member/member_ok.asp';
	var Parms  = '?mode=logout';
	var res = dynamic.loadText(rUrl + Parms);

	if(res=="OK")
	{
		alert("ÀÌ¿ëÇØ ÁÖ¼Å¼­ °¨»çÇÕ´Ï´Ù.");
		location.href="/azone/index.asp";
	}else{
		alert("¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù.");
	}

}

//¿äÀÏ±¸ÇÏ±â
function weekDay(dt)
{
	var weekNumber = dt.getDay();
	var weekName = "";
	switch (weekNumber)
	{
		case 1 : weekName = "¿ù"; break;
		case 2 : weekName = "È­"; break;
		case 3 : weekName = "¼ö"; break;
		case 4 : weekName = "¸ñ"; break;
		case 5 : weekName = "±Ý"; break;
		case 6 : weekName = "Åä"; break;
		default : weekName = "ÀÏ"; break;
	}
	return weekName;
}

//¼ýÀÚ¿¡ , ³Ö±â
function CommaFormatted(amount)
{
	var delimiter = ",";
	var amount = parseInt(amount);
	if(isNaN(amount)) { return ''; }
	var minus = '';
	if(amount < 0) { minus = '-'; }
	amount = Math.abs(amount);
	var n = new String(amount);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	return minus + n
}

//³¯Â¥ ´õÇÏ±â
function addDay(yyyy, mm, dd, pDay) // ³â, ¿ù, ÀÏ, °è»êÇÒ ÀÏÀÚ (³âµµ´Â ¹Ýµå½Ã 4ÀÚ¸®·Î ÀÔ·Â) - ÀÏ´õÇÏ±â
{
var oDate; // ¸®ÅÏÇÒ ³¯Â¥ °´Ã¼ ¼±¾ð

dd = dd*1 + pDay*1; // ³¯Â¥ °è»ê

mm--; // ¿ùÀº 0~11 ÀÌ¹Ç·Î ÇÏ³ª »©ÁØ´Ù

oDate = new Date(yyyy, mm, dd) // °è»êµÈ ³¯Â¥ °´Ã¼ »ý¼º (°´Ã¼¿¡¼­ ÀÚµ¿ °è»ê)

return oDate;
}

// VB ÇÔ¼ö
function dateAdd(interval, num, pDate){
	num = new Number(num);
	pDate = pDate.split('-');
	var dt = new Date(pDate[0], pDate[1] + 1, pDate[2]);
	switch(interval.toLowerCase()){
		case "yyyy": {// year
			dt.setFullYear(dt.getFullYear() + num);
			break;
		}
		case "q": {		// quarter
			dt.setMonth(dt.getMonth() + (num*3));
			break;
		}
		case "m": {		// month
			dt.setMonth(dt.getMonth() + num);
			break;
		}
		case "y":		// day of year
		case "d":		// day
			dt.setMonth(dt.getDate() + num);
			break;
		case "w": {		// weekday
			dt.setDate(dt.getDate() + num);
			break;
		}
		case "ww": {	// week of year
			dt.setDate(dt.getDate() + (num*7));
			break;
		}
		case "h": {		// hour
			dt.setHours(dt.getHours() + num);
			break;
		}
		case "n": {		// minute
			dt.setMinutes(dt.getMinutes() + num);
			break;
		}
		case "s": {		// second
			dt.setSeconds(dt.getSeconds() + num);
			break;
		}
		case "ms": {		// second
			dt.setMilliseconds(dt.getMilliseconds() + num);
			break;
		}
		default: {
			return "i'";
		}
	}
	return dt;
}

function dateDiff(interval, pDate1, pDate2){
	pDate1 = pDate1.split('-');
	var dt1 = new Date(pDate1[0], pDate1[1] + 1, pDate1[2]);
	pDate2 = pDate2.split('-');
	var dt2 = new Date(pDate2[0], pDate2[1] + 1, pDate2[2]);
	
	var iDiffMS = dt2.valueOf() - dt1.valueOf();
	var dtDiff = new Date(iDiffMS);

	var nYears  = dt2.getUTCFullYear() - dt1.getUTCFullYear();
	var nMonths = dt2.getUTCMonth() - dt1.getUTCMonth() + (nYears!=0 ? nYears*12 : 0);
	var nQuarters = parseInt(nMonths/3);
	
	var nMilliseconds = iDiffMS;
	var nSeconds = parseInt(iDiffMS/1000);
	var nMinutes = parseInt(nSeconds/60);
	var nHours = parseInt(nMinutes/60);
	var nDays  = parseInt(nHours/24);
	var nWeeks = parseInt(nDays/7);

	var iDiff = 0;		
	switch(interval.toLowerCase()){
		case "yyyy": return nYears;
		case "q": return nQuarters;
		case "m": return nMonths;
		case "y": 	
		case "d": return nDays;
		case "w": return nDays;
		case "ww":return nWeeks;
		case "h": return nHours;
		case "n": return nMinutes;
		case "s": return nSeconds;
		case "ms":return nMilliseconds;
		default: return "invalid interval: '" + interval + "'";
	}
}

// ³¯Â¥ Â÷ÀÌ ±¸ÇÏ´Â ÇÔ¼ö
function getDayInterval(time1,time2) {
    var date1 = toTimeObject(time1);
    var date2 = toTimeObject(time2);
    var day   = 1000 * 3600 * 24; //24½Ã°£

    return parseInt((date2 - date1) / day, 10);
}

//Time ½ºÆ®¸µÀ» ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼·Î º¯È¯
function toTimeObject(time) { //parseTime(time)
    var year  = time.substr(0,4);
    var month = time.substr(4,2) - 1; // 1¿ù=0,12¿ù=11
    var day   = time.substr(6,2);
    var hour  = time.substr(8,2);
    var min   = time.substr(10,2);

    return new Date(year,month,day,hour,min);
}

//div tag¸¦ select box À§¿¡ º¸ÀÌ°Ô ÇÏ±â
//iframeÀ» ÀÌ¿ëÇÑ´Ù.
function DivSetVisible(popDiv, divIf, state)
{
	var DivRef = document.getElementById(popDiv);
	var IfrRef = document.getElementById(divIf);
	if(state)
	{
		DivRef.style.display = "block";
		IfrRef.style.width = DivRef.offsetWidth;
		IfrRef.style.height = DivRef.offsetHeight;
		IfrRef.style.top = DivRef.style.top;
		IfrRef.style.left = DivRef.style.left;
		IfrRef.style.zIndex = DivRef.style.zIndex - 1;
		IfrRef.style.display = "block";
	}
	else
	{
		DivRef.style.display = "none";
		IfrRef.style.display = "none";
	}
}


function onQty2()
{
	if(frmhtlsearch.rmType2.value=="")
	{
		frmhtlsearch.rmQty2.value = 0;
		frmhtlsearch.rmQty2.disabled=true;
	}else{
		frmhtlsearch.rmQty2.value = 1;
		frmhtlsearch.rmQty2.disabled=false;
	}
}
function onQty3()
{
	if(frmhtlsearch.rmType3.value=="")
	{
		frmhtlsearch.rmQty3.value = 0;
		frmhtlsearch.rmQty3.disabled=true;
	}else{
		frmhtlsearch.rmQty3.disabled=false;
	}
}

function pre_view(str)
{
	if (str == null || str == '') {
		if (lyrpre_view) {
			lyrpre_view.opened = false;
			lyrpre_view.style.visibility = "hidden";
			lyrpre_view.style.display = "none";

			clearTimeout(timeoutid);
		}
	}
	else {
		if (lyrpre_view && event && document) {
			lyrpre_view.innerText = str;			
			lyrpre_view.style.pixelTop = event.clientY + document.body.scrollTop;
			lyrpre_view.style.pixelLeft = event.clientX + document.body.scrollLeft + 10;

			lyrpre_view.opened = true;
			lyrpre_view.style.visibility = 'visible';
			lyrpre_view.style.display = 'block';

			timeoutid = setTimeout('pre_view(null)', 100000);
		}
	}
	return;
}

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);
    }
}

//¸µÅ©ÁÖ¼Ò°¨Ãß±â
function hidestatus() 
{ 
window.status=''
return true 
} 
if 
(document.layers) 
document.captureEvents(Event.mouseover | 
Event.mouseout) 
document.onmouseover=hidestatus 
document.onmouseout=hidestatus 

