var isCmnLoginIdInputClick = false;

// ·Î±×ÀÎ ÀÔ·Â Ã¢ °ª ÃÊ±âÈ­
function clearInputValue_onFocus(obj){
	if ( isCmnLoginIdInputClick )
	{
	}
	else{
		clearInputValue(obj);

		isCmnLoginIdInputClick = true;
	}
}

// È¸¿ø ·Î±×ÀÎ
function btnLoginSubmit_Click(frm){

	if ( trim(frm.userId.value) == "" ){
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		frm.userId.focus();
		return false;
	}

	if ( trim(frm.userPwd.value) == "" ){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		frm.userPwd.focus();
		return false;
	}

	setSecurity(frm);

	return true;

}

// È¸¿ø ·Î±×¾Æ¿ô Ã³¸®
function doLogout(logoutUrl, rurl){

	top.location.href = logoutUrl + "/?rurl=" + escape(rurl);

}

// ÁÖ¼Ò Ã¢ ¿ÀÇÂ
function openUserAddr(){

	var obj = window.open("/common/zip/index.asp?method=setUserAddr&content=", "memberTotorosaComAddr", "width=500,height=350,status=yes");
	
	try{
		obj.focus();
	}
	catch(e){
	}
}

// ÁÖ¼Ò Ã¢À¸·Î ºÎÅÍ Àü´Þ ¹ÞÀ» ÁÖ¼Ò °ª
function setUserAddr(zipcode, addr1, addr2, addr3, addr4, addr5){

	var frm = document.frm;

	frm.userZipcode.value = zipcode;
	frm.userAddr1.value = addr1;
	frm.userAddr2.value = addr2;
	frm.userAddr3.value = addr3;

	frm.userAddr.value = addr1 + ' ' + addr2 + ' ' + addr3;

}

// ¾ÆÀÌµð ÀúÀå ÄíÅ° ¼³Á¤
function cmnTotorosaComSetSaveUserId(){

}

/***********************************************************************

	Æ÷ÀÎÆ® ·¹ÀÌ¾î ÄÁÆ®·Ñ·¯

***********************************************************************/
function cmnTotorosaComPointLayerControl(layerName,serviceName){
	
	var rosaPointLayer = getObject(layerName);
	var serviceName = serviceName;
	if ( rosaPointLayer.style.display == "" )
	{
		rosaPointLayer.style.display = "none";
	}
	else{
		rosaPointLayer.style.display = "";
	}
	
	if(serviceName == "media.totorosa.com"){
		return;
	}

	/** ¸¶¿ì½º Æ÷ÀÎÆ®¿¡ ·¹ÀÌ¾î ÄÁÆ®·Ñ **/
	var bodyWidth = document.body.offsetWidth;
	var bodyHeight = document.body.offsetHeight - 30;

	var contentWidth = 0;
	var contentHeight = 0;

	var menuGapFromPoint = 20;	
	var x = event.clientX;// + bodyWidth;
	var y = event.clientY;// - contentHeight;

	if(serviceName == "www.totorosa.com"){
		x = x - 195
		y = y - 160
	}
/*
	if ( bodyHeight < (y + contentHeight) ){
		y = bodyHeight - contentHeight;
	}
*/
	bodyHeight = document.body.offsetHeight;

	rosaPointLayer.style.top = y + document.body.scrollTop;
	rosaPointLayer.style.left = x - menuGapFromPoint;

}

/***********************************************************************

	¾ÆÀÌµð ÀúÀå

***********************************************************************/
function setCookie (name, value, expires) {
  document.cookie = name + "=" + escape (value) +
    "; path=/; expires=" + expires.toGMTString();
}

function getCookie(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset)
      // ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
      if (end == -1)
        end = document.cookie.length
      return unescape(document.cookie.substring(offset, end))
    }
  }
  return "";
}

function saveid(form) {
  var expdate = new Date();
  // ±âº»ÀûÀ¸·Î 30ÀÏµ¿¾È ±â¾ïÇÏ°Ô ÇÔ. ÀÏ¼ö¸¦ Á¶ÀýÇÏ·Á¸é * 30¿¡¼­ ¼ýÀÚ¸¦ Á¶ÀýÇÏ¸é µÊ
  if (form.checksaveid.checked)
    expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
	//form.checksaveid[0].checked=true;
  else
    expdate.setTime(expdate.getTime() - 1); // ÄíÅ° »èÁ¦Á¶°Ç
  	setCookie("saveid", form.userId.value, expdate);
}

function getid(form) {
	if (getCookie("saveid")!="")
	{
		form.checksaveid.checked = ((form.userId.value = getCookie("saveid")) != "");
	}
}

function setSecurity(frm) {
	if (frm.checksecurity.checked)
	{
		frm.action = GENERAL_LOGIN_URL;
		var expdate = new Date();
 		expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
		setCookie("security", true, expdate);
	}
	else
	{
		frm.action = GENERAL_LOGIN_URL_NORMAL;
		var expdate = new Date();
 		expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
		setCookie("security", false, expdate);
	}
}

