function submit_answer(option, lesson_id, question_id, submit_value, my_donated_rice)
{
	//alert(option + " " + lesson_id + " " + question_id + " " + submit_value);		

	$.ajax({
				type: "POST",
				url: "index.php",
				data: "option_value=" + option + "&lesson_id=" + lesson_id + "&question_id=" + question_id + "&submit=yes&my_donated_rice=" + my_donated_rice,
				success: function(msg)
				{
					
					msg = msg.split("<div style = 'display:none'>separator</div>");
					if( ((my_donated_rice+10) % 100 == 0) && my_donated_rice)
					{
						var num = Math.floor(Math.random()*4);
						$('#gallery a#img' + num).click();
					}
					$("#wrapper").html(msg[1]);				
				}
		   });
		   
	
}



function reset_value()
{	
	$.ajax({
				type: "POST",
				url: "index.php",
				data: "reset_cookie=yes",
				success: function(msg)
				{
					//alert(msg);
					$("#wrapper").html(msg);					
				}
		   });

}

function CheckFieldLength(fn,wn,rn,mc) 
{
	var len = fn.value.length;
	if (len > mc) 
	{
		fn.value = fn.value.substring(0,mc);
		len = mc;
	}
	document.getElementById(wn).innerHTML = len;
	document.getElementById(rn).innerHTML = mc - len;
}
			
			
		
