<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
?><div class="vote-container">
<?
	$this->IncludeLangFile("result.php");
if ($_REQUEST["VOTE_ID"] == $arParams["VOTE_ID"] && $_REQUEST["AJAX_POST"] == "Y" && check_bitrix_sessid()):
	ob_start();
endif;
$APPLICATION->IncludeComponent(
	"bitrix:voting.result",
	".default",
	Array(
		"VOTE_ID" => $arResult["VOTE_ID"],
		"PERMISSION" => $arParams["PERMISSION"],
		"SHOW_VOTED_USERS" => "Y",
		"VOTE_ALL_RESULTS" => "N",
		"NEED_SORT" => "N",
		"CACHE_TYPE" => $arParams["CACHE_TYPE"],
		"CACHE_TIME" => $arParams["CACHE_TIME"],
		"ADDITIONAL_CACHE_ID" => $arResult["ADDITIONAL_CACHE_ID"]),
	($this->__component->__parent ? $this->__component->__parent : $component),
	array("HIDE_ICONS" => "Y")
);
if ($arParams["CAN_REVOTE"] == "Y") {
	?><a href="<?=$APPLICATION->GetCurPageParam("view_form=Y", array("VOTE_ID","VOTING_OK","VOTE_SUCCESSFULL", "view_form", "view_result"))?>" <?
		?>onclick="return voteGetForm(this, <?=$arResult["VOTE_ID"]?>);"<?
	?>><?=GetMessage("VOTE_RESUBMIT_BUTTON")?></a><? }
elseif($arParams["CAN_VOTE"] == "Y"){
	?><a href="<?=$APPLICATION->GetCurPageParam("view_form=Y", array("VOTE_ID","VOTING_OK","VOTE_SUCCESSFULL", "view_form", "view_result"))?>" <?
		?>onclick="return voteGetForm(this, <?=$arResult["VOTE_ID"]?>);"<?
		?>><?=GetMessage("VOTE_SUBMIT_BUTTON")?></a><? }


if ($_REQUEST["VOTE_ID"] == $arParams["VOTE_ID"] && $_REQUEST["AJAX_POST"] == "Y" && check_bitrix_sessid()):
	$res = ob_get_clean();
	$APPLICATION->RestartBuffer();
	$res = CUtil::PhpToJSObject($res);
	echo "<script>top.SetVoteAjaxPostTmp(".$res.");top.VoteAjaxResponse();</script>";
	die();

endif;

?></div><?