function generate_stack_option()
{
    $stack_option = json_decode(stripslashes($_POST['option']), true);
    $stack_config = json_decode(stripslashes($_POST['config']), true);
    $stack_subgroup = json_decode(stripslashes($_POST['subgroup']), true);
    if (!is_array($stack_subgroup)) {
        $stack_subgroup = array();
    }
    $stack_subgroup[] = $_POST['stack_id'];
    // modify option id, toggle, toggle_group
    $extend = '-' . $_POST['stack_id'];
    $stack_config['stack_id'] = $_POST['stack_id'];
    $stack_config['subgroup'] = $stack_subgroup;
    // generate stack option
    $input_tool = new input_tool($stack_option, $stack_config);
    $input_tool->generate_stack_option();
}
"></i> <?php 
    echo $section['name'];
    ?>
</a></li>
					<?php 
}
?>
				</ul>
			</div>
			
			<div id="theme-box-content">
			
				<?php 
foreach ($sections as $section_slug => $section) {
    $section = (include_once THEME_OPTIONS_DIR . '/' . $section_slug . '.php');
    $input_tool = new input_tool($section['options'], $section['config']);
    $input_tool->generate_theme_option();
}
?>
				
			</div>
		
		</div>
		
		
		<div id="theme-box-foot">		
			<input type="button" name="reset" value="<?php 
echo __('Reset Options', 'theme_admin');
?>
" class="button first-click" id="theme-options-reset" />
			<input type="submit" name="reset_options" value="<?php 
 function stack($option)
 {
     $value = $this->value($option);
     if ($value == '') {
         $value = array();
     }
     // workaround for no stack
     // workaround for remove all stacks
     echo '<input type="hidden" name="' . $this->name($option) . '" />';
     echo '<div class="stack_container" id="' . $this->id($option) . '-stack_container" name="' . $this->id($option) . '-stack_container">';
     // Default Page Content Stack
     $page_content_stack = array('stack_id' => 0, 'template_id' => 'page_content');
     if (isset($option['stack_builder']) && $option['stack_builder'] && !in_array($page_content_stack, $value)) {
         $value[] = $page_content_stack;
     }
     $subgroup = array();
     if (isset($this->config['subgroup']) && is_array($this->config['subgroup'])) {
         $subgroup = $this->config['subgroup'];
     }
     $subgroup[] = $option['id'];
     // Empty Stack
     if (count($value) == 0) {
         echo '<div class="dummy-stack"></div>';
     }
     foreach ($value as $stack) {
         if (!is_array($stack)) {
             continue;
         }
         $stack_stack_id = $stack['stack_id'];
         $stack_template_id = $stack['template_id'];
         $stack_template_title = '';
         $stack_config = json_decode(json_encode($this->config), true);
         $stack_option = array();
         // find template
         foreach ($option['templates'] as $template) {
             if ($template['id'] == $stack_template_id) {
                 $stack_option = $template;
                 break;
             }
         }
         // modify option id, toggle, toggle_group
         $extend = '-' . $stack_stack_id;
         $stack_config['stack_id'] = $stack_stack_id;
         $stack_config['subgroup'] = array_merge($subgroup, array($stack_stack_id));
         // generate stack option
         $stack_input_tool = new input_tool($stack_option, $stack_config);
         $stack_input_tool->generate_stack_option($this->saved_data);
     }
     echo '</div>';
     echo '<div class="stack_menu">';
     $show_stack_select_template = count($option['templates']) > 1 ? '' : ' hidden';
     echo '<select class="stack_select_template ' . $show_stack_select_template . '" id="' . $this->id($option) . '-stack_select">';
     foreach ($option['templates'] as $template) {
         if (!in_array($template['id'], array('page_content'))) {
             echo '<option value="' . $template['id'] . '" opt="' . htmlspecialchars(json_encode($template), ENT_QUOTES) . '" conf="' . htmlspecialchars(json_encode($this->config), ENT_QUOTES) . '">' . $template['title'] . '</option>';
         }
     }
     echo '</select>';
     echo '<input class="button stack_add_button" type="button" id="' . $this->id($option) . '-add_button" subgroup="' . htmlspecialchars(json_encode($subgroup), ENT_QUOTES) . '" value="' . $option['stack_button'] . '" />';
     echo '</div>';
 }