function addlike(G_Cod,Title,Author) {
	iProc.location.href="/Like/Like_Add.asp?G_Cod="+G_Cod+"&Title="+escape(Title)+"&Author="+escape(Author)+"&flag=1";
}

function adddislike(G_Cod,Title,Author) {
	iProc.location.href="/Like/Like_Add.asp?G_Cod="+G_Cod+"&Title="+escape(Title)+"&Author="+escape(Author)+"&flag=0";
}

function AddLikeChk() {
	var frm = document.frmAddLike;
	var Explain = frm.Explain.value;
	
	if(Explain=="") {
		alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		frm.Explain.focus();
		return;
	}
	if(Explain.length<10) {
		alert("³»¿ëÀÌ ³Ê¹« Âª½À´Ï´Ù. ÃÖ¼Ò 10ÀÚ ÀÌ»óÀ¸·Î ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		frm.Explain.focus();
		return;
	}
	if(Explain.length>300) {
		alert("³»¿ëÀÌ ³Ê¹« ±é´Ï´Ù. 300ÀÚ ÀÌÇÏ·ÎÀÔ·ÂÇØÁÖ¼¼¿ä.");
		frm.Explain.focus();
		return;
	}
	
	frm.action = "/Like/Like_Add_Proc.asp";
	frm.target = "iProc2";
	frm.submit();
}

function OpenLayer(LayerNam,TopMargin) {
	var LayerWidth = eval(LayerNam).style.width;
	LayerWidth = LayerWidth.replace('px','');
	eval(LayerNam).style.left=(document.body.scrollWidth-LayerWidth)/2;
	document.all.WaitLayer.style.height=document.body.scrollHeight;
	if(TopMargin=="") TopMargin=200;
	var tPos=parseInt(TopMargin)+parseInt(document.documentElement.scrollTop);
	eval(LayerNam).style.top=tPos/2;	
	document.all.WaitLayer.style.display="";
	eval(LayerNam).style.display="";
	
	MoreBright(LayerNam,60,tPos-8,tPos);	
	//MoreBright(LayerNam,20);
}

function MoreBright(LayerNam,opacityValue,TopMargin,tPos){
	var oV = opacityValue;
	document.getElementById(LayerNam).filters.alpha.opacity = oV;
	document.getElementById(LayerNam).style.top=TopMargin;
	if(oV >= 100) return;
	oV = oV + 10;
	TopMargin=TopMargin+2;
	if(TopMargin>=tPos) TopMargin=tPos;
	setTimeout("MoreBright('"+LayerNam+"'," + oV + "," + TopMargin + "," + tPos + ")",10);
}

function CloseLayer(LayerNam) {
	document.all.WaitLayer.style.display="none";
	LessBright(LayerNam,100);
}

function LessBright(LayerNam,opacityValue){
	var oV = opacityValue;
	document.getElementById(LayerNam).filters.alpha.opacity = oV;
	if(oV <= 0) {
		eval(LayerNam).style.display="none";
		return;
	}
	oV = oV - 20;
	setTimeout("LessBright('"+LayerNam+"'," + oV + ")",50);
}

function loginenter() {
	if ( event.keyCode == 13 ) {
		LoginGo();
	}
}

function LoginGo() {
	var frm = document.frmLogin;
	
	if(frm.ID.value=="") {
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		frm.ID.focus();
		return;
	}
	if(frm.password.value=="") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		frm.password.focus();
		return;
	}
	
	saveid(frm);
	
	frm.submit();
}

//ÄíÅ° ¼³Á¤
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ÀÏ
  else
    expdate.setTime(expdate.getTime() - 1); // ÄíÅ° »èÁ¦Á¶°Ç
  setCookie("saveid", form.ID.value, expdate);
}
	
//¾ÆÀÌµð °¡Á®¿À±â
function getid(form) {
  form.checksaveid.checked = ((form.ID.value = getCookie("saveid")) != "");
}

