function adinj_side_status_box()
{
    $ops = adinj_options();
    ?>
	<div class="postbox-container" style="width:258px;">
		<div class="metabox-holder">	
		<div class="meta-box-sortables" style="min-height:50px;">
		<div class="postbox">
		<h3 class="hndle"><span><?php 
    echo adinj_get_logo();
    ?>
 Status</span></h3>
		<div class="inside" style="margin:5px;">
			
			<style type="text/css">
			.adinjstatustable td { vertical-align: top; }
			.adinjstatustable td { padding: 2px; }
			</style>
		
			<table border="0" cellpadding="2" class="adinjstatustable">

			
			<tr><td style="text-align:right">
			<b><a href="#global">Ads enabled</a></b>
			</td><td>
			<?php 
    $info = adinj_get_status('global');
    echo adinj_dot($info[0]) . ' ' . $info[1];
    if ($info[0] != 'red') {
        ?>
			</td></tr>

			<tr><td style="text-align:right">
			<b><a href='#global'>Ads on posts</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('older_than_normal');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>

			<tr><td style="text-align:right">
			<b><a href='#global'>Widgets on posts</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('older_than_widgets');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td style="text-align:right">
			<b><a href="#restrictions">Mode</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('mode');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td style="text-align:right">
			<b><a href="#restrictions">Restrictions</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('restrictions');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td style="text-align:right">
			<b><a href='?page=ad-injection&amp;tab=debug#debugging'>Debug mode</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('debugging');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td colspan="2">
			<p></p>
			<b>Ads on/off summary</b><br />
			<table class="adinjstatustable">
			<tr>
				<td></td>
				<td><b>Ads</b></td>
				<td><b>Alt</b></td>
				<td><b>S</b></td>
				<td><b>P</b></td>
				<td><b>H</b></td>
				<td><b>F</b></td>
				<td><b>A</b></td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#topadplacement">Top</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('top', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('top_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#randomadplacement">Random</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('random', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('random_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#bottomadplacement">Bottom</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('bottom', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('bottom_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#footeradplacement">Footer</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('footer', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('footer_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b>Widget</b></td>
				<td></td>
				<td></td>
				<td><?php 
        adinj_print_ad_dot('widget', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b>Template</b></td>
				<td></td>
				<td></td>
				<td><?php 
        adinj_print_ad_dot('template', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'archive');
        ?>
</td>
			</tr>
			</table>
			<p>S=single post | P=single page | H=home | F=front | A=archive
			<!--E=excerpt--></p>
			</td></tr>

			<tr><td>
			</td><td>
			</td></tr>
			<tr><td>
			</td><td>
			<?php 
    }
    ?>
			</td></tr>
			</table>
		</div>
		</div>	
		</div>
		</div>
	</div> 	
	
	<br />
	<?php 
}
function adinj_postbox_start($title, $anchor, $width = '650px')
{
    $ops = adinj_options();
    ?>
	<div class='postbox-container' style='width:<?php 
    echo $width;
    ?>
;float:left; clear:left;'>
	<a name="<?php 
    echo $anchor;
    ?>
"></a>
	<div class="metabox-holder">
	<div class="postbox">
	<input type="submit" style="float:right" class="button-primary" name="adinj_action" value="<?php 
    _e('Save all settings', 'adinj');
    ?>
" />
	
	<?php 
    $anchorclick = $anchor . '_click';
    $anchorupdate = $anchor . '_update';
    $anchorhide = 'ui_' . $anchor . '_hide';
    $hide = $ops[$anchorhide];
    echo <<<HTML
\t<input type='hidden' id='{$anchorhide}' name='{$anchorhide}' value='{$hide}' />
\t<a href="#" onclick='javascript:{$anchorclick}();return false;' style="float:right;display:none" id="toggle-{$anchor}" class="button">Show/Hide</a>
\t<script type="text/javascript">
\t{$anchorupdate}();
\tjQuery('#toggle-{$anchor}').show();
\t
\tfunction {$anchorclick}(){
\t\tjQuery('#{$anchorhide}').val(!jQuery('#{$anchor}-box').is(":hidden"));
\t\tjQuery('#{$anchor}-box').slideToggle(300);
\t\t{$anchorupdate}();
\t\treturn false;
\t}
\t
\tfunction {$anchorupdate}(){
\t\tif (jQuery('#{$anchorhide}').val() == 'false'){
\t\t\tjQuery('#toggle-{$anchor}').text('Hide');
\t\t} else {
\t\t\tjQuery('#toggle-{$anchor}').text('Show');
\t\t}
\t}
\t</script>
HTML;
    ?>
	
	<h3><?php 
    $info = adinj_get_status($anchor);
    echo adinj_dot($info[0]);
    ?>
 <?php 
    echo adinj_get_logo() . ' ' . $title;
    ?>
</h3>
	<?php 
    if ($hide == 'true') {
        ?>
		<div id="<?php 
        echo $anchor;
        ?>
-box" class="hiddenbox">
	<?php 
    } else {
        ?>
		<div id="<?php 
        echo $anchor;
        ?>
-box">
	<?php 
    }
    ?>
	<div class="inside" style="margin:10px">
	<?php 
}
function adinj_postbox_start($title, $anchor, $width = '650px')
{
    $ops = adinj_options();
    ?>
	<div class='postbox-container' style='width:<?php 
    echo $width;
    ?>
;float:left; clear:left;'>
	<div class="metabox-holder">
	<div class="postbox">
	<input type="submit" style="float:right" class="button-primary" name="adinj_action" value="<?php 
    _e('Save all settings', 'adinj');
    ?>
" />
	<div class="<?php 
    echo $anchor;
    ?>
-button"></div>
	<script type="text/javascript">
	jQuery(document).ready(function(){
	jQuery('.<?php 
    echo $anchor;
    ?>
-button').show().before('<a href="#" style="float:right" id="toggle-<?php 
    echo $anchor;
    ?>
" class="button">Show/Hide</a>');
	jQuery('a#toggle-<?php 
    echo $anchor;
    ?>
').click(function() {
		jQuery('#ui_<?php 
    echo $anchor;
    ?>
_hide').val(!jQuery('.<?php 
    echo $anchor;
    ?>
-box').is(":hidden"));
		jQuery('.<?php 
    echo $anchor;
    ?>
-box').slideToggle(1000);
		return false;
		});
	});
	</script>
	<input type='hidden' id='ui_<?php 
    echo $anchor;
    ?>
_hide' name='ui_<?php 
    echo $anchor;
    ?>
_hide' value='<?php 
    echo $ops['ui_' . $anchor . '_hide'];
    ?>
' />
	<h3><?php 
    $info = adinj_get_status($anchor);
    echo adinj_dot($info[0]);
    ?>
 <a name="<?php 
    echo $anchor;
    ?>
"></a><?php 
    echo adinj_get_logo() . ' ' . $title;
    ?>
</h3>
	<?php 
    if ($ops['ui_' . $anchor . '_hide'] == 'true') {
        ?>
	<script type="text/javascript">
        document.write('<style type="text/css" media="screen">#<?php 
        echo $anchor;
        ?>
-box { display: none; }</style>');
	</script>
	<div id="<?php 
        echo $anchor;
        ?>
-box" class="<?php 
        echo $anchor;
        ?>
-box">
	<?php 
    } else {
        ?>
	<div class="<?php 
        echo $anchor;
        ?>
-box">
	<?php 
    }
    ?>
	<div class="inside" style="margin:10px">

	<?php 
}