<div class="mainholder ">
	

	    <form id="live-search" action="" class="styled" method="post">
            <span id="w-search" class="block search">
                <span class="block__item block__item_top block__item_bottom search__content">
                    <span class="w-table">
                        <span class="w-table__column w-table__column_wide">
                            <input id="filter" type="search" class="search__form__input" placeholder="Tizimdan izlash">
                        </span>
                        <span class="w-table__column">
                            <input type="submit" value="Izlash" class="search__form__button" id="search__button">
                        </span>
                    </span>
                </span>
            </span>
            <span id="filter-count"></span>
        </form>

        <?php
		foreach ($examlist as $index => $category) 
		{
		if(count($category['exams']) > 0)
		{ 
		?>
		<div class="examlist_wrapper ui-corner-all">
    	<div class="submenu"><a href="/users/imtihon/<?echo $category['catid'];?>"><p class="category"><?=ucfirst($category['catname']);?></p></a></div>
    	<ul class="examlist">
    	<?php
    	foreach ($category['exams'] as $count => $exam) 
    	{
            ?>
    		<li>
    			<a class="ui-corner-all gsm <?php
                if(isset($exam['passed']) && $exam['passed']=='Failed')
                {
                    echo 'yashil';
                }
                else if(!isset($exam['passed']))
                {
                    echo 'davom_etish';
                } else {
                    echo 'yakunlangan';
                }
                ?> bttn-takeexam" href="<?=base_url();?>users/takeexam/<?=$exam['examid'];?>"> 
                <?php
                if(isset($exam['passed']) && $exam['passed']=='Failed')
                {
                    echo 'Qaytadan';
                }
                else if(!isset($exam['passed']))
                {
                    echo 'Boshlash';
                } else {
                    echo 'Topshirilgan';
                }
                ?>


                </a>
                <h3 class="gray">Turi: <?=$exam['examname'];?></h3>
                <?php
                if(isset($exam['percentage']) && isset($exam['passed']))
                {?>
                <a class="test_natija_malumoti" href="<?=base_url();?>users/results_summary/<?=$exam['examid'];?>">
                    <?=$exam['passed']=='Passed' ? 'Yakunlangan' : 'Mandat javobi';?>: <?=$exam['percentage'];?>% 
                </a>
                <?
                }

                ?>

    			</li>
    	<?php
    	}
    	?>
		</ul>
        </div>
		<?php
		}	
		}
        ?>
</div>


<script type="text/javascript">
$(document).ready(function(){
    $("#filter").keyup(function(){
 
        // Retrieve the input field text and reset the count to zero
        var filter = $(this).val(), count = 0;
 
        // Loop through the comment list
        $(".examlist_wrapper").each(function(){
 
            // If the list item does not contain the text phrase fade it out
            if ($(this).text().search(new RegExp(filter, "i")) < 0) {
                $(this).fadeOut();
 
            // Show the list item if the phrase matches and increase the count by 1
            } else {
                $(this).show();
                count++;
            }
        });
 
        // Update the count
        var numberItems = count;
        //$("#filter-count").text("Number of Comments = "+count);
    });
});
</script>