<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	#includeTemplate($model.weblog "standard_head")
	<title>$model.weblog.name: Search Results for '$model.term'</title>
	#if ($model.hits > 0)
		<style>
		span.searchword { background-color:yellow; }
		</style>
		<script>
			//<![CDATA[
				searchhi_config = {ignore_site : '$url.absoluteSite'};
			//]]>
		</script>
		<script type="application/x-javascript" src="$url.resource('js/searchhi.js')"></script>
		<script>
			//<![CDATA[
			function loadSearchHighlight() {
				searchhi.highlightWord(document.getElementById("search_results"), '$model.term');
			}
			//]]>
		</script>
   	#end
	<link rel="stylesheet" href='$url.page("custom.css")' />
</head>
<body onload="loadSearchHighlight()">

	<!-- HEADER -->
	<header>
		#includeTemplate($model.weblog "standard_header")
	</header>

	<!-- BODY -->
	<div class="container">
	
		<div class="row">
			<div class="col-lg-12">
				<h1 class="page-header">$model.weblog.name&nbsp;<small>$model.weblog.tagline</small></h1>
			</div>
	  </div>
	  	
	  <div class="row">
	  	
	  	<!-- BODY MAIN-->
	   	<div id="main_content" class="col-lg-8">
			<div class="alert alert-info">
				<p>Search Results for '$model.term'</p>
		        $text.get( "macro.weblog.searchhits", [$model.term, $model.hits])
        	</div>
        	#if ($model.hits > 0)
				<div id="search_results">
					 #showNextPrevSearchControl($pager)
					 #set($pager = $model.getWeblogEntriesPager())
					 #showWeblogEntriesPager($pager)
					 <ul class="pager">
		             	#if($utils.isNotEmpty($pager.prevLink))<li class="previous"><a href="$pager.prevLink">← $pager.prevName</a></li>
	#end
		                #if($utils.isNotEmpty($pager.nextLink))<li class="next"><a href="$pager.nextLink">$pager.nextName →</a></li>#end
		            </ul>
			    </div>
			#else
				 <br />
				 <br />
				 <h3>Sorry, your search returned no results</h3>
				 <br />
				 <br />
			#end
			</div>
			
			<!-- BODY - SIDEBAR -->
			<div id="sidebar_content" class="col-lg-4">
    			<div class="well">
					<h3>Advance Search</h3>
					<p>You can refine your search and/or search within one weblog category</p>
						<form class="form-inline" role="form" method="get" action="$url.search">
							<div class="form-group" role="form">
								<input type="text" id="q" class="form-control" name="q" size="8" maxlength="255" value="$model.term" />
							</div>
							<div class="form-group" role="form">
                                #set( $cats = $model.weblog.getWeblogCategories() )
                                #if(!$site && $cats && $cats.size() > 1)
                                    <select class="form-control" name="cat">
                                        <option value="">$text.get( "macro.searchresults.incategory" )</option>
                                        #foreach( $cat in $cats )
                                        <option #if($cat.name == $model.weblogCategory.name)selected="selected"#end>$cat.name</option>
                                        #end
                                    </select>
                                #end
							</div>
						   	<div class="form-group" role="form">
	   							<button type="submit" class="btn btn-primary">Search</button>
						   	</div>
						</form>	
						$text.get( "macro.weblog.searchgoogle", [$model.term, $url.absoluteSite, $url.site, ${model.weblog.handle}] )
			    </div>
			</div> <!-- close sidebar_content -->
		</div> <!-- /.row -->
	</div> <!-- /.container -->

	<!-- FOOTER -->
	<footer>
		#includeTemplate($model.weblog "standard_footer")
	</footer>
	
</body>
</html>
