<div class="span3" style="margin-right:40px;">
	<div class="well" style="width:220px">
	
	<?php
	if(is_admin()) {
		print '<a href="/admin" class="btn btn-large btn-danger">Admin Panel</a><br/><br/>';
	}
	if(is_moderator()) {
		print '<a href="/users/moderator" class="btn btn-medium btn-warning">Moderator Panel</a><br/><br/>';	
	}
	?>

	<h3>Search</h3>
	<form class="form-search navbar-search pull-left" action="<?php echo base_url(); ?>search_movies" method="POST">
        <div class="input-append">
        
        <input type="text" class="appendedInputButton input-medium" name="q" placeholder="Movie/Show Title" style="width:130px;">
        <button type="submit" class="btn" name="sb">Search</button>

        </div>
    </form>
    
    <br/><br/>
	<h3>Watch</h3>
	<ul class="nav">
		<li><a href="<?php echo base_url(); ?>watch/movies"><b class="icon-film"></b> Movies</a></li>
		<li><a href="<?php echo base_url(); ?>watch/tv-shows"><b class="icon-facetime-video"></b> TV Shows</a></li>
	</ul>

    <h3>Genres</h3>
    <ul>
	    <?php 
		if(count(genres_dropdown())) : 
		foreach(genres_dropdown() as $g) : 
			echo '<li> '. anchor('/watch-genres/'.url_title($g->genre), $g->genre) . '</li>' ;
		endforeach; 
		endif; 
		?>
	</ul>
		
	
	<hr/>
	
	
	<h4><b class="icon-comment" style="margin-top:7px;"></b> Recent Comments</h4>

	<?php
	$comments = latest_comments();
	if(count($comments)) : 
	foreach($comments as $cSideBar) :
	?>

	<div class="side-comment">
	<a href="/watch-movies/<?php echo url_title($cSideBar->film_title).'-'.$cSideBar->filmID; ?>"><?php echo $cSideBar->film_title; ?></a><br/>
	<a href="/users/profile/<?php echo url_title($cSideBar->username); ?>" class="movie-sidebar"><?php echo $cSideBar->username; ?></a>: <?php echo substr($cSideBar->comment, 0, 60); ?>...
	</div><!--side-comment-->
	
	<?php endforeach; ?>
	<?php else: ?>
	-no comments-
	<?php endif; ?>

	<?php if(isset($related_movies)) : ?>
	<h4><b class="icon-share-alt" style="margin-top:7px;"></b> Related Movies</h4>

	<?php if(count($related_movies)) : 
	      $i=0;
	      foreach($related_movies as $ftv): 
	      $i++;
	      ?>

		<?php 
		$anchor_type = ($ftv->film_type == 'movie') ? 'watch-movies' : 'watch-tv-shows';
		?>

		<?php $img_prop = array('src' => '/uploads/' . $ftv->thumbnail, 
								'width' => 120, 'height' => 140, 'alt' => htmlspecialchars($ftv->film_title)); ?>

		<div class="small-item-sidebar">
			<a href="<?php echo '/'.$anchor_type.'/'.url_title($ftv->film_title).'-'.$ftv->filmID; ?>">
				<?php echo img($img_prop); ?>
			</a>
			<br/>
			<a href="<?php echo '/'.$anchor_type.'/'.url_title($ftv->film_title).'-'.$ftv->filmID; ?>">
				<?php echo $ftv->film_title . ' ('. date("Y", $ftv->release_date) . ')'; ?>
			</a>
			<br/>
			Rating <?php echo $ftv->rating > 0 ? number_format($ftv->rating, 0).'/5' : 'N/A'; ?>
	    </div>
		<?php if($i%2==0) echo '<br style="clear:both;"/>'; ?>
		<?php endforeach; endif; ?>
	<?php endif; ?>
	
	<div style="clear:both;"></div>
</div>
</div>