
	var answer_id = 0;

	function answer_poll(number)
	{
		answer_id = number;
	}

	function complete_poll()
	{
		document.getElementById("ja-mainbody").removeChild(document.getElementById("poll_system"));
	}
	
	function close_poll(form_id)
	{
		AjaxRequest.submit(
			form_id
			,{
			'close':1,
			  'onSuccess':function(req){ complete_poll(); }
			}
		  );
	}
	
	function submit_poll(form_id)
	{
		AjaxRequest.submit(
			form_id
			,{
			'answer':answer_id,
			  'onSuccess':function(req){ complete_poll(); }
			}
		  );
	}
	
	function create_poll( data )
	{
		if ( ! data )
		{
			return false;
		}

		var row = document.createElement("div");
		row.setAttribute("id", "poll_system");
		row.innerHTML = data;
		document.getElementById("ja-mainbody").appendChild(row);	
	}

	function show_poll()
	{
		var url = "http://www.nhanhoa.com/home/poll.php";
		
		AjaxRequest.get(
		{
			'url':''+url+''
			,'onSuccess':function(req){ if ( req.responseText != "" ) { create_poll(req.responseText); } }
		}
		);
	}