function handhistory_live_commendatory() {
	pars = "hhs_id="+$F('handhistory_live_commendatory_hhs_id');
	pars+= "&limit="+$F('handhistory_live_commendatory_limit');
	pars+= "&refresh_time="+$F('handhistory_live_commendatory_refresh_time');

	query = query_parser('poety');
	var myAjax = new Ajax.Updater(
		$('_handhistory_live_commendatory').parentNode,
		query.www+'handhistory/ajax.php?w=handhistory_live_commendatory', 
		{
			method: 'post', 
			parameters: pars,
			evalScripts: true
		});
}

function handhistory_live_hand() {
	pars = "hhs_id="+$F('handhistory_live_hand_hhs_id');
	pars+= "&limit="+$F('handhistory_live_hand_limit');
	pars+= "&refresh_time="+$F('handhistory_live_hand_refresh_time');

	query = query_parser('poety');
	var myAjax = new Ajax.Updater(
		$('_handhistory_live_hand').parentNode,
		//query.www+'handhistory/ajax.php?w=handhistory_live_hand',
		query.www+'hand_history/hh/live/live_hand_'+$F('handhistory_live_hand_hhs_id')+'.html',
		{
			method: 'post', 
			parameters: pars,
			evalScripts: true
		});
}

function handhistory_live_comment() {
	pars = "hhs_id="+$F('handhistory_live_comment_hhs_id');
	pars+= "&limit="+$F('handhistory_live_comment_limit');
	pars+= "&refresh_time="+$F('handhistory_live_comment_refresh_time');

	query = query_parser('poety');
	var myAjax = new Ajax.Updater(
		$('_handhistory_live_comment').parentNode,
		//query.www+'handhistory/ajax.php?w=handhistory_live_comment', 
		query.www+'hand_history/hh/live/live_comment_'+$F('handhistory_live_comment_hhs_id')+'.html',
		{
			method: 'post', 
			parameters: pars,
			evalScripts: true
		});
}

function handhistory_live_comment_add() {
	if($F('live_comment_box')) {
		comment = $F('live_comment_box').replace('\?','#kerdojel#');
		
		pars = "hhs_id="+$F('handhistory_live_comment_hhs_id');
		pars+= "&comment="+comment;

		$('live_comment_box').clear();

		query = query_parser('poety');
		var myAjax = new Ajax.Request(
			query.www+'handhistory/ajax.php?w=handhistory_live_comment_add', 
			{
				method: 'post', 
				parameters: pars,
				onComplete: handhistory_live_comment_add_response
			});
	}
}

function handhistory_live_comment_add_response() {
	handhistory_live_comment();
}

function handhistory_live_view() {
	pars = "hhs_id="+$F('handhistory_live_view_hhs_id');
	pars = "rand="+Math.random();

	//query = query_parser('poety');
	var myAjax = new Ajax.Request(
		//$('_handhistory_live_view').parentNode,
		//query.www+'handhistory/ajax.php?w=handhistory_live_view', 
		//"http://handhistory.hu/"+'handhistory/ajax.php?w=handhistory_live_view', 
		"http://pokerhh.net/hand_history/hh/live/live_"+$F('handhistory_live_view_hhs_id')+".html",
		{
			method: 'get', 
			parameters: pars,
			evalScripts: true,
			onComplete: handhistory_live_view_response
		});
}

function handhistory_live_view_response(originalRequest) {
	if(originalRequest.responseText) {
		$('_handhistory_live_view').parentNode.innerHTML = originalRequest.responseText;
	}
	window.setTimeout("handhistory_live_view()",$F('refresh_time'));
}

function handhistory_live_init() {
	if($('live_comment_send')) {
		$('live_comment_send').onclick = handhistory_live_comment_add.bindAsEventListener(this);
	}
}

Event.observe(window,'load',handhistory_live_init,false);
