function widget($args, $instance)
    {
        extract($args);
        $number = $instance['number'];
        if ($number == '') {
            $number = 5;
        }
        $thumb_size = $instance['thumb_size'];
        if ($thumb_size == '') {
            $thumb_size = 45;
        }
        $order = $instance['order'];
        if ($order == '') {
            $order = "pop";
        }
        $days = $instance['days'];
        if ($days == '') {
            $days = '';
        }
        $pop = '';
        if (array_key_exists('pop', $instance)) {
            $pop = $instance['pop'];
        }
        $latest = '';
        if (array_key_exists('latest', $instance)) {
            $latest = $instance['latest'];
        }
        $comments = '';
        if (array_key_exists('comments', $instance)) {
            $comments = $instance['comments'];
        }
        $tags = '';
        if (array_key_exists('tags', $instance)) {
            $tags = $instance['tags'];
        }
        $post_type = '';
        if (array_key_exists('post_type', $instance)) {
            $post_type = $instance['post_type'];
        }
        ?>


		<?php 
        echo $before_widget;
        ?>

 		<div id="tabs">

            <ul class="wooTabs">
                <?php 
        if ($order == "latest" && !$latest == "on") {
            ?>
<li class="latest"><a href="#tab-latest"><?php 
            _e('Latest', 'woothemes');
            ?>
</a></li>
                <?php 
        } elseif ($order == "comments" && !$comments == "on") {
            ?>
<li class="comments"><a href="#tab-comm"><?php 
            _e('Comments', 'woothemes');
            ?>
</a></li>
                <?php 
        } elseif ($order == "tags" && !$tags == "on") {
            ?>
<li class="tags"><a href="#tab-tags"><?php 
            _e('Tags', 'woothemes');
            ?>
</a></li>
                <?php 
        }
        ?>

                <?php 
        if (!$pop == "on") {
            ?>
<li class="popular"><a href="#tab-pop"><?php 
            _e('Popular', 'woothemes');
            ?>
</a></li><?php 
        }
        ?>

                <?php 
        if ($order != "latest" && !$latest == "on") {
            ?>
<li class="latest"><a href="#tab-latest"><?php 
            _e('Latest', 'woothemes');
            ?>
</a></li><?php 
        }
        ?>

                <?php 
        if ($order != "comments" && !$comments == "on") {
            ?>
<li class="comments"><a href="#tab-comm"><?php 
            _e('Comments', 'woothemes');
            ?>
</a></li><?php 
        }
        ?>

                <?php 
        if ($order != "tags" && !$tags == "on") {
            ?>
<li class="tags"><a href="#tab-tags"><?php 
            _e('Tags', 'woothemes');
            ?>
</a></li><?php 
        }
        ?>

            </ul>

            <div class="clear"></div>

            <div class="boxes box inside">

	            <?php 
        if ($order == "latest" && !$latest == "on") {
            ?>

                <ul id="tab-latest" class="list">
                    <?php 
            if (function_exists('woo_widget_tabs_latest')) {
                woo_widget_tabs_latest($number, $thumb_size, $post_type);
            }
            ?>

                </ul>
	            <?php 
        } elseif ($order == "comments" && !$comments == "on") {
            ?>

				<ul id="tab-comm" class="list">
                    <?php 
            if (function_exists('woo_widget_tabs_comments')) {
                woo_widget_tabs_comments($number, $thumb_size);
            }
            ?>

                </ul>
	            <?php 
        } elseif ($order == "tags" && !$tags == "on") {
            ?>

                <div id="tab-tags" class="list">
                    <?php 
            wp_tag_cloud('smallest=12&largest=20');
            ?>

                </div>
                <?php 
        }
        ?>


                <?php 
        if (!$pop == "on") {
            ?>

                <ul id="tab-pop" class="list">
                    <?php 
            if (function_exists('woo_widget_tabs_popular')) {
                woo_widget_tabs_popular($number, $thumb_size, $days, $post_type);
            }
            ?>

                </ul>
                <?php 
        }
        ?>

                <?php 
        if ($order != "latest" && !$latest == "on") {
            ?>

                <ul id="tab-latest" class="list">
                    <?php 
            if (function_exists('woo_widget_tabs_latest')) {
                woo_widget_tabs_latest($number, $thumb_size, $post_type);
            }
            ?>

                </ul>
                <?php 
        }
        ?>

                <?php 
        if ($order != "comments" && !$comments == "on") {
            ?>

				<ul id="tab-comm" class="list">
                    <?php 
            if (function_exists('woo_widget_tabs_comments')) {
                woo_widget_tabs_comments($number, $thumb_size);
            }
            ?>

                </ul>
                <?php 
        }
        ?>

                <?php 
        if ($order != "tags" && !$tags == "on") {
            ?>

                <div id="tab-tags" class="list">
                    <?php 
            wp_tag_cloud('smallest=12&largest=20');
            ?>

                </div>
                <?php 
        }
        ?>


            </div><!-- /.boxes -->

        </div><!-- /wooTabs -->

        <?php 
        echo $after_widget;
        ?>

         <?php 
    }
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $instance = $this->woo_enforce_defaults($instance);
        extract($instance, EXTR_SKIP);
        echo $before_widget;
        ?>

