<?php wp_enqueue_script('thememakers_archives', THEMEMAKERS_THEME_URI . '/js/archives.js'); ?>

<div id="tabs-footer" class="widget">    
	
    <script type="text/javascript">
        jQuery(function(){
            jQuery(".widget_archive a").eq(0).trigger('click');
        });
    </script>
	
    <ul class="tabs-nav clearfix">
        <?php if ($instance['show_daily_archive']): ?>
            <li><a href="#tab_daily"><?php _e('Daily', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></li>
        <?php endif; ?>
        <?php if ($instance['show_weekly_archive']): ?>
            <li><a href="#tab_weekly"><?php _e('Weekly', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></li>
        <?php endif; ?>
        <?php if ($instance['show_monthly_archive']): ?>
            <li><a href="#tab_monthly"><?php _e('Monthly', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></li>
        <?php endif; ?>
        <?php if ($instance['show_yearly_archive']): ?>
            <li><a href="#tab_yearly"><?php _e('Yearly', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></li>
        <?php endif; ?>
    </ul><!--/ .tabs-nav -->

    <div class="tabs-container">
		
        <?php if ($instance['show_daily_archive']): ?>
		
            <div class="tab-content" id="tab_daily">
				
                <ul class="custom-formatting">
                    <?php
                    $args = array(
                        'type' => 'daily',
                        'limit'=>$instance['day_limit'],
                        'post_type'=>$instance['post_type'],
                        'show_post_count' => false,
                        'echo' => 1
                    );
                    ThemeMakersHelper::wp_get_archives($args);
					/*
					function example_getarchives_where($where) {
								return str_replace("WHERE post_type = 'post'", "WHERE post_type
						IN ('post', 'games')", $where);
						}
						add_filter('getarchives_where', 'example_getarchives_where'); 
				
					wp_get_archives($args);
					*/
                    ?>
                </ul>
				
            </div><!--/ tab -->
			
        <?php endif; ?>
			
        <?php if ($instance['show_weekly_archive']): ?>
			
            <div class="tab-content" id="tab_weekly">
				
                <ul class="custom-formatting">
                    <?php
                    $args = array(
                        'type' => 'weekly',
						'limit'=>$instance['week_limit'],
                        'post_type'=>$instance['post_type'],
                        'show_post_count' => false,
                        'echo' => 1
                    );
                    ThemeMakersHelper::wp_get_archives($args);
					
                    ?>
                </ul>
				
            </div><!--/ .tab-content -->
			
        <?php endif; ?>

        <?php if ($instance['show_monthly_archive']): ?>
			
            <div class="tab-content" id="tab_monthly">
				
                <ul class="custom-formatting">
                    <?php
                    $args = array(
                        'type' => 'monthly',
						'limit'=>$instance['month_limit'],
                        'post_type'=>$instance['post_type'],
                        'show_post_count' => false,
                        'echo' => 1
                    );
                    ThemeMakersHelper::wp_get_archives($args);
					
                    ?>
                </ul>
				
            </div><!--/ tab -->
			
        <?php endif; ?>
			
        <?php if ($instance['show_yearly_archive']): ?>
			
            <div class="tab-content" id="tab_yearly">
				
                <ul class="custom-formatting">
					
                    <?php
                    $args = array(
                        'type' => 'yearly',
                        'limit'=>$instance['year_limit'],
                        'post_type'=>$instance['post_type'],
                        'show_post_count' => false,
                        'echo' => 1
                    );
                    ThemeMakersHelper::wp_get_archives($args);
					
                    ?>
					
                </ul>
				
            </div><!--/ tab -->
			
        <?php endif; ?>

    </div><!--/ .tabs-container-->

</div><!--/ .tabs-footer-->
