<ul>
<?php
include('../../../../config/config.php');
$count= 0;
$key =  $_POST['key'];
$key = addslashes($key);
$sql = mysql_query("select * from books WHERE title LIKE '%$key%' OR isbn_no LIKE '%$key%' OR author LIKE '%$key%' OR subclass_1 LIKE '%$key%' OR subclass_2 LIKE '%$key%' OR subclass_3 LIKE '%$key%' OR subclass_4 LIKE '%$key%'") or die(mysql_error());

    While($row = mysql_fetch_array($sql)) {
	$count++;
	$bookid= $row['accession_no'];
	$title=$row['title'];
	$author=$row['author'];
	$publishername=$row['publisher_name'];
	$placeofpublication=$row['place_publication'];
	$isbn=$row['isbn_no'];
	$copy=$row['copyright_year'];
	$remarks=$row['remarks'];
	$status=$row['status'];
	$copies=$row['copies'];
	if($count<= 10){
?>

	<li>
		<a name="show" id="<?php echo $bookid; ?>">
		<p><span><?php echo $title; ?></span></p>
		<p><span><?php echo $author; ?></span></a>
		(
		<span>
		<?php echo $copies;  ?> 
		<?php
		if($status == "E"){
		echo "Existing";
		}elseif($status=="L"){
		echo "Lost";
		}else{
		echo "Subject For Replacement";
		}
		?></span>
		)</p>
	</li>
	
	<div class="show<?php echo $bookid; ?> display_all resulter">
		<label>Book Information</label><div class="close">X</div>
		<p><label>Title : </label><span><?php echo $title; ?></span></p>
		<p><label>Author : </label><span><?php echo $author; ?></span></p>
		<p><label>Publisher Name : </label><span><?php echo $publishername; ?></span></p>
		<p><label>Place of Publication : </label><span><?php echo $placeofpublication; ?></span></p>
		<p><label>isbn : </label><span><?php echo $isbn; ?></span></p>
		<p><label>Copyright Year : </label><span><?php echo $copy; ?></span></p>
		<p><label>Copies : </label><span><?php echo $copies; ?></span></p>
		<p><span>
		<?php
		if($status == "E"){
		echo "<div class='blue'>Existing</div>";
		}elseif($status=="L"){
		echo "<div class='red'>Lost</div>";
		}else{
		echo "<div class='green'>Subject For Replacement</div>";
		}
		?></span></p>
	
		</div>
<?php }}
if($count==""){
echo "no match Found";
}else{
 ?>
 <li><span class="resu">Total Search Result <?php echo $count; ?> </span><a class="view" href="allresult.php?key=<?php echo $key; ?>">View all Search Result</a></li>
 <?php } ?>
 </ul>
 <script type="text/javascript">
 
				
		$('a[name=show]').click(function(e) {
		
		e.preventDefault();
		$('.display_all').hide();	
		var id = $(this).attr('id');
		
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();

		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		$('#mask').fadeIn(500);	
		$('#mask').fadeTo("slow",0.8);	
	
		var winH = $(window).height();
		var winW = $(window).width();
              
		$(".show" + id).css('top',  winH/2-$(".show" + id).height()/2);
		$(".show" + id).css('left', winW/2-$(".show" + id).width()/2);
		
		$(".show" + id).fadeIn(500); 	
				$.ajax({		type: "POST",			data: ({id: id}),			url:"app/content/search/update.php",			success: function(response) {						}		})						
		});
		
		$(".close").click( function() {
			$("#mask").fadeOut(500);			
			$(".display_all").fadeOut(500);					
		});
 </script>