<?php
	$form_name = "Version Log";
	$table_name = "version";
	$primary_key = "id";

	$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : "";
		
	include_once("includes/config.php");
	include_once("includes/common_functions.php");

	$common = new General_Functions();
	$css_class = "x-gray";
	// $common->SetCssClass($css_class);

	$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : "";
	$act_type = isset($_REQUEST['act_type']) ? $_REQUEST['act_type'] : "";
	$cancel_link = $_SERVER['SCRIPT_NAME'].'?page='.$_REQUEST['page'];
	$action = $_SERVER['SCRIPT_NAME']."?page=".$_REQUEST['page']."&mode=submit";
	
	$query = "SELECT * FROM ".$table_name;
	$common->sql->query($query, SQL_ALL, SQL_ASSOC);
	$rec = $common->sql->record;
?>
<script language="javascript">
	var asInitVals = new Array();
	$(document).ready(function() {
		$("#tabs").tabs( {
			"show": function(event, ui) {
				var oTable = $('div.dataTables_scrollBody>table.display', ui.panel).dataTable();
				var tab1 = $("#tabs-1").is(":visible");
				
				if(tab1)
					$("#tab_id").val("1");
				
				if ( oTable.length > 0 ) {
					oTable.fnAdjustColumnSizing();
				}
			}
		} );
	} );
	$(document).ready(function() {
		var oTable = $('#example').dataTable( {
			"bJQueryUI": true,
			"sPaginationType": "full_numbers",
		} );
		
		$("thead input").keyup( function () {
			oTable.fnFilter( this.value, $("thead input").index(this) );
		} );
		
		$("thead input").each( function (i) {
			asInitVals[i] = this.value;
		} );
		
		$("thead input").focus( function () {
			if ( this.className == "search_init" )
			{
				this.className = "";
				this.value = "";
			}
		} );
		
		$("thead input").blur( function (i) {
			if ( this.value == "" )
			{
				this.className = "search_init";
				this.value = asInitVals[$("thead input").index(this)];
			}
		} );
		
		$(".fg-toolbar").height(15);
		$(".dataTables_length").hide();
		$(".dataTables_filter").hide();
		$("#example_info").hide();
		$("#survey").attr("style", "width: auto;");
	} );
</script>
<div style="width: 95%; margin: 0 auto; padding: 10px;">
    <div id="frm_display">
    <div id="tabs">
        <ul>
            <li class="active"><a href="#tabs-1">&nbsp;<?php echo $form_name; ?>&nbsp;</a></li>
        </ul>

        <form class="form" name="survey" id="survey" method="post" action="<?php echo $action; ?>" onsubmit="return frm_validation();">
            <div id="tabs-1">
                <table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">
					<thead>
						<tr>
							<th>Date</th>
							<th>Version</th>
							<th>Description</th>
						</tr>
					</thead>
					<tbody>
                        <?php
                            for($i=0; $i<count($rec); $i++)
                            {
                                echo '<tr>
                                        <td nowrap>'.$rec[$i]['date'].'</td>
                                        <td>'.$rec[$i]['vno'].'.'.$rec[$i]['bno'].'</td>
                                        <td><pre>'.$rec[$i]['description'].'</pre></td>
                                    </tr>';
                            }
                        ?>
                    </tbody>
				</table>
            </div>
        </form>
            </div>
    </div>
</div>