
function rc_link_vote(link_id, vote)
{
   //$('link_vote_up_' + link_id).onmouseout = null;
   
   var request = new Request.JSON({
      'url' : 'user_link_vote.php',
      'method' : 'post',
      'secure' : false,
      'data' : {
        'task'  : 'dovote_ajax',
        'link_id'  : link_id,
        'vote' : vote
      },
      'onComplete' : function(responseObject, responseText)
      {
        rc_link_vote_result(responseObject);
      }
    });
    request.send();
}

function rc_link_vote_result(result) {
	
  if (result.link_id > 0) {
	
	$('link_vote_point_'+result.link_id).innerHTML = result.link_totalpoints;
		
	var up = $('link_vote_thumb_up_' + result.link_id);
	var dn = $('link_vote_thumb_dn_' + result.link_id);
	//alert(result.link_id);
	if (result.value > 0) {
		up.setProperty('class','link_vote_thumb_up_active');
		dn.setProperty('class','link_vote_thumb_dn_disabled');
	}
	else {
		up.setProperty('class','link_vote_thumb_up_disabled');
		dn.setProperty('class','link_vote_thumb_dn_active');
	}
	
	up.innerHTML = "<span>"+result.text_up+"</span>";
	dn.innerHTML = "<span>"+result.text_down+"</span>";	
  }
}


