<?php

if(!isset($_SESSION)) session_start();

include_once("config.php");
include("loginCheckPoint.php");
include_once("authorizations.php");
require_once("demosettings.php");
include_once("parseUtils.php");

$userdetails = fetchUserDetails($_SESSION['username']);

global $AUTH;
$userAuth = $AUTH[$userdetails['Group_ID']];
$username = $userdetails['Username'];	 

$searchPlaces = $_REQUEST["searchPlaces"];
$searchPerson = $_REQUEST["searchPerson"];
$searchOrganization = $_REQUEST["searchOrganization"];

if (strlen($searchPlaces) > 2){
	$tableSearch = "place_object";
	$search = $searchPlaces;
	$searchPerson = "%%";
	$searchOrganization = "%%"; 	
}
if (strlen($searchPerson) > 2){
	$tableSearch = "person_object";
	$search = $searchPerson;
	$searchPlaces = "%%";
	$searchOrganization = "%%"; 	
}
if (strlen($searchOrganization) > 2){	
	$tableSearch = "organizational_identity";
	$search = $searchOrganization;
	$searchPlaces = "%%";
	$searchPerson = "%%"; 	
}
$numberOfLines = 10;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IntuScan Station</title>
<meta http-equiv="Content-Type" content="text/html; Charset=UTF-8"  /> 
<link rel="stylesheet" href="jquery-ui/development-bundle/themes/base/jquery.ui.all.css">
<script src="jquery/jquery.js" type="text/javascript"></script>
<script src="jquery/jquery-ui.custom.js" type="text/javascript"></script>
<script src="jquery/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery-ui/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery-ui/js/jquery-ui-1.8.17.custom.min.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.ui.tabs.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.effects.core.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.effects.blind.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.ui.core.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.ui.widget.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.ui.position.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.ui.autocomplete.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.ui.mouse.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.ui.sortable.js"></script>
<script type="text/javascript" src="dist/plugins/jqplot.pieRenderer.min.js"></script>
<script type="text/javascript" src="dist/plugins/jqplot.donutRenderer.min.js"></script>
<script type="text/javascript" src="js/ivcommon.js"></script>
<script type="text/javascript">


function goTo(iv)
{
	alert(iv);
	//if (confirm('Are you shure you want to delete all data?')){
	//	window.location.href = 'home.php?clean=2';
	window.open('','_blank');		
	//}	
}

function toggle(div) {
	var ele = document.getElementById(div);		
	if(ele.style.display == "block")
    	ele.style.display = "none";
	else
		ele.style.display = "block";
	changeLable();
};

</script>
<link href="style.css" rel="stylesheet" type="text/css" />

</head>

