
var ext_id;

function submitNewsVote (id, vote,default_txt) {
	var form = $('news_vote_form');
	ext_id = id;
	var commentaire = (form.commentaire.value != default_txt) ? form.commentaire.value : '';
	var url = page;
	var pars = 'page=news&id='+id+'&vote='+vote+'&commentaire='+stammUrlEncode(commentaire);
  var myAjax = new Ajax.Updater(
		{ success: 'news_vote_form', failure: 'news_vote_form' },
    url,
    {
			method: 'get',
			parameters: pars,
			onSuccess: submitNewsVoteOnSuccess
		}
 	);
}

function submitNewsVoteOnSuccess () {
	var url = page;
	var pars = 'page=action&action=AJAX_ARTICLE_VOTES&id='+ext_id;
	var myAjax = new Ajax.Updater(
		{ success: 'news_votes', failure: 'news_votes' },
    url,
    {
			method: 'get',
			parameters: pars
		}
 	);
	Effect.Fade('news_vote_form', { duration: 2.0 });

	var url = page;
	var pars = 'page=action&action=AJAX_ARTICLE_NOTE&id='+ext_id;
	var myAjax = new Ajax.Updater(
		{ success: 'news_note', failure: 'news_note' },
    url,
    {
			method: 'get',
			parameters: pars
		}
 	);

}


function newsVoteOnFocus (obj,default_txt)  {
	if (obj.value == default_txt)
		obj.value = '';
}
function newsVoteOnBlur (obj,default_txt)  {
	if (obj.value == '')
		obj.value = default_txt;
}




