// JavaScript Document
/*******************************************************************************
	WRITE script
*******************************************************************************/
	function go_page(str){
		document.theForm.action = "poll.asp?exec=list&intPage=" + str;
		document.theForm.submit();		
	}

	function OnRead(str){
		document.theForm.action = "poll.asp?exec=read&strPollCode=" + str + "&intPage=" + SET_intPage;
		document.theForm.submit();
	}

	function OnList(str){
		document.theForm.action = "poll.asp?exec=list&intPage=" + SET_intPage;
		document.theForm.submit();
	}

	function OnSearch(){
		str = document.all['searchCategory'];
		if (str.value == ""){alert("°Ë»öÇÒ Ä«Å×°í¸®¸¦ ¼±ÅÃÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");str.focus();return false;}

		str = document.all['searchWord'];
		if (str.value == ""){alert("°Ë»öÇÒ ´Ü¾î¸¦ ¼±ÅÃÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");str.focus();return false;}

		document.all['POLL_searchCategory'].value = document.all['searchCategory'].value;
		document.all['POLL_searchWord'].value = document.all['searchWord'].value;

		document.theForm.action = "poll.asp?exec=list";
		document.theForm.submit();
		
	}

	function OnSearchCancel(){
		location.href = "poll.asp?exec=list";
	}

	function OnVote(str){
		var obj = document.all['intSelect'];
		var cntBox = obj.length;
		var k = "x";
		for(var i = 0; i <= cntBox-1; i++){
			if (obj[i].checked == true){
				k = i;
			}
		}
	
		if (k == "x"){
			alert("¼³¹®Ç×¸ñÀ» ¼±ÅÃÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			return;
		}
	
		if (SET_bitMember == "True"){
			if (str == ""){
				alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
				return;
			}
		}
	
		document.theForm.intPoll.value = k;
	
		document.theForm.action = "poll.asp?exec=add&voteType=" + SET_EXEC + "&intPage=" + SET_intPage;
		document.theForm.submit();
	}

	function OnComment(){
		str = document.all['strName'];
		if (str.value == ""){alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");str.focus();return false;}

		if (document.all['CMT_strLoginID'].value == "guest"){
			str = document.all['strPwd'];
			if (str.value.length < 4){alert("ºñ¹Ð¹øÈ£¸¦ 4ÀÚ¸® ÀÌ»ó ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");str.focus();return false;}
		}

		str = document.all['strContent'];
		if (str.value == ""){alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");str.focus();return false;}

		document.all['CMT_strName'].value = document.all['strName'].value;
		if (document.all['CMT_strLoginID'].value == "guest"){
			document.all['CMT_strPwd'].value = document.all['strPwd'].value;
		}
		document.all['CMT_strContent'].value = document.all['strContent'].value;

		document.all['CMT_intIcon'].value = "1";

		document.theForm.action = "poll.asp?exec=cmtadd&cmtType=" + SET_EXEC;
		document.theForm.submit();
	}

	function OnCommentDelete(str1, str2){
		document.all['CMT_intNum'].value = str2;
		if (str1 == "1"){
			if (confirm("´ñ±ÛÀ» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")){
				document.theForm.action = "poll.asp?exec=cmtdelete&cmtType=" + SET_EXEC;
				document.theForm.submit();
			}
		}else{
			var obj = document.all['id_comment_pwd'];

			obj.style.posLeft    = event.x - 300 + document.body.scrollLeft;
			obj.style.posTop     = event.y + document.body.scrollTop;
			obj.style.visibility = "visible";

			document.all['cmtDeleteInput'].focus();
		}
	}

	function OnCommentPasswordHide() {
		document.all['CMT_intNum'].value = "";
		document.all['cmtDeleteInput'].value = "";
		document.all['id_comment_pwd'].style.visibility = "hidden";
	}

	function OnCommentDeleteExec(str1){
		str = document.all['cmtDeleteInput'];
		if (str.value == ""){alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");str.focus();return;}
		
		document.all['CMT_strPwd'].value = document.all['cmtDeleteInput'].value;
		document.theForm.action = "poll.asp?exec=cmtdelete&cmtType=" + SET_EXEC;
		document.theForm.submit();
	}