<div id="tabs">

    <ul class="wooTabs">
    
    <?php 
        if ($order == "latest" && !$latest == "on") {
            ?>
    	<li class="latest"><a href="#tab-latest"><?php 
            _e('Latest', 'woothemes');
            ?>
</a></li>
    <?php 
        } elseif ($order == "comments" && !$comments == "on") {
            ?>
    	<li class="comments"><a href="#tab-comm"><?php 
            _e('Comments', 'woothemes');
            ?>
</a></li>
    <?php 
        } elseif ($order == "tags" && !$tags == "on") {
            ?>
    	<li class="tags"><a href="#tab-tags"><?php 
            _e('Tags', 'woothemes');
            ?>
</a></li>
    <?php 
        }
        ?>
    <?php 
        if (!$pop == "on") {
            ?>
    	<li class="popular"><a href="#tab-pop"><?php 
            _e('Popular', 'woothemes');
            ?>
</a></li><?php 
        }
        ?>
    <?php 
        if ($order != "latest" && !$latest == "on") {
            ?>
    	<li class="latest"><a href="#tab-latest"><?php 
            _e('Latest', 'woothemes');
            ?>
</a></li><?php 
        }
        ?>
    <?php 
        if ($order != "comments" && !$comments == "on") {
            ?>
    	<li class="comments"><a href="#tab-comm"><?php 
            _e('Comments', 'woothemes');
            ?>
</a></li><?php 
        }
        ?>
    <?php 
        if ($order != "tags" && !$tags == "on") {
            ?>
    	<li class="tags"><a href="#tab-tags"><?php 
            _e('Tags', 'woothemes');
            ?>
</a></li>
    <?php 
        }
        ?>
    
    </ul>

    <div class="fix"></div>

    <div class="boxes box inside">

        <?php 
        if ($order == "latest" && !$latest == "on") {
            ?>
        <ul id="tab-latest" class="list">
            <?php 
            if (function_exists('woo_widget_tabs_latest')) {
                woo_widget_tabs_latest($number, $thumb_size);
            }
            ?>
        </ul>
        <?php 
        } elseif ($order == "comments" && !$comments == "on") {
            ?>
		<ul id="tab-comm" class="list">
            <?php 
            if (function_exists('woo_widget_tabs_comments')) {
                woo_widget_tabs_comments($number, $thumb_size);
            }
            ?>
        </ul>
        <?php 
        } elseif ($order == "tags" && !$tags == "on") {
            ?>
        <div id="tab-tags" class="list">
            <?php 
            nxt_tag_cloud('smallest=12&largest=20');
            ?>
        </div>
        <?php 
        }
        ?>

        <?php 
        if (!$pop == "on") {
            ?>
        <ul id="tab-pop" class="list">
            <?php 
            if (function_exists('woo_widget_tabs_popular')) {
                woo_widget_tabs_popular($number, $thumb_size, $days);
            }
            ?>
        </ul>
        <?php 
        }
        ?>
        <?php 
        if ($order != "latest" && !$latest == "on") {
            ?>
        <ul id="tab-latest" class="list">
            <?php 
            if (function_exists('woo_widget_tabs_latest')) {
                woo_widget_tabs_latest($number, $thumb_size);
            }
            ?>
        </ul>
        <?php 
        }
        ?>
        <?php 
        if ($order != "comments" && !$comments == "on") {
            ?>
		<ul id="tab-comm" class="list">
            <?php 
            if (function_exists('woo_widget_tabs_comments')) {
                woo_widget_tabs_comments($number, $thumb_size);
            }
            ?>
        </ul>
        <?php 
        }
        ?>
        <?php 
        if ($order != "tags" && !$tags == "on") {
            ?>
        <div id="tab-tags" class="list">
            <?php 
            nxt_tag_cloud('smallest=12&largest=20');
            ?>
        </div>
        <?php 
        }
        ?>

    </div><!-- /.boxes -->

</div><!-- /wooTabs -->

         <?php 
        echo $after_widget;
    }