<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
//include("../../php_crud/my_class_for_web.php");
include("../../php_crud/my_class.php");
$obj = new my_class();

$branch_id = $_SESSION['LOGIN_BRANCH'];
$session_input='';

$table_name="_student_admission_master a LEFT JOIN _student_admission_details b ON a._id=b._master_id";
$column="DISTINCT a._session";
$where_cond="a._status='A'";
$result=$obj->View_column_details_By_Cond($table_name,$column,$where_cond);
$session_input=$result['_session'];
$_SESSION['ADMISSION_SESSION'] = $session_input;

?>
<style>


    input.upload-button,input[type="file"] {width: 76%;height: 100%;background: #3A87AD;border: medium none;color: white;}
    .table-bordered th, .table-bordered td {border-left: 1px dotted rgb(221, 221, 221);border-style: dotted;border-bottom: 1px;border-color: rgb(221, 221, 221);border-right: 1px dotted rgb(221, 221, 221);}
    .widget-main.no-padding .table-bordered th:first-child, .widget-main.padding-0 .table-bordered th:first-child, .widget-main.no-padding .table-bordered td:first-child, .widget-main.padding-0 .table-bordered td:first-child {border-left-width: 0; }
    .hr-18, .hr18 {margin: 6px 0px; }
    .table-bordered {border-style: dotted;}
    .form-label{float: left;width: 156px;margin-top: 4px; }
    .widget-main.no-padding .table, .widget-main.padding-0 .table { border-top: 1px solid #E5E5E5;}
    .list-striped > li:nth-child(2n+1) {background-color: rgb(238, 238, 238);}
    .list-striped.pricing-table-header > li:nth-child(2n) { background-color: #FFF;}
    input[type="text"], .input-append, .input-prepend{margin-bottom: 1px;}
	.widget-main.no-padding .table, .widget-main.padding-0 .table {  border: 1px dotted #DDD;}
	.btn {padding: 0px 11px;}
	img#avatar{width:180; height:200px; }
	.alert {margin-bottom: 3px;}
	.profile-user-info {margin: 0px 0px;}
	.profile-info-name{width: 158px;}
	.profile-info-value {margin-left: 172px;}
	.label-large {padding: 3px 8px 12px;}
	.label-large.arrowed::before, .label-large.arrowed-in::before {
    	border-width: 12px 9px !important;
	}
	
</style>

<script src="module/admission/js/admission_form.js" type="text/javascript"></script>
<script src="asset/theme/js/jquery.gritter.min.js"></script>
<div class="row-fluid " id="admission-container">
 <form id="ac-form">
    <div class="span12" >
		<div class="widget-header widget-header-large" style="border: 0;   background:none">
            <h3 class=" lighter pull-left position-relative" style="color: #2679B5;">
                <i class="icon-hand-right green"></i>
                Online Admission Form
            </h3>
			
            <div class="widget-toolbar no-border invoice-info">
                <span class="invoice-info-label">Form No: </span>
                <!--<span class="red" id="admission_form_id_holder"></span>-->
				<input id="admission_form_id" type="text" name="admission_form_id" placeholder="Admission Form ID" value="" style="width:120px;"/>
				<input id="_invoice_number" type="hidden"  name="_invoice_number" placeholder="Invoice Number" value="" />
                <br>
                <span class="invoice-info-label">Date:</span>
                <span class="blue"><?php echo date('d/m/Y'); ?></span>
				<span class="invoice-info-label" style="margin-left:20px;">Fee:</span>
				<span class="red" id="admission_fee_holder"></span>
            </div>
			
            <div class="widget-toolbar hidden-480">
                <a href="#">
                    <i class="icon-th-large"></i>
                </a>
            </div>
        </div>
        <div class="hr hr-18 hr-double dotted"></div>
		
    </div> 
	<div class="span12" id="warning" style="margin-left:0px; display:none;"> 
    
    </div>
	<div class="span12" id="show_admission_details_info" style="margin-left: 5px;  margin-top: 0px; display:none;"></div>
	
    
    <div class="span3" style="float:right; margin-top:30px; display:none;" id="profile_picture_holder">
        <div class="center">
            <span class="profile-picture">
                <img id="avatar" style="width:120px;height:120px;" class="editable editable-click editable-empty" alt="Alex's Avatar" src="asset/avatars/people-icon.png">
            </span>
            <div class="space-4"></div>
            <div class="width-80 label label-info label-large arrowed-in arrowed-in-right">
                <div class="inline position-relative" style="width:108%; height:100%">
                    <div id="yourBtn" style="height: 100%; width: 100%; cursor:pointer;margin-top: 5px;" onclick="getFile()"><i class="icon-cloud-upload"></i> &nbsp; Click to upload!</div>
					<!-- this is your file input tag, so i hide it!-->
					<div style='height: 0px;width:0px; overflow:hidden;'><input  type="file" value="Upload Photo" class="s-button upload-button" id="upload" /><input type="hidden" value="" id="file_path" name="file_path" /> </div>		
                    <span class="white middle bigger-120"></span>
                </div>
            </div>
        </div>
		<!--'show_student_age' div shows age of the candidate which has been calculated by the system-->
		<div id="age_limit_warning_holder" class="center"style="color:red"><h3 id="show_age"></h3></div>
    </div>

    <div class="span9" style="margin-left:0 ; margin-top: -15px;" id="admission_form_input_holder">
        <div class="widget-box transparent">
            <div class="widget-header" style="margin-bottom: 17px;">
                <h5 class="bigger lighter">:: Personal Details ::</h5>
            </div>

            <div class="widget-body">
                <div class="widget-main no-padding">
                    <div class="span12" id="admission_details_info_holder">
                        <table class="table table-striped table-bordered">
                            <tbody>
                                <tr>
                                    <td class="hidden-480">Shift : <span style="color:red">*</span></td>
									<td class="hidden-480">
										<div class="controls" id="shift_control_for_admission_form">
											<select id="shift_id_for_admission_form" onchange="call_medium_from_admission_details(this.value)">
											<option value="">---Select---</option>
											<?php	$table_name = "_student_admission_master a left join _student_admission_details b on a._id=b._master_id left join _int_institute_setup c on b._shift_id=c._id";
													$column="DISTINCT b._shift_id,c._name";
													$where_cond = "a._session='".$session_input."' and a._status='A' and b._status='A'";
													$data_list = $obj->View_all_data_row_column_By_Cond($table_name,$column,$where_cond);
													foreach ($data_list AS $index1 => $value1) {
														echo '<option value="' . $value1['_shift_id'] . '">' . $value1['_name'] . '</option>';
													}
											?>
											</select>
										</div>
									</td>
									<td class="hidden-480">Medium : <span style="color:red">*</span></td>
									<td>
										<div class="controls" id="medium_control_for_admission_form">
											<select >
											</select>
										</div>
									</td>
								</tr>
								<tr>
									<td class="hidden-480">Class : <span style="color:red">*</span></td>
									<td>
										<div class="controls" id="class_control_for_admission_form">
											<select >
											</select>
										</div>
									</td>
									<span>
										<td class="hidden-480">Department : <span style="color:red">*</span></td>
									</span>
									<td>
									   <div class="controls" id="department_control_for_admission_form">
											<select >
											</select>
										</div>
									</td>
								</tr>							
                            </tbody>
                        </table><br>
						<div class="span3" style="margin-left: 750px;" >
						   <button id="go_to_next_section_btn" style="font-size: 17px;" type="button" class="btn btn-info" onclick="load_next_section_of_admission_form()">
								Next
								<i class="icon-arrow-right icon-on-right bigger-110"></i>
						   </button>
						</div>
                    </div>
                    <div class="span12" style="margin-left:0; display:none;" id="personal_basic_info_holder">
                        <div class="span6">
                            <ul class="unstyled list-striped pricing-table-header">
                                <li>
                                    <div class="control-group">
                                        <label class="control-label form-label" for="form-field-1">Candidate Name <span style="color:red">*</span></label>

                                        <div class="controls">
                                            <input id="_candidate_name" type="text"  name="_candidate_name" placeholder="Candidate name" required />
                                        </div>
                                    </div>
                                </li>
                                <li> 
                                    <div class="control-group">
                                        <label class="control-label form-label" for="_religion_id" >Religion </label>

                                        <div class="controls">
                                            <select id="_religion_id" name="_religion_id">
                                                <option value=""> -- Select -- </option>
                                                <?php
                                                $table_name = '_int_common_setup';
                                                $where_cond = " _type='RG' AND _status!='D' ";
                                                $data_list = $obj->View_All_By_Cond($table_name, $where_cond);
                                                foreach ($data_list AS $index1 => $value1) {
                                                    echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
                                                }
                                                ?>

                                            </select>
                                        </div>
                                    </div>

                                </li>
                               <li> 
                                    <div class="control-group">
                                        <label class="control-label form-label" for="_mobile_number">Contact Mobile No : <span style="color:red">*</span></label>
        
                                        <div class="controls">
                                            <input id="_mobile_number"  type="text" name="_mobile_number" placeholder="Contact Mobile No" />
                                        </div>
                                    </div>

                        		</li>
                                <li>
                                    <div class="control-group" style=" margin-top: 4px;" >
                                        <label class="control-label form-label" for="_nationality" >Nationality</label>

                                        <div class="controls" >
                                            <label style="float: left;margin-right: 15px;">
                                                <input name="_nationality" checked="checked" type="radio" value="B" >
                                                <span class="lbl"> Bangladeshi</span>
                                            </label>

                                            <label>
                                                <input name="_nationality" type="radio" value="O">
                                                <span class="lbl"> Others</span>
                                            </label>


                                        </div>
                                    </div>
                                </li>
                                

                            </ul>
                        </div>
                        <div class="span6">
                            <ul class="unstyled list-striped pricing-table-header">
                                <li>
                                    <div class="control-group">
                                        <label class="control-label form-label" for="form-field-1">Date OF Birth</label>
										<!--create onchange function for '_date_of_birth' input;the function will calculate age of the candidate-->	
                                        <div class="input-append controls">
                                            <input class="date-picker" name="_date_of_birth" id="_date_of_birth" data-date-format="dd-mm-yyyy" type="text" style="width:179px;" placeholder="Date Of Birth" onchange="check_student_age_with_age_limit(this.value)" />
                                            <span class="add-on">
                                                <i class="icon-calendar"></i>
                                            </span>
                                        </div>
                                    </div>
                                </li>
                                <li>
                                    <div class="control-group">
                                        <label class="control-label form-label" for="Blood Group">Blood Group </label>

                                        <div class="controls">
                                            <select name="_blood_group_id" id="_blood_group_id">
                                                <option value=""> -- Select -- </option>
                                                <?php
                                                $table_name = '_int_common_setup';
                                                $where_cond = " _type='BG' AND _status!='D' ";
                                                $data_list = $obj->View_All_By_Cond($table_name, $where_cond);
                                                foreach ($data_list AS $index1 => $value1) {
                                                    echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
                                                }
                                                ?>

                                            </select>
                                        </div>
                                    </div> 
                                </li>
                                <li> 
                                    <div class="control-group">
                                        <label class="control-label form-label" for="_email">Contact E-mail Address :</label>
										<div class="controls"> 
                                            <input id="contact_email" name="contact_email" placeholder="Contact E-mail Address" type="text">
                                            <br><span id="contact-mail-check" style="font-size: 10; color:red"> </span>
                                        </div>
                                    </div>

                                </li>
								<li>
									<div class="control-group">
                                        <label class="control-label form-label" for="Blood Group">Gender:</label>
										<div class="controls">
                                            <select name="gender" id="gender">
                                                <option value=""> -- Select -- </option>
												<option value="Male">Male</option>
												<option value="Female">Female</option>
                                            </select>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div> 
                    </div>
                </div>
            </div>
        </div>

    </div>
	<div id="personal_details_info_holder" style="display:none;">
    <div class="span12" style="margin-left: 0px; margin-top: 50px;">
        <div class="span6">

            <div class="widget-box">
                <div class="widget-header widget-header-flat widget-header-small">
                    <h5>
                        <i class="icon-bookmark"></i>
                        Present Address
                    </h5>
                </div>

                <div class="widget-body">
                    <div class="widget-main">

                        <div class="row-fluid">
                            <div class="span12">
                                <div class="control-group">
                                    <label class="control-label form-label" for="present address"> Address</label>

                                    <div class="controls">
                                        <textarea style="width: 311px; height: 88px;"  name="_present_address" class="span12" id="_present_address" placeholder="Present Address"></textarea>
                                    </div>
                                </div>

                            </div>
							<!--hide district and thana-->
                            <!--<div class="span6">
                                <div class="control-group">
                                    <label class="control-label form-label" for="District">District <span style="color:red">*</span></label>

                                    <div class="controls">
                                        <select id="_present_district_id" name="_present_district_id" onchange="call_child(this.value, '_present_thana_id');" >
                                            <option value=""> -- Select -- </option>
                                            <?php
                                            /*$table_name = "_int_country";
                                            $column = "_id,_pid,_name,_type,_status,_Comments";
                                            $where_cond = " _type='dc' AND _status!='2'";
                                            $district_list = $obj->View_all_data_row_column_By_Cond($table_name, $column, $where_cond);

                                            foreach ($district_list AS $index1 => $value1) {
                                                echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
                                            }*/
                                            ?>

                                        </select>
                                    </div>
                                </div>

                            </div>

                            <div class="span5">
                                <div class="control-group">
                                    <label class="control-label form-label" for="Thana">Upazila <span style="color:red">*</span></label>

                                    <div class="controls">
                                        <select id="_present_thana_id" class="_present_thana_id" name="_present_thana_id">
                                            <option value=""> -- Select -- </option>
                                            <?php
                                          /*  $table_name = "_int_country";
                                            $column = "_id,_pid,_name,_type,_status,_Comments";
                                            $where_cond = " _type='TH' AND _status!='2'";
                                            $district_list = $obj->View_all_data_row_column_By_Cond($table_name, $column, $where_cond);

                                            foreach ($district_list AS $index1 => $value1) {
                                                echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
                                            }*/
                                            ?>

                                        </select>
                                    </div>
                                </div>
                            </div>-->
                        </div>


                    </div><!--/widget-main-->
                </div><!--/widget-body-->
            </div><!--/widget-box-->

        </div>
        <div class="span6">

            <div class="widget-box">
                <div class="widget-header widget-header-flat widget-header-small">
                    <h5>
                        <i class="icon-bookmark"></i>
                        Permanent Address
                    </h5>


                </div>

                <div class="widget-body">
                    <div class="widget-main">

                        <div class="row-fluid">
                            <div class="span12">
                                <div class="control-group">
                                    <label class="control-label form-label" for="form-field-1"> Address </label>

                                    <div class="controls">
                                        <textarea name="_permanent_address" id="_permanent_address" style="width: 311px; height: 88px;" class="span12"  placeholder="Permanent Address"></textarea>
                                    </div>
                                </div>

                            </div>
							<!--hide district and thana-->
                            <!--<div class="span6">
                                <div class="control-group">
                                    <label class="control-label form-label" for="permanent district">District </label>

                                    <div class="controls">
                                        <select id="_permanent_district_id" name="_permanent_district_id" onchange="call_child(this.value, '_permanent_thana_id');">
                                            <option value=""> -- Select -- </option>
                                            <?php
                                            /*$table_name = "_int_country";
                                            $column = "_id,_pid,_name,_type,_status,_Comments";
                                            $where_cond = " _type='dc' AND _status!='2'";
                                            $district_list = $obj->View_all_data_row_column_By_Cond($table_name, $column, $where_cond);

                                            foreach ($district_list AS $index1 => $value1) {
                                                echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
                                            }*/
                                            ?>

                                        </select>
                                    </div>
                                </div>

                            </div>

                            <div class="span5">
                                <div class="control-group">
                                    <label class="control-label form-label" for="permanent_thana">Upazila </label>

                                    <div class="controls">
                                        <select id="_permanent_thana_id" name="_permanent_thana_id">
                                            <option value=""> -- Select -- </option>
                                            <?php
                                           /* $table_name = "_int_country";
                                            $column = "_id,_pid,_name,_type,_status,_Comments";
                                            $where_cond = " _type='TH' AND _status!='2'";
                                            $district_list = $obj->View_all_data_row_column_By_Cond($table_name, $column, $where_cond);

                                            foreach ($district_list AS $index1 => $value1) {
                                                echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
                                            }*/
                                            ?>

                                        </select>
                                    </div>
                                </div>
                            </div>-->
                        </div>
                    </div><!--/widget-main-->
                </div><!--/widget-body-->
            </div><!--/widget-box-->

        </div>
    </div>
    <div class="span12" style="margin-left:0">
        <h3 class="header smaller lighter blue">
            :: Family Informaion ::
        </h3>
        <div class="row-fluid">
            <div class="span12" style="margin-left:0;margin-top: 16px;">
                <div class="span6">
                    <ul class="unstyled list-striped pricing-table-header">
                        <li>
                            <div class="control-group">
                                <label class="control-label form-label" for="_father_name">Father's Name <span style="color:red">*</span></label>

                                <div class="controls">
                                    <input id="_father_name" placeholder="Father's Name" type="text" name="_father_name">
                                </div>
                            </div>
                        </li>
                        <li> 
                            <div class="control-group">
                                <label class="control-label form-label" for="form-field-1">Father's Occupation </label>

                                <div class="controls">
                                   
                                 <select id="_father_occupation_id" name="_father_occupation_id" >   
                                    <option value=""> -- Select -- </option>
									<?php
                                   	 $table_name = '_int_common_setup';
                                   	 $where_cond = " _type='EPF' AND _status!='D' ";
                                   	 $data_list = $obj->View_All_By_Cond($table_name, $where_cond);
                                   	 foreach ($data_list AS $index1 => $value1) {
										 if($value1['_name'] == 'Businessman'){
											 echo '<option value="' . $value1['_id'] . '" selected="selected">' . $value1['_name'] . '</option>';
										 }else{
											 echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
										 } 
                                   	 }
                                    ?>
                                </select>    
                                    
                                </div>
                            </div> 

                        </li>
                        <li>
                            <div class="control-group">
                                <label class="control-label form-label" for="form-field-1">Father's Mobile No:  </label>

                                <div class="controls">
                                    <input id="_father_mobile" placeholder="Father's Mobile No" type="text" name="_father_mobile">
                                </div>
                            </div> 
                        </li>
                        <li> 
                            <div class="control-group">
                                <label class="control-label form-label" for="_father_mail">E-mail Address : </label>

                                <div class="controls">
                                    <input id="_father_mail"  type="text" name="_father_mail" placeholder="Father's E-mail Address"/>
                                	<br><span id="father_mail_check" style="font-size: 10; color:red"> </span>
                                </div>
                            </div>

                        
                        </li>
                        <!--<li> 
                            <div class="control-group">
                                <label class="control-label form-label" for="_father_annual_income">Father's Annual Income : </label>

                                <div class="controls">
                                    <input id="_father_annual_income"  type="text" name="_father_annual_income" placeholder="Father's Annual Income" />
                                </div>
                            </div>

                        </li>-->
                        

                    </ul>
                </div>
                <div class="span6">
                    <ul class="unstyled list-striped pricing-table-header">
                        <li>
                            <div class="control-group">
                                <label class="control-label form-label" for="_mother_name">Mother's Name</label>

                                <div class="controls">
                                    <input id="_mother_name" placeholder="Mother's Name" type="text" name="_mother_name">
                                </div>
                            </div>
                        </li>
                        <li> 
                            <div class="control-group">
                                <label class="control-label form-label" for="form-field-1">Mother's Occupation </label>

                                <div class="controls">
                                    
                                    <select id="_mother_occupation_id" name="_mother_occupation_id">   
                                        <option value=""> -- Select -- </option>
                                        <?php
                                         $table_name = '_int_common_setup';
                                         $where_cond = " _type='EPF' AND _status!='D' ";
                                         $data_list = $obj->View_All_By_Cond($table_name, $where_cond);
                                         foreach ($data_list AS $index1 => $value1) {
                                             if($value1['_name'] == 'House wife'){
											 echo '<option value="' . $value1['_id'] . '" selected="selected">' . $value1['_name'] . '</option>';
											 }else{
												 echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
											 }
                                         }
                                        ?>
                                </select>  
                                </div>
                            </div> 

                        </li>
                        <li>
                            <div class="control-group">
                                <label class="control-label form-label" for="_mother_mobile">Mother's Mobile No:  </label>

                                <div class="controls">
                                    <input id="_mother_mobile" placeholder="Mother's Mobile No" type="text" name="_mother_mobile">
                                </div>
                            </div> 
                        </li>
                        <!--<li> 
                            <div class="control-group">
                                <label class="control-label form-label" for="_mother_mail">E-mail Address : </label>

                                <div class="controls">
                                    <input id="_mother_mail"  type="text" name="_mother_mail" placeholder="Mother's E-mail Address">
                                    <br><span id="mother_mail_check" style="font-size: 10; color:red"> </span>
                                </div>
                            </div>

                        </li>-->


                    </ul>
                </div> 
            </div>

        </div>
    </div> <!-- End Family Information -->
    <!--<div class="span12" style="margin-left:0">
        <h3 class="header smaller lighter blue">
            :: Academic Informaion ::
        </h3>
        <div class="row-fluid">
            <p style="text-align:right">
                <input id="more_row_num" type="hidden" value="1"/>
                <span id="add_more" data-original-title="Bottm Info" class="btn btn-info btn-small tooltip-info" data-rel="tooltip" data-placement="bottom" title=""  name="Add_more"> Add More </span>
                <input type="button" id="add_more" data-original-title="Bottm Info" class="btn btn-info btn-small tooltip-info" data-rel="tooltip" data-placement="top" title="Add More Field" value="Add More" />
            </p> 
            <div class="span12" style="margin-left:0px">
                <table class="table table-striped table-bordered academic-table" id="academic-table" style="width:100%">
                    <thead>
                        <tr>
                            <th class="center">#</th>
                            <th>EXAM</th>
                            <th>BOARDD</th>
                            <th>ROLL</th>
                            <th>PASS YEAR</th>
                            <th>INSTITUTE</th>
                            <th>GPA/MARKS</th>
                        </tr>
                    </thead>

                    <tbody>
                    
                        <tr>
                            <td class="center">1</td>

                            <td><input  type="text" name="ac[0][exam]" class="exam"  style="width:80px"></td>
                            <td>
                                <select name="ac[0][education_board]" class="education_board">
                                    <option value="">-- Select --</option>
                                     <?php
                                                /*$table_name = '_int_common_setup';
                                                $where_cond = " _type='EB' AND _status!='D' ";
                                                $data_list = $obj->View_All_By_Cond($table_name, $where_cond);
                                                foreach ($data_list AS $index1 => $value1) {
                                                    echo '<option value="' . $value1['_id'] . '">' . $value1['_name'] . '</option>';
                                                }*/
                                                ?>
                                </select>
                            </td>
                            <td ><input   type="text" class="roll" name="ac[0][roll]" style="width:109px"></td>
                            <td><input   type="text" name="ac[0][pass_year]" class="pass_year" style="width:109px"></td>
                            <td><input   type="text" name="ac[0][institute]" class="institute" style="width:200px"></td>
                            <td><input   type="text" name="ac[0][gpa]" class="gpa" style="width:80px"> </td>
                        </tr>

						
                    </tbody>
                    <tfo>
                </table>
            </div>                                                

        </div>
    </div>-->
    <div class="span6" style="margin-left:0px" >
       <button id="loading-btn" type="button" class="btn btn-success" data-loading-text="Loading..." onclick="process_form_info()">
            <i class="icon-save bigger-160"></i>
            Submit the form
       </button>
	</div>
	 </form>
	 </div>
     <div class="span12 conformation_message" style="margin-left:0; display:none" >
     	
        
     </div>
</div>   
                                          

<script>
function getFile(){
        document.getElementById("upload").click();
    }

$('#upload').change(function () {
        //fire your ajax call  
        file_upload();
    })
    var fileInput = $('input[type=file]'),
            button = $('#upload');
    button.on('focusout', function () {

// Access the files property, which holds
// an array with the selected files

    });
    function file_upload() {
		
        var files = fileInput.prop('files');
// No file was chosen!
        if (files.length == 0) {
            alert('Please choose a file to upload!');
            return false;
        }

        var br_id = $("#admission_form_id").val();
        if (br_id == '') {
            alert('Enter Invoice Number');
            //$('#_invoice_number').focus();

            return false;
        }
        else {
// Create a new FormData object
            var fd = new FormData();
            fd.append('file', files[0]);
            fd.append('id', br_id);
// Upload the file to assets/php/upload.php, which only prints the filename
            $.ajax({
                url: 'module/common/upload_admission.php',
                data: fd,
                contentType: false,
                processData: false,
                type: 'POST',
                success: function (m) {

                    //$('#image').attr('src','asset/custom/upload/x2015_03_20_26_5_b.jpg.pagespeed.ic.wGOLVYlwPH.jpg');
                    var a = JSON.parse(m);

                    if (a.status != 'Error') {

                        var image_path = 'asset/custom/upload/' + a.image;
                      
					  	 $('img#avatar ').attr('src',image_path);
                        $('#file_path').val(image_path);
						// $('#branch-img').html('<img src="'+image_path+'" style="height:150px;" />');
						
                    }
                    else {

                        alert(a.message);
                    }
                }
            });
        }
    }
 function call_child(val){
	 
	 	
	 
	 
	 }
function call_child(val,id){
	var datastr="parent_id="+val;
	$('#'+id).load("module/admission/get_thana_list.php",datastr);
}

$("#add_more").click(function(){
		var more = parseInt($("#more_row_num").val()) + 1;
		$("#more_row_num").val(more) ;
	//	var row = $("#academic-row").html() ;
	//	alert(row);
		var tr = '<tr id><td class="center">'+more+'</td><td><input type="text" name="ac['+(more-1)+'][exam]" style="width:80px"></td><td>';
                                 <?php
                                                $str = '';
												$table_name = '_int_common_setup';
                                                $where_cond = " _type='EB' AND _status!='D' ";
                                                $data_list = $obj->View_All_By_Cond($table_name, $where_cond);
                                                foreach ($data_list AS $index1 => $value1) {
                                                    $str .= '<option value="'.$value1['_id'].'">'.$value1['_name'].'</option>';
                                                }
                                  ?>
   var str = '<?php echo $str; ?>';
   tr = tr +'<select name="ac['+(more-1)+'][education_board]"><option value="">--Select--</option>'+str+'</select></td><td><input type="text" name="ac['+(more-1)+'][roll]" style="width:109px"></td><td><input type="text" name="ac['+(more-1)+'][pass_year]" style="width:109px"></td><td><input type="text" name="ac['+(more-1)+'][institute]" style="width:200px"></td><td ><input type="text" name="ac['+(more-1)+'][gpa]" style="width:80px"><a href="#" class="close close-this" title="Removed this row">X</a></td></tr>';
	   
	   
	   $("table.academic-table tbody").last().append(tr);
	   
	});
</script>