//Æ÷Ä¿½º
function setFocus(form) {
	if(form.ID.value=="") {
		form.ID.focus();
	}
	else {
		form.password.focus();
	}
}


//´Ð³×ÀÓ Áßº¹Ã¼Å©
function ChkNicName() {
	var nNicName = document.frmMyInfo.NicName.value;
	var nMemCod = document.frmMyInfo.Mem_Cod.value;
	if(nNicName=='') {
		alert("´Ð³×ÀÓ ÀÔ·ÂÀÌ ºüÁ³½À´Ï´Ù");
		return;
	}
	iProc.location.href="/MyPage/ChkNicName.asp?Mem_Cod="+ nMemCod +"&nNicName="+escape(nNicName);
}

//¾Æ¹ÙÅ¸ ¼±ÅÃµÈ °Í ¸ðµÎ ¾ø¾Ö±â
function Abatarno() {
	if(document.frmMyInfo.chkPhoto.checked) {
		document.frmMyInfo.Abatar[0].checked=false;
		document.frmMyInfo.Abatar[1].checked=false;
		document.frmMyInfo.Abatar[2].checked=false;
		document.frmMyInfo.Abatar[3].checked=false;
		document.frmMyInfo.chkAbatar.checked=false;
	}
}

// TrimÇÔ¼ö
String.prototype.ltrim = function() {
 var re = /\s*((\S+\s*)*)/;
 return this.replace(re, "$1");
}
 
String.prototype.rtrim = function() {
 var re = /((\s*\S+)*)\s*/;
 return this.replace(re, "$1");
}
 
String.prototype.trim = function() {
 return this.ltrim().rtrim();
}

function DetailGo() {
  var G_Cod = document.frmDetailGo.G_Cod.value;
  location.href="/Search/Detail.asp?G_Cod="+G_Cod;
}

// IDÃ£±â
function goFindID() {
  document.getElementById('Layer_login').style.display="none";
  OpenLayer('Layer_FindID',200);
  document.frmfindid.name.focus();
}

// PasswordÃ£±â
function goFindPW() {
  document.getElementById('Layer_login').style.display="none";
  document.getElementById('Layer_FindID').style.display="none";
  OpenLayer('Layer_FindPW',200);
  document.frmfindpw.id.focus();
}

function findidenter() {
	if ( event.keyCode == 13 ) {
		goSearchID();
	}
}

function findpwenter() {
	if ( event.keyCode == 13 ) {
		goSearchPW();
	}
}

