function cpnFrmChk(obj)
{
	if($("#cp1").val()=='') { alert('ÄíÆù¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä'); $("#cp1").focus(); return; }
	if($("#cp2").val()=='') { alert('ÄíÆù¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä'); $("#cp2").focus(); return; }
	if($("#cp3").val()=='') { alert('ÄíÆù¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä'); $("#cp3").focus(); return; }
	if($("#cp4").val()=='') { alert('ÄíÆù¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä'); $("#cp4").focus(); return; }
	
	if(document.getElementById('ant_bot_panel').style.display != 'none')
	{
		if($("#anti_bot_text").val() == '') { alert('±ÛÀÚ¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä~'); $("#anti_bot_text").focus(); return; }
	}

	$.post(
		"/coupon/php/user.coupon.check.php",
		{"cpn1":$("#cp1").val(),"cpn2":$("#cp2").val(),"cpn3":$("#cp3").val(),"cpn4":$("#cp4").val(),"anti_bot_text":$("#anti_bot_text").val()},
		function(data) { 
			var ret = data.split(':');
			if(ret[0] == 'OK')
			{
				if( confirm("ÀüÀÚÂü°í¼­ µî·Ï¿¡ ¼º°øÇÏ¿´½À´Ï´Ù. ÇÐ½ÀÆäÀÌÁö·Î ÀÌµ¿ÇÏ½Ã°Ú½À´Ï±î?"))
				{

					location.href="/index.htm?pcode=EBOOKSTUDY";
				}
				else
				{
					//$('#coupon').close();
					$.modal.close();
				}

			}
			else
			{
				alert(ret[2]);
				if(ret[1]>=5) {
					$("#ant_bot_panel").css("display","block");
					document.getElementById('chkImage').src = "/coupon/php/antiBot.php?rand="+Math.random();
				}
			}
	
		},
		"text" );

/*
*/

}

function lenChk( obj , idx )
{
	if(idx == 4 ) { return; }

	if(obj.value.length == 4)
	{
		next_idx = idx+1;
		$("#cp"+next_idx).focus();
	}
}


function getTryCount()
{
	$.post(
		"/coupon/php/user.coupon.trycount.php",
		function(data) { 
			if(data>=5) { 	
							$("#ant_bot_panel").css("display","block"); 
							document.getElementById('chkImage').src = "/coupon/php/antiBot.php?rand="+Math.random();  
						} 
		},
		"text" );
}