function poll() {};
poll.vote = function(element, essenceType, essenceId, mark, markType, idFolder){
	if(!markType)	markType = 0;
  var url = W_AJAX + 'poll.php';
  $.post(url,
    {
      type: "application/x-www-form-urlencoded",
      essenceType: essenceType,
      essenceId:  essenceId,
      mark:  mark,
      markType: markType,
      idFolder: idFolder
    },
    function(responseText) {
      if (navigator.userAgent.indexOf ("Opera") != -1) var arrInfo = eval('(' + responseText + ')'); // 
     else var arrInfo = JSON.parse(responseText);
      if(arrInfo['result'] == 'OK') {
				if(arrInfo['markType'] == 0){
      		var div = $(element).parent("li").parent("ul").parent("div.rigt_rating_box");
      		$(div).find("ul.right_reiting").remove();
      		$(div).find("div.rait").remove();
      		$(div).html($(div).html() + arrInfo['markBlock']);
      		
      		if(essenceType == 6) { 
            $(div).find("a.linkSelectBestAnswer").bind('click', function() {
              if (confirm("Вы действительно готовы выбрать данный ответ в качестве лучшего?")) {
                answers.submitSelectAsBestAJAX(essenceId);
              }
              return false;
            });
      		}
				}
      	//replace
      	if(arrInfo['markType'] == 1) {
      		var li = $(element).parent("li");
	      		$(li).find("strong").html(arrInfo['averageMarkBlock']);
	      		$(li).find("a.plus_tem").remove();
	      		$(li).find("a.minus_tem").remove();
	      		$(li).append(arrInfo['markBlock']);
      	}
      }
      else
        alert(arrInfo['err_text']); 
    });
};