function goSearchID() {
	var frm = document.frmfindid;
	if(frm.name.value=='') {
		alert('ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		frm.name.focus();
		return;
	}
	if(frm.ssn1.value=='') {
		alert('ÁÖ¹Î¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		frm.ssn1.focus();
		return;
	}
	if(frm.ssn2.value=='') {
		alert('ÁÖ¹Î¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		frm.ssn2.focus();
		return;
	}
	if(frm.ssn1.value.length!=6 || frm.ssn2.value.length!=7) {
		alert('ÁÖ¹Î¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù');
		return;
	}
	frm.submit();
}

function goSearchPW() {
	var frm = document.frmfindpw;
	if(frm.id.value=='') {
		alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		frm.id.focus();
		return;
	}
	if(frm.name.value=='') {
		alert('ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		frm.name.focus();
		return;
	}
	if(frm.ssn1.value=='') {
		alert('ÁÖ¹Î¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		frm.ssn1.focus();
		return;
	}
	if(frm.ssn2.value=='') {
		alert('ÁÖ¹Î¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		frm.ssn2.focus();
		return;
	}
	if(frm.ssn1.value.length!=6 || frm.ssn2.value.length!=7) {
		alert('ÁÖ¹Î¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù');
		return;
	}
	if(frm.flg[0].checked==false && frm.flg[1].checked==false) {
		alert('È®ÀÎ¹æ¹ýÀ» ¼±ÅÃÇÏ¼¼¿ä.');
		return;
	}
	
	frm.submit();
}


	//Á¤º¸¼öÁ¤
	function MyInfoEdit() {
		var frm = document.frmMyInfo;
		var nNicName = frm.NicName.value;
		var NicName = frm.OriNicName.value;
		var NicChk = frm.NicChk.value.trim();
		var Introduce = frm.Introduce.value.trim();
		var Photo = frm.Photo.value;
			
		if(nNicName=="") {
			alert("´Ð³×ÀÓ ÀÔ·ÂÀÌ ºüÁ³½À´Ï´Ù.");
			frm.NicName.focus();
			return;
		}
		if(NicName!=nNicName && NicChk=="") {
			alert("´Ð³×ÀÓ Áßº¹Ã¼Å©°¡ ºüÁ³½À´Ï´Ù");
			return;
		}
		if(NicName.length>16) {
			alert("³»¿ëÀÌ ³Ê¹« ±é´Ï´Ù. 8ÀÚ ÀÌÇÏ·ÎÀÔ·ÂÇØÁÖ¼¼¿ä.");
			frm.Explain.focus();
			return;
		}
		if(Introduce=="") {
			alert("¼Ò°³ÀÔ·ÂÀÌ ºüÁ³½À´Ï´Ù.");
			frm.Introduce.focus();
			return;
		}
		
		if(NicName=='' && Photo=="" && frm.Abatar[0].checked==false && frm.Abatar[1].checked==false && frm.Abatar[2].checked==false && frm.Abatar[3].checked==false && frm.Abatar[4].checked==false && frm.Abatar[5].checked==false && frm.Abatar[6].checked==false && frm.Abatar[7].checked==false) {
			alert("ÀÌ¹ÌÁö¸¦ ¿Ã¸®°Å³ª ¾Æ¹ÙÅ¸¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
			return;
		}
			
		frm.target="iProc";
		frm.action="/MyPage/MyInfoEdit.asp";
		frm.submit();
			
		CloseLayer('Layer_MyInfo');
	}

	function NoMemo(Up) {
		iProc.location.href="/MyPage/NoMemo.asp?Up="+Up;
		alert('½Ç½Ã°£ ¸Þ¸ðº¸±â ±â´ÉÀº ³ªÀÇ ÇÁ·ÎÇÊ¿¡¼­ ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.');
		//CloseLayer('Layer_Memo');
		location.reload();
	}
	
	function AddMemoChk() {
		var frm = document.frmAddMemo;
		var Explain = frm.Explain.value;
		
		if(Explain=="") {
			alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			frm.Explain.focus();
			return;
		}
		if(Explain.length<5) {
			alert("³»¿ëÀÌ ³Ê¹« Âª½À´Ï´Ù. ÃÖ¼Ò 5ÀÚ ÀÌ»óÀ¸·Î ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			frm.Explain.focus();
			return;
		}
		if(Explain.indexOf('<')>0) {
			alert("¸Þ¸ð¿¡ < ±âÈ£¸¦ ³ÖÀ» ¼ö ¾ø½À´Ï´Ù.");
			frm.Explain.focus();
			return;
		}
		if(Explain.length>100) {
			alert("³»¿ëÀÌ ³Ê¹« ±é´Ï´Ù. 100ÀÚ ÀÌÇÏ·ÎÀÔ·ÂÇØÁÖ¼¼¿ä.");
			frm.Explain.focus();
			return;
		}
	
		frm.action = "/MyPage/AddMemo.asp";
		frm.target = "iProc";
		frm.submit();
	}
	
	// ½ºÅ©·Ñ½Ã¿¡ ½Ç½Ã°£ ¸Þ¸ð ÀÌµ¿
	function MemoGo() {
		if(document.getElementById("Layer_Memo").style.display=="") {
			var ltop=document.documentElement.clientHeight-24+document.documentElement.scrollTop;
			document.all.Layer_Memo.style.top=ltop;
		}
	}