<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
foreach($arResult["ITEMS"] as $cell=>$arElement)
{
	$allowTmst=time()-24*60*60*$arParams['~END_BOOKING'];
	$allowDate=date("Y-m-d",$allowTmst);
	$description="";
	$resTime='';
	
	foreach($arElement["DISPLAY_PROPERTIES"]['TIME_START']["VALUE"] as $key => $date)
  	{	
  			$arrDt = ParseDateTime($date, "DD.MM.YYYY");
  			$newDate=$arrDt['YYYY']."-".$arrDt['MM']."-".$arrDt['DD'];    	  			
  			if($newDate>$allowDate)
  			{
  				$resTime.='<div class="date">'.$arrDt['DD']." ".ToLower(GetMessage("MONTH_".intval($arrDt["MM"])."_S"));
  				if($arElement["DISPLAY_PROPERTIES"]['TIME_END']["VALUE"][$key])
	  			{
	  				$arrDt = ParseDateTime($arElement["DISPLAY_PROPERTIES"]['TIME_END']["VALUE"][$key], "DD.MM.YYYY");
	  				$resTime.=" - ".$arrDt['DD']." ".ToLower(GetMessage("MONTH_".intval($arrDt["MM"])."_S"));
	  			}
	  			$resTime.='</div>';
	  			$description=$arElement["DISPLAY_PROPERTIES"]['TIME_START']['DESCRIPTION'][$key];
	  			if($description!=$arElement["DISPLAY_PROPERTIES"]['TIME_START']['DESCRIPTION'][$key+1] && $description!="")
	  			{
	  				$resTime.='<div class="time">'.$description.'</div>';
	  			}
  			}  			
  	}
  	//echo $resTime;
  	$res = CIBlockSection::GetByID($arElement['IBLOCK_SECTION_ID']);
	if($ar_res = $res->GetNext())
		$arResult["ITEMS"][$cell]['SECTION_CODE']=$ar_res['CODE'];
  	$arResult["ITEMS"][$cell]['COURSE_DATES']=$resTime;
}
?>