<body>
<div class="main">
 <div class="top-banner">
	 <a href="home.php"><img src="images/intuscan-img.png" style="border:0;"/></a>
	 <p style="padding:0 10px 10px 10px; float:right;"><b>version 1</b></p>
	 <p style="padding:0 10px 10px 10px; float:right;">Hi, <?php echo $_SESSION["username"] ?></p>
	 <p style="padding:0 10px 10px 10px; float:right;"><a style="color:red;" href="logoff.php">logoff</a></p>
 </div>
  <div class="header">
    
    <div class="header_block">
     
      <div class="clr"></div>
      <?php
      	include('general-toolbar.php'); 
      ?>
      <div class="clr"></div>
    </div>
    <div class="clr"></div>
  </div>
  <div class="content">
      <div class="mainbar" id="mainbar" style="width:700px">       
      <div class="article" style="width:680px">
       <form action="senddocEngAjx.php" method="post" id="form1" enctype="multipart/form-data">
		<ol><li>
		<label for="name"><b><h3>Information about <span style="color:red;"> <?php echo $search;?></span></h3></b></label>         
          	<br>
          	<?php          		
          		$mysqli = new mysqli($databaseHost, $databaseUser, $databasePass, $databaseName);          		
          		
          		//countDocument
          		$sql ="SELECT COUNT(id) as i FROM files";
          		$res = $mysqli->query($sql);
          		if(!empty($res)){          		
          			$row = $res->fetch_object();
					$countDocument = $row->i;
          		}
				else 
					$countDocument = "NA";

				
          		$sql = "SELECT DISTINCT docId FROM $tableSearch WHERE $tableSearch.name=\"$search\"";
          		$res = $mysqli->query($sql);
				if(!empty($res)){
					$docIdArr = array();
					while($row = $res->fetch_object()){
						$docIdArr[$row->docId] = $row->docId;
					}
				}							
				
				
				//////////////////
				//
				//		Person
				//
				//////////////////
				if ($searchPerson != "%%"){
					$personId = array();
					$numberOccurrences = 0;
					if ($userdetails['Group_ID'] != 0)
						$wl_name = "DOCEX Entities DB-". $userdetails[Username];
					else
						$wl_name = "DOCEX Entities DB";										
					$wl_res = searchEntity($searchPerson,"","person",$wl_name,"127.0.0.1");							 										
					if (sizeof($wl_res) > 0){
						$pos = array();
						$posId = 0;
						$neg = array();
						$negId = 0;
						$theatre = array();	
						foreach ($wl_res[0][Rules] as $rule){																	
							foreach ($rule as $val){																		
								//get doc number
								$id = $val['person_id'];
								$sql = "SELECT docId,occurrences,anti,pro FROM person_object WHERE (id=$id)";										
								if ($userdetails['Group_ID'] != 0)
									$sql .= " AND username='$userdetails[Username]'";										
								$r = $mysqli->query($sql);
								if (!empty($r))
								{							
									$row = $r->fetch_object();														
									$personId[$val['person_id']] = $row->docId;
									$docIdArr[$row->docId] = $row->docId;	
									$numberOccurrences += $row->occurrences;
									////////////////									
									//	sentiment
									////////////////
									if (strlen($row->pro) > 1){														
										$temp = explode(",", $row->pro);
										$first = true;							
										foreach ($temp as $val){										
											$t = explode("#", $val);
											if (strlen($t[1]) > 1){
												if ($first){	
													$pos[$row->docId] .=  $t[1];																						
													$first = false;									
												}
												else 
													$pos[$row->docId] .=  "," . $t[1];
											}
										}
										$posId++;
									}
									if (strlen($row->anti) > 1){							
										$temp = explode(",", $row->anti);
										$first = true;
										foreach ($temp as $val){
											$t = explode("#", $val);	
											if (strlen($t[1]) > 1){
												if ($first){	
													$neg[$row->docId] .=  $t[1];																						
													$first = false;									
												}
												else 
													$neg[$row->docId] .=  "," . $t[1];
											}
										}
										$negId++;
									}
									//////////////////
									//	theatre
									/////////////////									
									if ($userdetails['Group_ID'] == 0) {
										$sql = "SELECT id,counted_theatre FROM files WHERE id=" . $row->docId;
									}							
									$res = $mysqli->query($sql);
									if(!empty($res)){														
										while($row = $res->fetch_object()){
											if (key_exists($row->id,$docIdArr)){
												$e = explode(";", $row->counted_theatre);
												foreach ($e as $v)
													$theatre[$v] += 1;
											}
										}
									}																		
								}
							}										
						}
					}																																		
				}else{								
					//Number of documents containing
	          		$sql = "SELECT COUNT(docId) as n FROM $tableSearch WHERE $tableSearch.name=\"$search\"";           		        	
	          		$res = $mysqli->query($sql);
					if(!empty($res)){          		
	          			$row = $res->fetch_object();
						$numberDocument = $row->n;
	          		}
					else 
						$numberDocument = "NA";											
					
					//occurrences
					$numberDocument = sizeof($docIdArr);
	          		$sql = "SELECT SUM(occurrences) AS s FROM $tableSearch WHERE $tableSearch.name=\"$search\"";
					$res = $mysqli->query($sql);
					if(!empty($res)){          		
	          			$row = $res->fetch_object();
						$numberOccurrences = $row->s;
	          		}
					else 
						$numberOccurrences = "NA";
					
				}	
				foreach ($docIdArr as $id){
					$sql = "SELECT id,name,ontUrl,occurrences FROM person_object WHERE (docId=$id)";															
					if ($userdetails['Group_ID'] != 0)
						$sql .= " AND username='$userdetails[Username]'";													
					$r = $mysqli->query($sql);
					if (!empty($r))
					{							
						while ($row = $r->fetch_object()){							
							if (!key_exists($row->id, $personId)){
								if (key_exists($row->name,$personCoRef)){
									$personCoRef[$row->name]->occurrences += $row->occurrences;
									$personCoRef[$row->name]->doc += 1;
								}else{
									$obj->doc = 1;
									$obj->occurrences = $row->occurrences;
									$obj->name = $row->name;
									$obj->ontUrl = $row->ontUrl;
									$personCoRef[$row->name] = $obj;
									unset($obj);
								}
							}
						}
					}									
				}	

				$numberDocument = sizeof($docIdArr);	
				arsort($personCoRef);				
				$perKey = array_keys($personCoRef);	
				
				//////////////////
          		//
          		//		Organization
          		//
          		////////////////// 
          						
          		if ($userdetails['Group_ID'] == 0) {
					$sql = "SELECT DISTINCT docId,organizational_identity.name,ontUrl,organizational_identity.occurrences FROM organizational_identity,
								(SELECT DISTINCT occurrences,organizational_identity.name,docId AS s 
								FROM organizational_identity WHERE organizational_identity.name LIKE LOWER(\"$searchOrganization\")) AS p
							WHERE docId = s AND organizational_identity.name <> LOWER(\"$searchOrganization\")";
          		}else{
          			$sql = "SELECT DISTINCT docId,organizational_identity.name,ontUrl,organizational_identity.occurrences FROM organizational_identity,
								(SELECT DISTINCT occurrences,organizational_identity.name,docId AS s 
								FROM organizational_identity WHERE organizational_identity.name LIKE LOWER(\"$searchOrganization\")) AS p
							WHERE docId = s AND organizational_identity.name <> LOWER(\"$searchOrganization\") 
							AND organizational_identity.username='$username'";
          		}         																	
				$res = $mysqli->query($sql);
				if(!empty($res)){
					$org = array();
					$orgId = array();					
					while($row = $res->fetch_object()){
						if (key_exists($row->docId,$docIdArr)){
							if (key_exists($row->name, $org))
								$org[$row->name]->occurrences += $row->occurrences;
							else{
								$obj->occurrences = $row->occurrences;
								$obj->name = $row->name;
								$obj->ontUrl = $row->ontUrl;
								$org[$row->name] = $obj;
								unset($obj);
							}				
							if (key_exists($row->name, $orgId))
								$orgId[$row->name] += 1;
							else							
								$orgId[$row->name] = 1;		
						}														
					}					
				}											
				arsort($org);				
				$orgKey = array_keys($org);				
				
				
				//////////////////
          		//
          		//		places
          		//
          		//////////////////         		          											
			
          		if ($userdetails['Group_ID'] == 0) {
					$sql = "SELECT DISTINCT docId,place_object.name,ontUrl,place_object.occurrences FROM place_object,
								(SELECT DISTINCT occurrences,place_object.name,docId AS s 
								FROM place_object WHERE place_object.name LIKE LOWER(\"$searchPlaces\")) AS p
							WHERE docId = s AND place_object.name <> LOWER(\"$searchPlaces\")";
          		}else{
          			$sql = "SELECT DISTINCT docId,place_object.name,ontUrl,place_object.occurrences FROM place_object,
								(SELECT DISTINCT occurrences,place_object.name,docId AS s 
								FROM place_object WHERE place_object.name LIKE LOWER(\"$searchPlaces\")) AS p
							WHERE docId = s AND place_object.name <> LOWER(\"$searchPlaces\") 
							AND place_object.username='$username'";
          		}  											
          						
				$res = $mysqli->query($sql);
				if(!empty($res)){
					$place = array();
					$placeId = array();					
					while($row = $res->fetch_object()){
						if (key_exists($row->docId,$docIdArr)){
							if (key_exists($row->name, $place))
								$place[$row->name]->occurrences += $row->occurrences;
							else{
								$obj->occurrences = $row->occurrences;
								$obj->name = $row->name;
								$obj->ontUrl = $row->ontUrl;
								$place[$row->name] = $obj;
								unset($obj);
							}				
							if (key_exists($row->name, $placeId))
								$placeId[$row->name] += 1;
							else							
								$placeId[$row->name] = 1;
						}																
					}					
				}					
				arsort($place);				
				$placeKey = array_keys($place);						
				
				
				/////////////////////
				//
				//	sentiment
				//
				/////////////////////
				if ($searchPerson === "%%"){//not person
					if ($userdetails['Group_ID'] == 0) {
						$sql = "SELECT docId,pro,anti FROM $tableSearch WHERE $tableSearch.name 
								LIKE LOWER(\"$search\") AND (pro LIKE(\"http%\") 
								OR anti LIKE(\"http%\"))";
					}else{
						$sql = "SELECT docId,pro,anti FROM $tableSearch WHERE $tableSearch.name 
								LIKE LOWER(\"$search\") AND (pro LIKE(\"http%\") 
								OR anti LIKE(\"http%\")) AND $tableSearch.username='$username'";
					}						
					$res = $mysqli->query($sql);
					if(!empty($res)){
						$pos = array();
						$posId = 0;
						$neg = array();
						$negId = 0;
						while($row = $res->fetch_object()){	
							if (key_exists($row->docId,$docIdArr)){										
								if (strlen($row->pro) > 1){														
									$temp = explode(",", $row->pro);
									$first = true;							
									foreach ($temp as $val){										
										$t = explode("#", $val);
										if (strlen($t[1]) > 1){
											if ($first){	
												$pos[$row->docId] .=  $t[1];																						
												$first = false;									
											}
											else 
												$pos[$row->docId] .=  "," . $t[1];
										}
									}
									$posId++;
								}
								if (strlen($row->anti) > 1){							
									$temp = explode(",", $row->anti);
									$first = true;
									foreach ($temp as $val){
										$t = explode("#", $val);	
										if (strlen($t[1]) > 1){
											if ($first){	
												$neg[$row->docId] .=  $t[1];																						
												$first = false;									
											}
											else 
												$neg[$row->docId] .=  "," . $t[1];
										}
									}
									$negId++;
								}
							}
						}
					}
				}	

				/////////////////////
				//
				//	theatre
				//
				/////////////////////
				if ($searchPerson === "%%"){ //not person
					if ($userdetails['Group_ID'] == 0) {
						$sql = "SELECT id,counted_theatre FROM files,
									(SELECT docId FROM $tableSearch 
									WHERE $tableSearch.name LIKE LOWER(\"$search\")) AS p
								WHERE id=docId";
					}else{
	          			$sql = "SELECT id,counted_theatre FROM files,
									(SELECT docId FROM $tableSearch 
									WHERE $tableSearch.name LIKE LOWER(\"$search\")) AS p
								WHERE id=docId AND files.username='$username'";
	          		} 					
					$res = $mysqli->query($sql);
					if(!empty($res)){
						$theatre = array();					
						while($row = $res->fetch_object()){
							if (key_exists($row->id,$docIdArr)){
								$e = explode(";", $row->counted_theatre);
								foreach ($e as $v)
									$theatre[$v] += 1;
							}
						}
					}
				}
				arsort($theatre);
				$theatreKey = array_keys($theatre);	

								
          		 
				$precentage = intval(($numberDocument/$countDocument)*100);	
          	?>
           	<table style="width:680px">
           		<tr>
           			<td>
           				<b> Number of documents containing</b>
           			</td>
           			<td>
           				 <?php echo "$numberDocument documents ($precentage%)"; ?>
           			</td>
           		</tr>
           		<tr>
           			<td>
           				<b>occurrences</b>
           			</td>
           			<td>
           				<?php echo $numberOccurrences; ?>
           			</td>
           		</tr>
           		<tr>
           			<td>
           				<b>Co-referenced Persons</b>
           			</td>
           			<td>
           				<a id="per" href="#" onclick="toggle(&#34;perDiv&#34;)"><?php echo count($personCoRef) . "</a><b> Co-referenced Presons</b>"; ?>       				
           				
           				<div id="perDiv" style="display:none">
           					<?php
           						$i = 0;
           						while ($i <= $numberOfLines && $i < count($personCoRef)){
									$ontUrl = $personCoRef[$perKey[$i]]->ontUrl;
           							if ($ontUrl <> ""){
           								$ont = explode("#", $ontUrl);
           								//print_r($ont); 
           								
           								$name = urlencode("http://www.intuview.com/ontology#".$ont[1]);
           								
           								//if ontUrl is not a url - assume its the person label
           								$namePair = strpos($ontUrl, "#")? ("qname=" . $name) : ("label=" . $ontUrl);
           								if ($isDemo)
           									echo "<a href=\"http://demo.intuview.com/ivcontentm/editPage.php?displayMode=true&" . $namePair . "\" target=\"_blank\">";
           								else						
											echo "<a href=\"http://$rdfstoreCmHost/ivcontentm/editPage.php?displayMode=true&" . $namePair . "\" target=\"_blank\">";						
           								//echo "<a id=\"place$i\" href=\"#\" onclick=\"goTo(&#34;" . $ont[1] ."&#34;)\">";
           								echo "$perKey[$i] </a> (" . $personCoRef[$perKey[$i]]->occurrences . " in " .$personCoRef[$perKey[$i]]->doc	 . " documents) <br>";
           							}
           							else
           								echo "$perKey[$i] (" . $personCoRef[$perKey[$i]]->occurrences . " in " .$personCoRef[$perKey[$i]]->doc	 . " documents) <br>";
           							$i++;
           						} 
           					?>
           				</div>
           			</td>
           		</tr>
           		<tr>
           			<td>
           				<b>Co-referenced Organizations</b>
           			</td>
           			<td>
           				<a id="org" href="#" onclick="toggle(&#34;orgDiv&#34;)"><?php echo count($org) . "</a><b> Co-referenced Organizations</b>"; ?>       				
           				
           				<div id="orgDiv" style="display:none">
           					<?php
           						$i = 0;
           						while ($i <= $numberOfLines && $i < count($org)){
           							if ($org[$orgKey[$i]]->ontUrl <> ""){
           								$ont = explode("#", $org[$orgKey[$i]]->ontUrl);
           								//print_r($ont); 
           								
           								$name = urlencode("http://www.intuview.com/ontology#".$ont[1]);
           								if ($isDemo)						
											echo "<a href=\"http://demo.intuview.com/ivcontentm/editPage.php?displayMode=true&qname=" . $name . "\" target=\"_blank\">";
										else 
											echo "<a href=\"http://$rdfstoreCmHost/ivcontentm/editPage.php?displayMode=true&qname=" . $name . "\" target=\"_blank\">";																	
           								//echo "<a id=\"place$i\" href=\"#\" onclick=\"goTo(&#34;" . $ont[1] ."&#34;)\">";
           								echo "$orgKey[$i] </a> (" . $org[$orgKey[$i]]->occurrences . " in " .$orgId[$orgKey[$i]] . " documents) <br>";
           							}
           							else
           								echo "$orgKey[$i] (" . $org[$orgKey[$i]]->occurrences . ") <br>";
           							$i++;
           						} 
           					?>
           				</div>
           			</td>
           		</tr>
           		<tr>
           			<td>
           				<b>Co-referenced Places</b>
           			</td>
           			<td> 
           				   
           				<a id="place" href="#" onclick="toggle(&#34;palceDiv&#34;)"><?php echo count($place) . "</a><b> Co-referenced Places</b>"; ?></a>       				           				
           				<div id="palceDiv" style="display:none">
           					<?php
           						$i = 0;
           						while ($i <= $numberOfLines && $i < count($place)){
           							if ($place[$placeKey[$i]]->ontUrl <> ""){
           								$ont = explode("#", $place[$placeKey[$i]]->ontUrl);
           								//print_r($ont); 
           								
           								$name = urlencode("http://www.intuview.com/ontology#".$ont[1]);
           								if ($isDemo)						
											echo "<a href=\"http://demo.intuview.com/ivcontentm/editPage.php?displayMode=true&qname=" . $name . "\" target=\"_blank\">";						
										else 
											echo "<a href=\"http://$rdfstoreCmHost/ivcontentm/editPage.php?displayMode=true&qname=" . $name . "\" target=\"_blank\">";
           								//echo "<a id=\"place$i\" href=\"#\" onclick=\"goTo(&#34;" . $ont[1] ."&#34;)\">";
           								echo "$placeKey[$i] </a> (" . $place[$placeKey[$i]]->occurrences . " in " .$placeId[$placeKey[$i]] . " documents) <br>";
           							}
           							else
           								echo "$placeKey[$i] (" . $place[$placeKey[$i]]->occurrences . ") <br>";
           							$i++;
           						} 
           					?>
           				</div>
           			</td>
           		</tr>
           		<tr>
           			<td>
           				<b>Theaters</b> 
           			</td>
           			<td>
           				<a id="theater" href="#" onclick="toggle(&#34;theaterDiv&#34;)"><?php echo count($theatre) . "</a><b> Theaters</b>"; ?>       				
           				
           				<div id="theaterDiv" style="display:none">
           					<?php
           						$i = 0;
           						while ($i <= $numberOfLines && $i < count($theatre)){   
           							if ($place[$theatreKey[$i]]->ontUrl <> ""){
           								$ont = explode("#", $place[$theatreKey[$i]]->ontUrl);
           								//print_r($ont); 
           								
           								$name = urlencode("http://www.intuview.com/ontology#".$ont[1]);
           								if ($isDemo)						
											echo "<a href=\"http://demo.intuview.com/ivcontentm/editPage.php?displayMode=true&qname=" . $name . "\" target=\"_blank\">";
										else						
											echo "<a href=\"http://$rdfstoreCmHost/ivcontentm/editPage.php?displayMode=true&qname=" . $name . "\" target=\"_blank\">";
           								//echo "<a id=\"place$i\" href=\"#\" onclick=\"goTo(&#34;" . $ont[1] ."&#34;)\">";
           								echo "$theatreKey[$i] </a> (" . $theatre[$theatreKey[$i]] . ") <br>";
           							}else     							           							
           								echo "$theatreKey[$i] (" . $theatre[$theatreKey[$i]] . ") <br>";
           							$i++;
           						} 
           					?>
           				</div>
           			</td>
           		</tr>
           		<tr>
           			<td>
           				<b>Sentiments</b> 
           			</td>
           			<td>
           				
           				<a id="positive" href="#" onclick="toggle(&#34;positiveDiv&#34;)">Positive</a> <?php echo " ($posId "; ?>  documents) <a id="negative" href="#" onclick="toggle(&#34;negativeDiv&#34;)">Negative</a> <?php echo "($negId "; ?> docments)</a>      				           				
           				<div id="positiveDiv" style="display:none">           					
           					<?php
           						echo "<b>Positive-</b>";
           						$first = true;           						           						
           						foreach ($pos as $key => $value) {
           							if ($first){
           								echo "$value (<a href=\"PageLoader.php?PageName=document&dcid=" . $key . "\" target=\"_blank\">" . $key ."</a>)";
           								$first = false;
           							}
           							else   
           								echo "<b>;</b> $value (<a href=\"PageLoader.php?PageName=document&dcid=" . $key . "\" target=\"_blank\">" . $key ."</a>)";         								           								
           						}		
           					?>   
           				</div>  
           				<div id="negativeDiv" style="display:none">           					
           					<?php
           						echo "<b>Negative-</b>";
           						foreach ($neg as $key => $value) {
           							if ($first){
           								echo "$value (<a href=\"PageLoader.php?PageName=document&dcid=" . $key . "\" target=\"_blank\">" . $key ."</a>)";
           								$first = false;
           							}
           							else 
           								echo "<b>;</b> $value (<a href=\"PageLoader.php?PageName=document&dcid=" . $key . "\" target=\"_blank\">" . $key ."</a>)";
           						}		
           					?>   
           				</div>           					      				
           			</td>
           		</tr>
           	</table>
			<br><br>                  
        </form>
		</div>
      
      <div class="sidebar">
        
      </div>
      <div class="clr"></div>
  </div>
  
</div>

</body>

</html>
