<?php if(!defined('ABSPATH')) { return; }
/*
 * Build and display the element
 */
	$options = (isset($GLOBALS['options']['accordion']) ? $GLOBALS['options']['accordion'] : null);
	if(empty($options)){
		return;
	}


	$accTitle = '';
	$accStyle = 'default-style';
	if(isset($options['acc_title']) && !empty($options['acc_title'])){
		$accTitle = $options['acc_title'];
	}
	if(isset($options['acc_style'])){
		$accStyle = $options['acc_style'];
	}
?>

	<div class="zn_accordion_element <?php echo $accStyle; ?> <?php echo $this->data['uid']; ?>">
		<?php
			if(! empty($accTitle)){
				echo '<h3>' . $accTitle . '</h3>';
			}

			$acc_id = 1;
			$uniq   = uniqid();

			echo '<div class="th-accordion">';

			if ( isset ( $options['accordion_single'] ) && is_array( $options['accordion_single'] ) ) {
				foreach ( $options['accordion_single'] as $acc )
				{
					$colapsed = '';

					if ( isset( $acc['acc_colapsed'] ) && $acc['acc_colapsed'] == 'yes' ) {
						$colapsed = 'in';
					}

					$sTitle = (isset($acc['acc_single_title']) ? $acc['acc_single_title'] : '');

					echo '<div class="acc-group">';
						echo '<button data-toggle="collapse" data-target="#acc' . $uniq . '' . $acc_id . '" class="collapsed">' . $sTitle;
							// Will only be used by style 4
							echo '<span class="acc-icon"></span>';
						echo '</button>';
						echo '<div id="acc' . $uniq . '' . $acc_id . '" class="collapse ' . $colapsed . '">';
							echo '<div class="content">';

							if( !empty( $acc['acc_single_desc'] ) ) {
								echo wpautop(do_shortcode($acc['acc_single_desc']));
							}

							echo '</div>';
						echo '</div>';
					echo '</div>';
					$acc_id ++;
				}
			}

			echo '</div>';
		?>
	</div>
		<!-- end // accordion texts  -->

