//room_res
function frmCall() {
    theForm.v_flag.value="first";
    theForm.submit();
}

//¿¹¾à³¯Â¥ ¼±ÅÃ
function setDateCookie(name,value) {
    var todayDate = new Date();
    todayDate.setDate(todayDate.getDate());
     document.cookie = name + "=" + escape( value ) + "; path=/;";
}

//¹Ù¿ìÃ³»õÃ¢
var vouWin; 
function voucherWindow(locationStr, winWidth, winHeight, scrollMode) {
	optionStr = "toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars="+scrollMode+",resizable=0,copyhistory=0,top=1,left=1,width="+winWidth+",height="+winHeight;
    if (vouWin) {
        vouWin.close();
    }
	vouWin = window.open(locationStr,'',optionStr);
    if (vouWin) {
    	vouWin.opener.name = this.name;
    }
}

//»õÃ¢
function mkWin(locationStr, tyary) {
	var newWin; 
  var tyval = tyary.split(","); //tyval = top,left,width,height,scrollbar;
	optionStr = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars="+tyval[4]+",resizable=0,copyhistory=0,top="+tyval[0]+",left="+tyval[1]+",width="+tyval[2]+",height="+tyval[3];
  if (newWin) {
    newWin.close();
  }
	newWin = window.open(locationStr,'',optionStr);
	if (newWin) {
		newWin.opener.name = this.name;
	}
}


function windowOpen(url, name, type) { //ÀÌ¸§À» ÆÄ¶ó¹ÌÅÍ·Î ¹Þ±â¿¡ ¿©·¯ °÷¿¡¼­ »ç¿ë°¡´É
  var tyval = type.split(","); //tyval = top,left,width,height,scrollbar;
	var features = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars="+tyval[4]+",resizable=0,copyhistory=0,top="+tyval[0]+",left="+tyval[1]+",width="+tyval[2]+",height="+tyval[3];
	window.open(url, name, features);
}

//½Ã°£º¸±â
function putsTime() {
  document.all.tTime.innerHTML = "" + mkToday() + " ";
  setTimeout("putsTime()", 6000);
}

//ÀÌ¸ÞÀÏ Çü½Ä
function isEmail(str) {
	var regExpEmail = /^.+\@.+\..+$/
	return regExpEmail.test(str);
}

//·¹ÀÌ¾î º¸±â
function layerShow(layerId) {
	document.getElementById(layerId).style.display = "block";
	
}

//·¹ÀÌ¾î °¨Ãß±â
function layerHide(layerId) {
	document.getElementById(layerId).style.display = "none";
}

//ÄíÅ°È®ÀÎ
function getCookie(name)
{
	var ret = '';
	var pos;
	var end;
	
	if (document.cookie.length > 0)
	{
		pos = document.cookie.indexOf(name + '=');

		if (pos != -1)
		{ 
			pos = pos + name.length + 1;
			end = document.cookie.indexOf(';', pos);
			if (end == -1) end = document.cookie.length;
			ret = unescape(document.cookie.substring(pos, end));
		} 
	}
	
	return ret;
}

//·Î±×ÀÎ¿©ºÎ
function loginStatus()
{
	var loginid = getCookie("user_for_ID");
	if (loginid && loginid != '')
		return true;
	else
		return false;
}

//ajax ±âº»¿¬°áÆÄÀÏ //¿¬°áÀÌ ¿©·¯°³ ÇÊ¿äÇÒ °æ¿ì ¿©·¯¹ø ºÒ·¯¼­ »ç¿ëÇÑ´Ù.
function createRequest() {	
  var request = null;
  try {
    request = new XMLHttpRequest();
  } catch (trymicrosoft) {
    try {
      request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
      try {
        request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        request = null;
      }
    }
  }
  if (request == null) {
    alert("Error creating request object!");
  } else {
    return request;
  }
}

var req
//ajax ¿¬°á ÈÄ POST ¹æ½Ä ÀÏ °æ¿ì »ç¿ëÇÑ´Ù.
function loadXMLDocPost(url, queryString) {
  req = null;
  try {
    req = new XMLHttpRequest();
  } catch (trymicrosoft) {
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        req = null;
      }
    }
  }

	if (req) {
		req.open("POST", url, true);
		req.onreadystatechange = processReqChange;
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; Charset=euc-kr");
		req.send(queryString);
	}
}

//ajax ¿¬°á ÈÄ Get ¹æ½Ä ÀÏ °æ¿ì »ç¿ëÇÑ´Ù.
function loadXMLDocGet(url) {
  req = null;
  try {
    req = new XMLHttpRequest();
  } catch (trymicrosoft) {
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (othermicrosoft) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        req = null;
      }
    }
  }

	if (req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;Charset=euc-kr");
		req.send("");
	}
}

function processReqChange() {
	var debug_mode = false;
	if (req.readyState == 4) {
		if (debug_mode)	{
			 document.write(req.responseText);
		}
    eval(req.responseText);
	}
}


//ÅØ½ºÆ®º¯°æ
function replaceText(el, text) {
  if (el != null) {
    clearText(el);
    var newNode = document.createTextNode(text);
    el.appendChild(newNode);
  }
}

//Å×½ºÆ®»èÁ¦
function clearText(el) {
  if (el != null) {
    if (el.childNodes) {
      for (var i = 0; i < el.childNodes.length; i++) {
        var childNode = el.childNodes[i];
        el.removeChild(childNode);
      }
    }
  }
}