<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.name.value == "")
			{
				alert("Please Provide Name");
				frmname.name.focus();
				return false;
			}
			if(frmname.usr_email.value == "")
			{
				alert("Please Provide Email");
				frmname.usr_email.focus();
				return false;
			}
			else
			{
				if(!checkEmail(frmname.usr_email.value))
				{
					alert("Please Provide Valid Email");
					frmname.usr_email.focus();
					return false;
				}
			}
			if(frmname.usr_name.value == "")
			{
				alert("Please Provide User Name");
				frmname.usr_name.focus();
				return false;
			}
			if(frmname.usr_pwd.value == "")
			{
				alert("Please Provide Password");
				frmname.usr_pwd.focus();
				return false;
			}
			else
			{
				if(frmname.usr_pwd.value != frmname.usr_repwd.value)
				{
					alert("Password and Retype Password Must be Same");
					frmname.usr_repwd.focus();
					return false;
				}
			}
		}
	}
        
        function frm_edit_val(frmval)
        {
            $("#id").val(frmval["usr_id"]);
            $("#name").val(frmval["full_name"]);
            $("#usr_email").val(frmval["email"]);
            $("#usr_name").val(frmval["users_name"]);
            $("#usr_pwd").val(frmval["password"]);
            $("#usr_repwd").val(frmval["password"]);
            
            if(frmval['status'] != "N")
                $("#status").attr("checked", true);
            else
                $("#status").attr("checked", false);
			
            $("#usr_name").attr("readonly", true);
            
            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;<?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">
                <div class="questionrow">
                    <div class="question">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="name" id="name" value="" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">Email</div>
                    <div class="answer">
                            <input type="text" name="usr_email" id="usr_email" value="" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">User Name</div>
                    <div class="answer">
                            <input type="text" name="usr_name" id="usr_name" value="" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">Password</div>
                    <div class="answer">
                            <input type="password" name="usr_pwd" id="usr_pwd" value="" />
                    </div>
                </div>
                <div class="clear_form">
                </div>
                <div class="questionrow">
                    <div class="question">Retype Password</div>
                    <div class="answer">
                            <input type="password" name="usr_repwd" id="usr_repwd" 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="Y" />
                    </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>