<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();
				}
			}
		} );
	} );
        
	function frm_validation()
	{
		if(navigator.appName != "Microsoft Internet Explorer")
			frmname = document.survey;
		
		var tab1 = $("#tabs-1").is(":visible");
		
		if(tab1)
			$("#tab_id").val("1");
		
		if(tab1)
		{
			if(frmname.min_mnu_id.value == "")
			{
				alert("Please Select Main Menu");
				frmname.min_mnu_id.focus();
				return false;
			}
			if(frmname.sub_name.value == "")
			{
				alert("Please Provide Sub Menu Name");
				frmname.sub_name.focus();
				return false;
			}
			if(frmname.sub_title.value == "")
			{
				alert("Please Provide Sub Menu Title");
				frmname.sub_title.focus();
				return false;
			}
			if(frmname.sub_pref.value == "")
			{
				alert("Please Provide Sub Menu Preference");
				frmname.sub_pref.focus();
				return false;
			}
		}
	}
        
        function frm_edit_val(frmval)
        {
            $("#id").val(frmval["sub_mnu_id"]);
            $("#min_mnu_id").val(frmval["min_mnu_id_fk"]);
            $("#sub_name").val(frmval["sub_mnu_name"]);
            $("#sub_title").val(frmval["sub_mnu_desc"]);
            $("#sub_pref").val(frmval["sub_mnu_preference"]);
            
            if(frmval['status'] != 0)
                $("#status").attr("checked", true);
            else
                $("#status").attr("checked", false);
            
            close_frame();
            $("#delete_img").show();
        }
</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;Sub Menu&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">
                <div class="questionrow">
                    <div class="question">Main Menu</div>
                    <div class="answer">
                        <?php
                        $common->dropdown('min_mnu_id', 'min_mnu_desc', 'custom_main_menu', '', 'min_mnu_desc', 'min_mnu_id', $min_mnu_id);
                        ?>
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">Sub Menu Name</div>
                    <div class="answer">
                            <input type="hidden" name="tab_id" id="tab_id" value="" />
                            <input type="hidden" name="id" id="id" value="" />
                            <input type="text" name="sub_name" id="sub_name" value="" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">Sub Menu Title</div>
                    <div class="answer">
                            <input type="text" name="sub_title" id="sub_title" value="" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">Sub Menu Preference</div>
                    <div class="answer">
                            <input type="text" name="sub_pref" id="sub_pref" value="" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">Status</div>
                    <div class="answer">
                            <input type="checkbox" name="status" id="status" value="1" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div style="padding: 5px;" align="center">
                        <input type="submit" name="Submit" value="Submit" />
                    </div>
                </div>
            </div>
        </form>
            </div>
    </div>
</div>