<?php

/**
 * @author krku
 */
function smarty_block_dropDownContainer($params, $content, &$smarty, &$repeat) {
	//Utils::ArrayDisplay($params);
	if (!$repeat) {
		if (isset($params['isClose']) && $params['isClose']) {
			$isClose = true;
		} else {
			$isClose = false;
		}
		if (isset($params['isHidden']) && $params['isHidden']) {
			$isHidden = true;
		} else {
			$isHidden = false;
		}

		if (isset($params['id']) && $params['id']) {
			$id = $params['id'];
		} else {
			$id = md5(uniqid(rand(), true));
		}

		//Utils::ArrayDisplay($id);

		$link = $params['title'];

		$ret = '<div class="mainOptions" ' . ($isHidden ? 'style="display: none;"' : '') . ' ' . (isset($params['idMain']) ? 'id="' . $params['idMain'] . '"' : '') . ' >';
		$ret .= '<h2  class="slidingTab"><a href="#" class="' . ($isClose ? 'expand' : 'colapse') . '" onclick="dropDownChange(this, \'#' . $id . '\'); return false;">' . $link . '</a>' . (isset($params['additionalTitle']) ? ' ' . $params['additionalTitle'] : '') . '</h2>';
		//$ret .= '</div>';

		$ret .= '<div class="optionContent" id="' . $id . '" ' . ($isClose ? 'style="display: none;"' : '') . '>';
		$ret .= $content;
		$ret .= '</div>';
		$ret .= '</div>';

		//$ret .= '<div class="panelContentBottom"></div>';

		return $ret;
	}
}
?>
