<?php
require "_header.php";

require "includeLanguageBar.php";
require "data/combo_student.php";
require "data/combo_semester.php";
require "data/combo_branchyear.php";

if ($_REQUEST["ID"] != "" && isset($_REQUEST["ID"])) {
	$student_id = Escape($_REQUEST["ID"]);
	$mode = "edit";
	$limit = 1;
	$start = 0;
	$condition = " and sm.student_id = '$student_id' ";
	$order_field = "";
	$order_type = "";
	$objStudent = new StudentMgmt();
	$out = $objStudent->getStudentRecords($limit, $start, $condition, $order_field, $order_type);
	if (dbRows($out)) {
		$row = dbArray($out);
		extract($row);
	}
	$limit = 1;
	$start = 0;
	$condition1 .= " AND student_id='" . $_REQUEST['ID'] . "'";
	$order_field = "";
	$order_type = "";
	$objStudent1 = new StudentDetailMgmt();
	$out1 = $objStudent1->getAllRecords($limit, $start, $condition1, $order_field, $order_type);
	if (dbRows($out1)) {
		while ($row1 = dbArray($out1)) {
			//	$cur_mysem = $row1['cur_semesterid'];
		}
	}

} else {
	$mode = "add";
	$student_id = 0;
}
?>
<div id="main-content">
	<script type="text/javascript" src="webcamjs/webcam.js"></script>

	<!--<script src="cropjs/prototype.js" type="text/javascript"></script>
	<script src="cropjs/scriptaculous.js?load=effects,builder,dragdrop" type="text/javascript"></script>
	<script src="cropjs/cropper.js" type="text/javascript"></script>-->
	<script src="js/photocapture.js" type="text/javascript"></script>


	<script type="text/javascript" language="javascript">
		var fflag = 1;
		var formMode = '<?php echo $mode; ?>';
		var add = '<?php echo $_REQUEST["add"]; ?>';
		var dt = new Date();
		var student_id = '<?php echo $student_id; ?>';

		if (student_id == "") {
			student_id = 0;
		}

		Ext.onReady(function () {
			Ext.QuickTips.init();

			//2-08
			var mscsubjectstore = new Ext.data.ArrayStore({
				fields: ['msc_subject'],
				data: [['Medical Surgical Nursing'], ['Comunity Health Nursing'], ['Child Health Nursing'], ['Obstretics & Gynaecologocal Nursing'], ['Mental Health Nursing']]
			});

			var admbystore = new Ext.data.ArrayStore({
				fields: ['student_admby'],
				data: [['ACPC'], ['MQ'], ['VACENT QUOTA'], ['NRI'], ['Other']]
			});
			var batchstore = new Ext.data.ArrayStore({
				fields: ['year_id', 'year_name'],
				data: Ext.semester.yearname
			});

			var streamstore = new Ext.data.ArrayStore({
				fields: ['twle_stream'],
				data: [['Science'], ['Commerce'], ['Arts'], ['Other']]
			});
			var nristore = new Ext.data.ArrayStore({
				fields: ['student_nri'],
				data: [['Yes'], ['No']]
			});

			var store = new Ext.data.ArrayStore({
				fields: ['marital_status'],
				data: [['Married'], ['UnMarried']]
			});

			var categorystore = new Ext.data.ArrayStore({
				fields: ['category'],
				data: [['GENERAL'], ['VICHARIT VIMUKTI'], ['OBC'], ['SC'], ['ST'], ['MINORITY'], ['EWS']]
			});

			var genderstore = new Ext.data.ArrayStore({
				fields: ['gender'],
				data: [['Male'], ['Female']]
			});
			var monthstore = new Ext.data.ArrayStore({
				fields: ['month'],
				data: [['Jannuary'], ['February'], ['March'], ['April'], ['May'], ['June'], ['July'], ['Auguest'], ['September'], ['Octmber'], ['November'], ['December']]
			});

			var corestore = new Ext.data.ArrayStore({
				fields: ['ba_core'],
				data: [['Sanskrit'], ['English'], ['Gujarati'], ['Psychology'], ['History'], ['Economics']]
			});

			var el1store = new Ext.data.ArrayStore({
				fields: ['ba_el1'],
				data: [['Sanskrit'], ['Gujarati'], ['Psychology'], ['History'], ['Economics'], ['Hindi']]
			});

			var el2store = new Ext.data.ArrayStore({
				fields: ['ba_el2'],
				data: [['Sanskrit'], ['Gujarati'], ['Psychology'], ['History'], ['Economics']]
			});

			var bscstore = new Ext.data.ArrayStore({
				fields: ['bsc_group'],
				data: [['Physics/Chemistry/Maths'], ['Physics/Chemistry/Zoology'], ['Chemistry/Botony/Micro'], ['Chemistry/Zoology/Micro'], ['Chemistry/Physics'], ['Micro/Physics'], ['Chemistry'], ['Micro']]
			});

			var mscstore = new Ext.data.ArrayStore({
				fields: ['msc_group'],
				data: [['Orgenic Chemistry']]
			});





			var bloodgroupstore = new Ext.data.ArrayStore({
				fields: ['bloodgroup'],
				data: [['O+'], ['A+'], ['B+'], ['AB+'], ['O-'], ['A-'], ['B-'], ['AB-']]
			});
			var districtstore = new Ext.data.ArrayStore({

				fields: ['dist_nameeng'],
				data: [['Ahmedabad'], ['Amreli'], ['Anand'], ['Aravalli'], ['Banaskantha'], ['Bharuch'], ['Bhavnagar'], ['Botad'], ['Chhota Udaipur'], ['Diu'], ['Daman'], ['Dahod'], ['Dang'], ['Devbhoomi Dwarka'], ['Gandhinagar'], ['Gir Somnath'], ['Jamnagar'], ['Junagadh'], ['Kutch'], ['Kheda'], ['Mahisagar'], ['Mehsana'], ['Morbi'], ['Narmada'], ['Navsari'],
				['Panchmahal'], ['Patan'], ['Porbandar'], ['Rajkot'], ['Sabarkantha'], ['Surat'], ['Surendranagar'], ['Silvasa'], ['Tapi'], ['Vadodara'], ['Valsad']]
			});
			var talukostore = new Ext.data.ArrayStore({

				fields: ['taluko_nameeng'],
				data: Ext.student.taluko
			});

			var statestore = new Ext.data.ArrayStore({

				fields: ['state_nameeng'],
				data: Ext.student.state
			});

			var districtstore1 = new Ext.data.ArrayStore({
				fields: ['dist_nameeng1'],
				data: [['Ahmedabad'], ['Amreli'], ['Anand'], ['Aravalli'], ['Banaskantha'], ['Bharuch'], ['Bhavnagar'], ['Botad'], ['Chhota Udaipur'], ['Diu'], ['Daman'], ['Dahod'], ['Dang'], ['Devbhoomi Dwarka'], ['Gandhinagar'], ['Gir Somnath'], ['Jamnagar'], ['Junagadh'], ['Kutch'], ['Kheda'], ['Mahisagar'], ['Mehsana'], ['Morbi'], ['Narmada'], ['Navsari'],
				['Panchmahal'], ['Patan'], ['Porbandar'], ['Rajkot'], ['Sabarkantha'], ['Surat'], ['Surendranagar'], ['Silvasa'], ['Tapi'], ['Vadodara'], ['Valsad']]
			});

			var talukostore1 = new Ext.data.ArrayStore({
				fields: ['taluko_nameeng1'],
				data: Ext.student.taluko1
			});

			var statestore1 = new Ext.data.ArrayStore({
				fields: ['state_nameeng1'],
				data: Ext.student.state1
			});


			var shiftstore = new Ext.data.ArrayStore({
				fields: ['shift'],
				data: [['Shift-1'], ['Shift-2']]
			});
			var transportstore = new Ext.data.ArrayStore({
				fields: ['transport_facility'],
				data: [['Updown Facility'], ['Hostel Facility']]
			});

			var branchstore = new Ext.data.ArrayStore({
				fields: ['branch_id', 'branch_name'],
				data: Ext.student.branch
			});

			var adm_conformationstore = new Ext.data.ArrayStore({
				fields: ['adm_conformation'],
				data: [['Temporary'], ['Continue']]
			});

			var yearstore = new Ext.data.ArrayStore({
				fields: ['branch_id', 'branchyear_id', 'branchyear_name'],
				data: Ext.year.year
			});


			var nationalitystore = new Ext.data.ArrayStore({
				fields: ['student_nationality'],
				data: [['Indian'], ['Other']]
			});

			var semesterstore = new Ext.data.ArrayStore({
				fields: ['branch_id', 'semester_id', 'semester_name'],
				data: Ext.semester.semester
			});

			var caststore = new Ext.data.ArrayStore({
				fields: ['student_cast'],
				data: Ext.student.cast
			});
			var subcaststore = new Ext.data.ArrayStore({
				fields: ['student_subcast'],
				data: Ext.student.subcast
			});


			var picFiles = {
				columnWidth: .7,
				layout: 'form',
				labelAlign: 'top',
				items: [{
					xtype: 'textfield',
					fieldLabel: 'Current',
					labelSeparator: '',
					name: 'currPic',
					id: 'currPic',
					readOnly: true,
					disabled: true,
					anchor: '100%'
				}, {
					xtype: 'textfield',
					fieldLabel: 'New (JPG or JPEG only)',
					labelSeparator: '',
					name: 'newPic',
					width: 270,
					id: 'newPic',
					style: 'width: 300px',
					inputType: 'file',
					allowBlank: false
				}
				]
			}

			var pictUploadForm = new Ext.FormPanel({
				frame: true,
				bodyStyle: 'padding:5px',
				width: 435,
				layout: 'column',
				url: 'stdphotoupload.php',
				method: 'POST',
				fileUpload: true,
				items: [picFiles],
				buttons: [{
					text: 'Upload Picture',
					handler: function () {
						var theForm = pictUploadForm.getForm();
						if (!theForm.isValid()) {
							Ext.MessageBox.show({
								title: 'Change Picture',
								msg: 'Please select a picture',
								buttons: Ext.MessageBox.OK,
								icon: Ext.MessageBox.ERROR
							});
							return;
						}
						if (!validateFileExtension(Ext.getDom('newPic').value)) {
							Ext.MessageBox.show({
								title: 'Change Picture',
								msg: 'Only JPG or JPEG please.',
								buttons: Ext.MessageBox.OK,
								icon: Ext.MessageBox.ERROR
							});
							return;
						}
						theForm.submit({
							params: { act: 'setPicture', id: student_id },
							waitMsg: 'Uploading picture'
						});
					}
				}, {
					text: 'Reset',
					handler: function () {
						pictUploadForm.getForm().reset();
					}
				}
				]
			});


			var winPicture = new Ext.Window({
				title: 'File Upload Form',
				height: 180,
				width: 435,
				modal: true,
				layout: 'fit',
				closeAction: 'close',
				border: false,
				autoDestroy: true,
				items: pictUploadForm
			});


			pictUploadForm.on({
				actioncomplete: function (form, action) {
					if (action.type == 'load') {
						var varpic = action.result.data;

						Ext.getDom('pic').src = varpic.file;
						Ext.getCmp('currPic').setValue(varpic.file);
					}
					if (action.type == 'submit') {
						var varpic = action.result.data;
						Ext.getDom('pic').src = varpic.file;
						studententry.getForm().findField('student_photo').setValue(varpic.photoname);
						Ext.getCmp('currPic').setValue(varpic.file);
						Ext.getDom('newPic').value = '';
						winPicture.hide();
					}
				}
			});


			pictUploadForm.getForm().load({
				params: { act: 'getPicture', id: student_id, photoname: '<?php print $student_photo; ?>' },
				waitMsg: 'Loading'
			});


			var studententry = new Ext.FormPanel({
				labelWidth: 110,
				url: 'save-student.php?ID=<?php echo $student_id; ?>',
				method: 'post',
				frame: true,
				autoHeight: true,
				fileUpload: true,
				bodyStyle: 'padding:5px 5px',
				//	layout:'accordion',
				items: [
					{
						xtype: 'fieldset',
						title: 'Admission Details',
						collapsible: true,
						collapsed: false,
						forceLayout: true,
						autoHeight: true,
						layout: 'column',
						items: [
							{
								columnWidth: .5,
								layout: 'form',
								labelWidth: 140,
								items: [{
									xtype: 'combo',
									name: 'branch_id',
									id: 'branch_id',
									hiddenName: 'branch_hidden',
									fieldLabel: 'Course <span class="comp">*</span>',
									forceSelection: true,
									displayField: 'branch_name',
									valueField: 'branch_id'
									, allowBlank: false
									, triggerAction: 'all'
									, mode: 'local'
									, store: branchstore
									, width: 260
									, selectOnFocus: true,
									tabIndex: 1,
									lastQuery: '',
									listeners: {
										'select': function (cmb, rec, idx) {
											Ext.getCmp('branch_disp').setValue(this.getRawValue());
											semesterstore.filter('branch_id', cmb.getValue(), false, true, true);
											yearstore.filter('branch_id', cmb.getValue(), false, true, true);

											var semesterCombo = Ext.getCmp('semester_id');
											if (cmb.getValue() == 3 || cmb.getValue() == 5) {
												semesterCombo.enable();
											} else {
												semesterCombo.disable();
												semesterCombo.reset();
											}
											var mscSubjectCombo = Ext.getCmp('msc_subject');
											if (cmb.getValue() == 5) {
												mscSubjectCombo.show();
											} else {
												mscSubjectCombo.hide();

											}
										}
									}
								}, {
									xtype: 'combo',
									name: 'msc_subject',
									id: 'msc_subject',
									fieldLabel: 'MSC Specialization ',
									displayField: 'msc_subject',
									valueField: 'msc_subject',
									allowBlank: true,
									triggerAction: 'all',
									mode: 'local',
									store: mscsubjectstore,
									width: 200,
									forceSelection: true,
									//selectOnFocus: true,
									hidden: true,
									tabIndex: 3,
									lastQuery: '',
								}, {
									xtype: 'textfield',
									name: 'branch_disp',
									id: 'branch_disp',
									hidden: true
								}, {

									type: 'number',
									xtype: 'combo',
									name: 'branchyear_id',
									id: 'branchyear_id',
									hiddenName: 'branchyear_hidden',
									fieldLabel: 'Course Year ',
									forceSelection: true,
									displayField: 'branchyear_name',
									valueField: 'branchyear_id'
									, allowBlank: true
									, triggerAction: 'all'
									, mode: 'local'
									, store: yearstore
									, width: 200
									, selectOnFocus: true,
									tabIndex: 3,
									lastQuery: '',
									autoCreate: { tag: 'input', maxlength: '1' },
									listeners: {
										'focus': function (cmb) {
											var branchId = Ext.getCmp('branch_id').getValue();
											if (branchId) {
												yearstore.clearFilter();
												yearstore.filter('branch_id', branchId, false, true, true);
											}
										}
									}
								},
								{
									xtype: 'datefield',
									name: 'student_admdate',
									id: 'student_admdate',
									width: 200,
									format: JSDateFormat,
									fieldLabel: 'Admission Date ',
									vtype: 'daterange',
									allowBlank: true,
									tabIndex: 5,
									maxValue: new Date(),
									value: new Date()
								},
								{
									xtype: 'combo',
									name: 'adm_conformation',
									id: 'adm_conformation',
									fieldLabel: 'Admission Conformation ',
									forceSelection: true,
									displayField: 'adm_conformation',
									valueField: 'adm_conformation'
									, lastQuery: ''
									, allowBlank: true
									, triggerAction: 'all'
									, mode: 'local'
									, store: adm_conformationstore
									, width: 200
									, selectOnFocus: true,
									tabIndex: 7
								},
								{
									xtype: 'textfield',
									name: 'student_ref',
									fieldLabel: 'Adm. Referred By ',
									id: 'student_ref',
									width: 200,
									tabIndex: 9,
									allowBlank: true,
									autoCreate: { tag: 'input', type: 'text', maxlength: '100' }
								},
								{
									xtype: 'textfield',
									name: 'student_grno',
									fieldLabel: 'Gr. No ',
									id: 'student_grno',
									width: 200,
									tabIndex: 11,
									allowBlank: true,
									autoCreate: { tag: 'input', type: 'text', maxlength: '20' },

								},
								{
									xtype: 'numberfield',
									name: 'student_adharno',
									fieldLabel: 'Adhar No <span class="comp">*</span>',
									id: 'student_adharno',
									width: 200,
									minLength: 12,
									tabIndex: 13,
									allowBlank: false,
									autoCreate: { tag: 'input', maxlength: '12' },
									maskRe: /[0-9]/
								}

								]
							},
							{
								columnWidth: .5,
								layout: 'form',
								labelWidth: 140,
								items: [{

									xtype: 'combo',
									name: 'year_id',
									id: 'year_id',
									hiddenName: 'year_hidden',
									fieldLabel: 'Batch(Year) ',
									displayField: 'year_name',
									valueField: 'year_id'
									, allowBlank: true,
									forceSelection: true
									, selectOnFocus: true
									, triggerAction: 'all'
									, mode: 'local'
									, store: batchstore
									, width: 200,
									tabIndex: 2,
									lastQuery: ''

								},
								{
									type: 'number',
									xtype: 'combo',
									name: 'semester_id',
									id: 'semester_id',
									fieldLabel: 'Semester',
									forceSelection: true,
									hiddenName: 'semester_hidden',
									displayField: 'semester_name',
									valueField: 'semester_id',
									lastQuery: '',
									allowBlank: true,
									triggerAction: 'all',
									mode: 'local',
									store: semesterstore,
									width: 200,
									tabIndex: 4,
									disabled: true,  // Start with the combo box disabled
									selectOnFocus: true,
									autoCreate: { tag: 'input', maxlength: '1' },
									listeners: {
										'focus': function () {
											var branchId = Ext.getCmp('branch_id').getValue();
											if (branchId) {
												semesterstore.clearFilter();
												semesterstore.filter('branch_id', branchId, false, true, true);
											}

										}
									}
								},
								{
									xtype: 'combo',
									name: 'student_admby',
									id: 'student_admby',
									fieldLabel: 'Admission Type ',
									forceSelection: false,
									displayField: 'student_admby',
									valueField: 'student_admby',
									width: 200,
									allowBlank: true,
									triggerAction: 'all',
									mode: 'local',
									store: admbystore,
									tabIndex: 6
								}, {
									xtype: 'numberfield',
									name: 'student_formno',

									fieldLabel: 'Admission Form No ',
									id: 'student_formno',
									width: 200,
									tabIndex: 8,
									allowBlank: true,
									autoCreate: { tag: 'input', maxlength: '20' },
									maskRe: /[0-9]/
								},



								{
									xtype: 'textfield',
									name: 'student_gturegno',
									fieldLabel: 'Enrollment No ',
									id: 'student_gturegno',
									width: 200,
									tabIndex: 10,
									allowBlank: true,
									autoCreate: { tag: 'input', type: 'text', maxlength: '20' },

								},


								{
									xtype: 'datefield',
									name: 'reporting_date',
									id: 'reporting_date',
									width: 200,
									format: JSDateFormat,
									fieldLabel: 'Reporting Date ',
									vtype: 'daterange',
									allowBlank: true,
									tabIndex: 12,
									maxValue: new Date()
								},
								{
									xtype: 'checkbox',
									name: 'tfw_scheme',
									id: 'tfw_scheme',
									width: 150,
									fieldLabel: 'Tution Fee Waiver(TFW) Scheme ',
									allowBlank: true,
									tabIndex: 14

								},

								]
							},
							{
								columnWidth: 1,
								layout: 'column',
								items: [{
									columnWidth: 0.40,
									labelWidth: 140,
									layout: 'form',
									items: [{ height: 10 },


									{
										xtype: 'checkbox',
										name: 'student_lastcollege_check',
										id: 'student_lastcollege_check',
										width: 150,
										fieldLabel: 'Transferred from Other College? ',
										allowBlank: true,
										tabIndex: 15,
										handler: function () {
											if (this.getValue() == true) {
												studententry.getForm().findField('student_lastcollege').enable();
											}
											else {
												studententry.getForm().findField('student_lastcollege').disable();
												studententry.getForm().findField('student_lastcollege').reset();
											}
										}

									},
									{
										xtype: 'combo',
										name: 'transport_facility',
										id: 'transport_facility',
										fieldLabel: 'Transportation Facility ',
										forceSelection: false,
										displayField: 'transport_facility',
										valueField: 'transport_facility',
										width: 200,
										allowBlank: true,
										triggerAction: 'all',
										mode: 'local',
										store: transportstore,
										tabIndex: 17,
										listeners: {
											select: function (combo, record) {
												var selectedtransport_facility = record.get('transport_facility');
												var updown_strdateField = Ext.getCmp('updown_strdate');
												var updown_enddateField = Ext.getCmp('updown_enddate');
												var hostel_admdateField = Ext.getCmp('hostel_admdate');
												var hostel_candateField = Ext.getCmp('hostel_candate');
												if (selectedtransport_facility == 'Updown Facility') {
													updown_strdateField.enable();
													updown_enddateField.enable();
													hostel_admdateField.disable();
													hostel_candateField.disable();
													hostel_admdateField.reset();
													hostel_candateField.reset();

												} else if (selectedtransport_facility == 'Hostel Facility') {
													hostel_admdateField.enable();
													hostel_candateField.enable();
													updown_strdateField.disable();
													updown_enddateField.disable();
													updown_strdateField.reset();
													updown_enddateField.reset();

												}


											}
										}
									},
									{
										xtype: 'datefield',
										name: 'updown_strdate',
										id: 'updown_strdate',
										width: 150,
										tabIndex: 19,
										format: JSDateFormat,
										fieldLabel: 'Up Down Start Date ',
										vtype: 'daterange',
										allowBlank: true,
										disabled: true
										//value: new Date(),

									}, {
										xtype: 'datefield',
										name: 'updown_enddate',
										id: 'updown_enddate',
										width: 150,
										format: JSDateFormat,
										fieldLabel: 'Up Down End Date ',
										vtype: 'daterange',
										allowBlank: true,
										tabIndex: 18,
										maxValue: new Date(),
										disabled: true
										//value: new Date(),

									}


									]

								}, {
									columnWidth: 0.60,
									labelWidth: 5,
									layout: 'form',
									items: [{ height: 10 },


									{
										xtype: 'textfield',
										name: 'student_lastcollege',
										width: 350,
										disabled: true,
										tabIndex: 16,
										allowBlank: true
									},

									{ height: 5 },
									{
										labelWidth: 150,
										layout: 'form',
										style: "margin-left:8px",
										items: [{ height: 33 },
										{
											xtype: 'datefield',
											name: 'hostel_admdate',
											id: 'hostel_admdate',
											width: 150,
											format: JSDateFormat,
											fieldLabel: 'Hostel Admission Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 18,
											maxValue: new Date(),
											disabled: true
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'hostel_candate',
											id: 'hostel_candate',
											width: 150,
											format: JSDateFormat,
											fieldLabel: 'Hostel Admission Cancle Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 19,
											maxValue: new Date(),
											disabled: true
											//value: new Date(), 
										},
										]
									}
									]
								}]
							}
						]
					},

					{
						xtype: 'fieldset',
						title: 'Personal Details',
						collapsible: true,
						collapsed: false,
						forceLayout: true,
						autoHeight: true,
						autoHeight: true,
						hideBorders: true,
						layout: 'column',
						items: [{
							columnWidth: 1,
							layout: 'column',
							items: [{
								columnWidth: 0.30,
								labelWidth: 99,
								layout: 'form',
								items: [{
									html: '<b>Personal Detail</b>',       // My Label
								},
								{
									xtype: 'textfield',
									name: 'student_photo',
									id: 'student_photo',
									hidden: true,
									width: 600
								}, {
									xtype: 'box',
									name: 'photo',
									id: 'photo',
									style: 'padding:10px 0px 0px 0px',
									autoEl: {
										tag: 'div',
										html: '<img id="pic" src="upload/student/default.gif" alt="photograph" class="img-contact" width="<?php echo $SiteImageWidth ?>" height="<?php echo $SiteImageHeight ?>"/>'
									}
								},
								{
									style: 'padding:0px 0px 0px 0px',
									xtype: 'button',
									text: 'Upload',
									width: 100,
									tabIndex: 20,
									handler: function () {
										winPicture.show();
										Ext.getDom('newPic').size = 30;
									}
								},
								]
							}]
						}, {
							columnWidth: 1,
							layout: 'column',
							items: [{
								columnWidth: 0.45,
								labelWidth: 150,
								layout: 'form',
								items: [
									{ height: 10 }, {
										xtype: 'textfield',
										name: 'student_surname',
										fieldLabel: 'Student Name <span class="comp">*</span>',
										width: 200,
										tabIndex: 21,
										emptyText: 'Surname',
										allowBlank: false
									}]
							}, {
								columnWidth: 0.28,
								labelWidth: 0.10,
								layout: 'form',
								items: [{ height: 10 }, {
									xtype: 'textfield',
									name: 'student_firstname',
									width: 200,
									tabIndex: 22,
									emptyText: 'First Name',
									allowBlank: false
								}]
							}, {
								columnWidth: 0.25,
								labelWidth: 0.5,
								layout: 'form',
								items: [{ height: 10 }, {
									xtype: 'textfield',
									name: 'student_lastname',
									width: 200,
									tabIndex: 23,
									emptyText: 'Last Name',
									allowBlank: false
								}]
							}]
						},
						{
							columnWidth: 0.5,
							labelWidth: 150,
							layout: 'form',
							items: [{ height: 10 },

							{
								xtype: 'textfield',
								name: 'student_father',
								id: 'student_father',
								fieldLabel: 'Father Full Name ',
								forceSelection: true,
								width: 250,
								allowBlank: true,
								triggerAction: 'all',
								mode: 'local',
								//store: genderstore,
								tabIndex: 24
							},

							{
								xtype: 'textfield',
								name: 'student_guardian',
								id: 'student_guardian',
								fieldLabel: 'Guardian Full Name ',
								forceSelection: true,
								width: 250,
								allowBlank: true,
								triggerAction: 'all',
								mode: 'local',
								tabIndex: 26
							},
							{
								xtype: 'textfield',
								name: 'parent_occupation',
								id: 'parent_occupation',
								width: 250,
								tabIndex: 28,
								fieldLabel: 'Father/Guardian Occupation ',
								allowBlank: true,

							},
							{
								xtype: 'datefield',
								name: 'student_birthdate',
								id: 'student_birthdate',
								width: 200,
								tabIndex: 30,
								format: JSDateFormat,
								fieldLabel: 'Birth Date <span class="comp">*</span>',
								vtype: 'daterange',
								allowBlank: false,
								listeners: {
									change: function (datefield, newValue, oldValue) {
										if (newValue) {
											var birthDate = newValue;
											var today = new Date();

											var year = today.getFullYear() - birthDate.getFullYear();
											var month = today.getMonth() - birthDate.getMonth();
											var day = today.getDate() - birthDate.getDate();

											if (day < 0) {
												month--;  // Adjust month if today's day is earlier than birth date's day
												today.setMonth(today.getMonth() - 1);  // Move today's date to previous month
												day += new Date(today.getFullYear(), today.getMonth() + 1, 0).getDate();  // Calculate correct day
											}

											if (month < 0) {
												year--;  // Adjust year if today's month is earlier than birth date's month
												month += 12;  // Calculate correct month
											}

											var ageString = year + ' years';
											if (month >= 0) {
												ageString += ', ' + month + ' months';
											}
											if (day >= 0) {
												ageString += ', ' + day + ' days';
											}

											Ext.getCmp('student_age').setValue(ageString);
										} else {
											Ext.getCmp('student_age').setValue('');
										}
									}
								}

							},
							{
								xtype: 'textfield',
								name: 'student_birthdateplace',
								id: 'student_birthdateplace',
								width: 200,
								tabIndex: 32,
								fieldLabel: 'Birth Place (એલ.સી.મુજબ):<span class="comp">*</span>',
								allowBlank: false
							},
							{
								xtype: 'combo',
								name: 'student_category',
								id: 'student_category',
								fieldLabel: 'Category ',
								forceSelection: true,
								displayField: 'category',
								valueField: 'category',
								width: 200,
								allowBlank: true,
								triggerAction: 'all',
								mode: 'local',
								store: categorystore,
								tabIndex: 34
							},

							{
								xtype: 'combo',
								name: 'student_cast',
								id: 'student_cast',
								fieldLabel: 'Cast ',
								displayField: 'student_cast',
								forceSelection: false,
								width: 200
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, selectOnFocus: true,
								store: caststore,
								editable: true,
								tabIndex: 36

							}, {
								xtype: 'combo',
								name: 'marital_status',
								id: 'marital_status',
								fieldLabel: 'Marital status ',
								forceSelection: true,
								displayField: 'marital_status',
								valueField: 'marital_status',
								width: 200,
								allowBlank: true,
								triggerAction: 'all',
								mode: 'local',
								store: store,
								tabIndex: 38
							},
							{ height: 20 },
							{
								html: '<b>Contact Detail</b>',       // My Label

							}, { height: 10 },
							{
								xtype: 'checkbox',
								name: 'same_as_present',
								id: 'same_as_present',
								fieldLabel: 'Same as Present Address ',
								listeners: {
									change: function (checkbox, newValue, oldValue) {
										if (newValue) {
											var presentAddressat = Ext.getCmp('student_addressat').getValue();
											var presentAddresspost = Ext.getCmp('student_addresspost').getValue();
											var pincode = Ext.getCmp('student_pincode').getValue();
											var district = Ext.getCmp('dist_nameeng').getValue();
											var takuko = Ext.getCmp('taluko_nameeng').getValue();
											var state = Ext.getCmp('state_nameeng').getValue();
											Ext.getCmp('permanent_addressat').setValue(presentAddressat);
											Ext.getCmp('permanent_addresspost').setValue(presentAddresspost);
											Ext.getCmp('student_pincode1').setValue(pincode);
											Ext.getCmp('dist_nameeng1').setValue(district);
											Ext.getCmp('taluko_nameeng1').setValue(takuko);
											Ext.getCmp('state_nameeng1').setValue(state);
										}
									}
								}
							},

							{
								xtype: 'textfield',
								name: 'student_addressat',
								id: 'student_addressat',
								width: 200,
								fieldLabel: ' Present Address(AT) ',
								allowBlank: true,
								tabIndex: 42
							},
							{
								xtype: 'textfield',
								name: 'student_addresspost',
								id: 'student_addresspost',
								width: 200,
								fieldLabel: ' Present Address(Post) ',
								allowBlank: true,
								tabIndex: 42
							},
							{
								xtype: 'numberfield',
								name: 'student_pincode',
								id: 'student_pincode',
								width: 200,
								tabIndex: 44,
								fieldLabel: 'Present PinCode ',
								allowBlank: true,
								autoCreate: { tag: 'input', maxlength: '6' }
							},
							{
								xtype: 'combo',
								name: 'taluko_nameeng',
								id: 'taluko_nameeng',
								fieldLabel: 'Present Taluko ',
								displayField: 'taluko_nameeng',
								forceSelection: false,
								width: 200
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, selectOnFocus: true,
								store: talukostore,
								editable: true,
								tabIndex: 46
							},
							{
								xtype: 'combo',
								name: 'dist_nameeng',
								id: 'dist_nameeng',
								hiddenName: 'dist_nameeng',
								fieldLabel: 'Present District ',
								forceSelection: true,
								displayField: 'dist_nameeng',
								valueField: 'dist_nameeng'
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, store: districtstore
								, width: 200
								, selectOnFocus: true,
								tabIndex: 48,

							},
							{
								xtype: 'combo',
								name: 'state_nameeng',
								id: 'state_nameeng',
								fieldLabel: 'Present State ',
								displayField: 'state_nameeng',
								forceSelection: false,
								width: 200
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, selectOnFocus: true,
								store: statestore,
								editable: true,
								tabIndex: 50

							},

							{
								xtype: 'combo',
								name: 'student_nationality',
								id: 'student_nationality',
								fieldLabel: 'Nationality ',
								forceSelection: true,
								displayField: 'student_nationality',
								valueField: 'student_nationality',
								width: 200,
								allowBlank: true,
								triggerAction: 'all',
								mode: 'local',
								store: nationalitystore,
								tabIndex: 52,
								listeners: {
									select: function (combo, record) {
										var selectedNationality = record.get('student_nationality');
										var parentNationalityField = Ext.getCmp('parent_nationality');
										var passportValidityField = Ext.getCmp('passport_validity');
										var passportNoField = Ext.getCmp('passport_no');
										var issuedByField = Ext.getCmp('issued_by');

										if (selectedNationality == 'Other') {
											parentNationalityField.enable();
											passportValidityField.enable();
											passportNoField.enable();
											issuedByField.enable();

										} else {
											parentNationalityField.disable();
											passportValidityField.disable();
											passportNoField.disable();
											issuedByField.disable();
											parentNationalityField.reset();
											passportValidityField.reset();
											passportNoField.reset();
											issuedByField.reset();
										}
									}
								}
							},

							{
								xtype: 'textfield',
								name: 'parent_nationality',
								id: 'parent_nationality',
								width: 200,
								tabIndex: 53,
								fieldLabel: 'Parents Nationality ',
								allowBlank: true,
								disabled: true

							},
							{
								xtype: 'datefield',
								name: 'passport_validity',
								id: 'passport_validity',
								width: 200,
								fieldLabel: 'Passport Vaild Up To ',
								vtype: 'daterange',
								allowBlank: true,
								tabIndex: 54,
								maxValue: new Date(),
								disabled: true,
								//value: new Date(),


							},
							{
								xtype: 'textfield',
								name: 'passport_no',
								id: 'passport_no',
								width: 200,
								tabIndex: 55,
								labelSeparator: '',
								fieldLabel: 'Passport No : ',
								allowBlank: true,
								disabled: true
							},
							{
								xtype: 'datefield',
								name: 'issued_by',
								id: 'issued_by',
								width: 200,
								format: JSDateFormat,
								fieldLabel: 'Issued By ',
								vtype: 'daterange',
								allowBlank: true,
								tabIndex: 56,
								maxValue: new Date(),
								disabled: true
								//value: new Date(),


							},
							{
								xtype: 'numberfield',
								name: 'student_phoneo',
								id: 'student_phoneo',
								width: 200,
								tabIndex: 62,
								fieldLabel: 'Other Moblie No1 ',
								allowBlank: true,
								autoCreate: { tag: 'input', maxlength: '10' }
								, enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							},
							{
								xtype: 'numberfield',
								name: 'student_mobilestudents',
								id: 'student_mobilestudents',
								width: 200,
								tabIndex: 64,
								fieldLabel: 'Other Moblie No2 ',
								allowBlank: true,
								autoCreate: { tag: 'input', maxlength: '10' }
								, enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							},

							]
						},
						{
							columnWidth: 0.5,
							labelWidth: 150,
							layout: 'form',
							items: [{ height: 10 },
							{
								xtype: 'textfield',
								name: 'student_mother',
								id: 'student_mother',
								fieldLabel: 'Mother Full Name ',
								forceSelection: true,
								width: 250,
								allowBlank: true,
								triggerAction: 'all',
								mode: 'local',
								tabIndex: 25
							},

							{
								xtype: 'textfield',
								name: 'student_relation',
								id: 'student_relation',
								width: 250,
								tabIndex: 27,
								// format:JSDateFormat,
								fieldLabel: 'Relation(If Guardian ) ',
								//vtype: 'daterange',
								allowBlank: true

							},
							{
								xtype: 'numberfield',
								name: 'parent_income',
								id: 'parent_income',
								width: 200,
								tabIndex: 29,
								fieldLabel: 'Parents Annual Income ',
								allowBlank: true,

							}, { height: 12 },
							{
								xtype: 'textfield',
								name: 'student_age',
								id: 'student_age',
								width: 200,
								tabIndex: 31,
								fieldLabel: 'Age',
								readOnly: true,

							},

							{
								xtype: 'combo',
								name: 'student_gender',
								id: 'student_gender',
								fieldLabel: 'Gender <span class="comp">*</span>',
								forceSelection: true,
								displayField: 'gender',
								valueField: 'gender',
								allowBlank: false
								, triggerAction: 'all'
								, mode: 'local'
								, store: genderstore
								, width: 200
								, selectOnFocus: true,
								tabIndex: 33
							}, { height: 15 },
							{
								xtype: 'textfield',
								name: 'student_religion',
								id: 'student_religion',
								width: 200,
								tabIndex: 35,

								fieldLabel: 'Religion ',

								allowBlank: true

							},
							{
								xtype: 'combo',
								name: 'student_subcast',
								id: 'student_subcast',
								fieldLabel: 'Sub Cast ',
								displayField: 'student_subcast',
								forceSelection: false,
								width: 200
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, selectOnFocus: true,
								store: subcaststore,
								editable: true,
								tabIndex: 37

							},
							{

								xtype: 'combo',
								name: 'student_bloodgroup',
								id: 'student_bloodgroup',
								fieldLabel: 'Blood Group ',
								forceSelection: true,
								tabIndex: 39,
								allowBlank: true,
								displayField: 'bloodgroup',
								valueField: 'bloodgroup',
								width: 200,
								emptyText: '',
								triggerAction: 'all',
								mode: 'local',
								store: bloodgroupstore
							},
							{
								xtype: 'textfield',
								width: 200,
								name: 'student_emailid',
								tabIndex: 41,
								id: 'student_emailid',
								fieldLabel: 'Email ID ',
								vtype: 'email'
								, autoCreate: { tag: 'input', type: 'text', maxlength: '50' }
							},
							{
								xtype: 'textfield',
								id: 'path',
								name: 'path',
								hidden: true
							}, {
								height: 45,
							},
							{
								xtype: 'textfield',
								name: 'permanent_addressat',
								id: 'permanent_addressat',
								width: 200,
								fieldLabel: ' Permanent Address(AT) ',
								allowBlank: true,
								tabIndex: 43
							},
							{
								xtype: 'textfield',
								name: 'permanent_addresspost',
								id: 'permanent_addresspost',
								width: 200,
								fieldLabel: ' Permanent Address(Post) ',
								allowBlank: true,
								tabIndex: 43
							},
							{
								xtype: 'numberfield',
								name: 'student_pincode1',
								id: 'student_pincode1',
								width: 200,
								tabIndex: 45,
								fieldLabel: 'Permanent PinCode ',
								allowBlank: true,
								autoCreate: { tag: 'input', maxlength: '6' }
							},
							{
								xtype: 'combo',
								name: 'taluko_nameeng1',
								id: 'taluko_nameeng1',
								fieldLabel: 'Permanent Taluko ',
								displayField: 'taluko_nameeng1',
								forceSelection: false,
								width: 200
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, selectOnFocus: true,
								store: talukostore1,
								editable: true,
								tabIndex: 47
							},
							{
								xtype: 'combo',
								name: 'dist_nameeng1',
								id: 'dist_nameeng1',
								hiddenName: 'dist_nameeng1',
								fieldLabel: 'Permanent District ',
								forceSelection: true,
								displayField: 'dist_nameeng1',
								valueField: 'dist_nameeng1'
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, store: districtstore1
								, width: 200
								, selectOnFocus: true,
								tabIndex: 49,

							},
							{
								xtype: 'combo',
								name: 'state_nameeng1',
								id: 'state_nameeng1',
								fieldLabel: 'Permanent State ',
								displayField: 'state_nameeng1',
								forceSelection: false,
								width: 200
								, allowBlank: true
								, triggerAction: 'all'
								, mode: 'local'
								, selectOnFocus: true,
								store: statestore1,
								editable: true,
								tabIndex: 51

							},
							{
								xtype: 'combo',
								name: 'student_nri',
								id: 'student_nri',
								fieldLabel: 'NRI Seats ',
								forceSelection: true,
								displayField: 'student_nri',
								valueField: 'student_nri',
								width: 200,
								allowBlank: true,
								triggerAction: 'all',
								mode: 'local',
								store: nristore,
								tabIndex: 57
							},
							{
								xtype: 'numberfield',
								name: 'student_fathermobile',
								id: 'student_fathermobile',
								width: 200,
								autoCreate: { tag: 'input', maxlength: '10' },
								tabIndex: 58,
								fieldLabel: 'Father Mobile No ',
								allowBlank: true,
								enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							}, {
								xtype: 'numberfield',
								name: 'student_mothermobile',
								id: 'student_mothermobile',
								width: 200,
								tabIndex: 59,
								autoCreate: { tag: 'input', maxlength: '10' },
								fieldLabel: 'Mother Mobile No ',
								allowBlank: true,
								enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							},
							{
								xtype: 'numberfield',
								name: 'student_phoner',
								id: 'student_phoner',
								width: 200,
								tabIndex: 60,
								fieldLabel: 'Home Mobile No  ',
								allowBlank: true,
								autoCreate: { tag: 'input', maxlength: '10' }
								, enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							}, {
								xtype: 'numberfield',
								name: 'student_mobileother',
								id: 'student_mobileother',
								width: 200,
								tabIndex: 61,
								fieldLabel: 'Student WhatsApp No ',
								autoCreate: { tag: 'input', maxlength: '10' },
								allowBlank: true,
								enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							},
							{
								xtype: 'numberfield',
								name: 'student_mobileguardian',
								id: 'student_mobileguardian',
								width: 200,
								tabIndex: 63,
								fieldLabel: 'Guardian Whatsapp No  ',
								allowBlank: true,
								autoCreate: { tag: 'input', maxlength: '10' }
								, enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							},
							{
								xtype: 'numberfield',
								name: 'student_mobileparents',
								id: 'student_mobileparents',
								width: 200,
								tabIndex: 65,
								fieldLabel: 'Other WhatsApp No ',
								autoCreate: { tag: 'input', maxlength: '10' },
								allowBlank: true,
								enableKeyEvents: true
								, listeners: {
									keyup: validphoneno
								}
							}
							]
						}

						]
					},
					{
						xtype: 'fieldset',
						title: 'Last Education Details ',
						collapsible: true,
						collapsed: false,
						forceLayout: true,
						autoHeight: true,
						autoHeight: true,
						hideBorders: true,
						layout: 'column',

						items: [
							{
								columnWidth: 1,
								layout: 'column',
								items: [
									{
										columnWidth: 0.50,
										labelWidth: 160,
										layout: 'form',
										items: [{ height: 5 },
										{
											html: '<b>10th Detail</b>',       // My Label
										}, { height: 5 },
										{
											xtype: 'textfield',
											name: 'previous_school',
											fieldLabel: 'Privious 10th School ',
											width: 170,
											tabIndex: 66,
											allowBlank: true
										},
										{
											xtype: 'textfield',
											name: 'student_nameboard',
											fieldLabel: 'Name of 10th Board ',
											id: 'student_nameboard',
											width: 170,
											tabIndex: 68,
											allowBlank: true,
											autoCreate: { tag: 'input', type: 'text', maxlength: '150' }
										}, {
											xtype: 'combo',
											name: 'passing_month',
											id: 'passing_month',
											fieldLabel: 'Passing Month ',
											forceSelection: true,
											displayField: 'month',
											valueField: 'month',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local',
											store: monthstore,
											tabIndex: 69
										},
										{
											xtype: 'textfield',
											name: 'student_examseatno',
											fieldLabel: 'Exam SeatNo ',
											id: 'student_examseatno',
											width: 170,
											tabIndex: 71,
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '12' }
										},

										{
											xtype: 'numberfield',
											name: 'maths_mark',
											fieldLabel: 'Total Score ',
											width: 170,
											tabIndex: 73,
											allowBlank: true
										},
										{
											xtype: 'numberfield',
											name: 'eng_mark',
											width: 170,
											tabIndex: 74,
											fieldLabel: 'Percentage ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '5' }
										}


										]
									},
									{
										columnWidth: 0.50,
										labelWidth: 170,
										layout: 'form',
										items: [{ height: 20 },
										{
											xtype: 'textarea',
											name: 'previous_school_address',
											id: 'previous_school_address',
											width: 170,
											height: 50,
											fieldLabel: 'Privious 10th School Address ',
											allowBlank: true,
											tabIndex: 67

										},
										{
											xtype: 'numberfield',
											name: 'student_yearofpassing',
											fieldLabel: 'Passing Year ',
											id: 'student_yearofpassing',
											width: 170,
											tabIndex: 70,
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '4' }
										},

										{
											xtype: 'numberfield',
											name: 'notrials',
											fieldLabel: 'No of Trials ',
											id: 'notrials',
											width: 170,
											tabIndex: 72,
											allowBlank: true,

										},
										{
											xtype: 'numberfield',
											name: 'sci_mark',
											width: 170,
											tabIndex: 74,
											fieldLabel: 'Obtain Score ',

											allowBlank: true
										}


										]
									}
								]
							},
							{
								columnWidth: 1,
								layout: 'column',
								items: [
									{
										columnWidth: 0.50,
										labelWidth: 160,
										layout: 'form',
										items: [{ height: 5 },

										{ html: '<b>12th Detail</b>' }, { height: 5 },// My Label
										{
											xtype: 'textfield',
											name: 'twle_rank',
											fieldLabel: 'Privious 12th School ',
											width: 170,
											tabIndex: 76,
											allowBlank: true
										},
										{
											xtype: 'textfield',
											name: 'twle_board',
											width: 170,
											tabIndex: 78,
											fieldLabel: 'Name of 12th Board ',
											allowBlank: true
										}, {
											xtype: 'combo',
											name: 'twlepassing_month',
											id: 'twlepassing_month',
											fieldLabel: 'Passing Month ',
											forceSelection: false,
											displayField: 'month',
											valueField: 'month',
											width: 170,
											tabIndex: 79,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local',
											store: monthstore

										},

										{
											xtype: 'textfield',
											name: 'twle_seat',
											width: 170,
											tabIndex: 81,
											fieldLabel: 'Exam SeatNo ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '12' }
										},
										{
											xtype: 'numberfield',
											name: 'twle_total_mark',
											fieldLabel: 'Total Score ',
											width: 170,
											tabIndex: 83,

											allowBlank: true
										},
										{
											xtype: 'numberfield',
											name: 'twle_percentage',
											width: 170,
											tabIndex: 85,
											fieldLabel: 'Percentage ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '5' }
										},
										{
											xtype: 'combo',
											name: 'twle_stream',
											id: 'twle_stream',
											fieldLabel: 'Stream ',
											forceSelection: true,
											displayField: 'twle_stream',
											valueField: 'twle_stream',
											width: 170,
											tabIndex: 87,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local',
											store: streamstore

										}
										]
									},


									{
										columnWidth: 0.50,
										labelWidth: 170,
										layout: 'form',
										items: [{ height: 20 },

										{
											xtype: 'textarea',
											name: 'twl_school_address',
											id: 'twl_school_address',
											width: 170,
											tabIndex: 77,
											height: 55,
											fieldLabel: 'Privious 12th School Address ',
											allowBlank: true

										},
										{
											xtype: 'numberfield',
											name: 'twle_grade',
											width: 170,
											tabIndex: 80,
											fieldLabel: 'Passing Year ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '4' }
										},

										{
											xtype: 'numberfield',
											name: 'twl_notrials',
											fieldLabel: 'No of Trials ',
											id: 'twl_notrials',
											width: 170,
											tabIndex: 82,
											allowBlank: true,
											autoCreate: { tag: 'input', type: 'text', maxlength: '20' }
										},
										{
											xtype: 'numberfield',
											name: 'obtain_mark',
											width: 170,
											tabIndex: 84,
											fieldLabel: 'Obtain Score ',

											allowBlank: true
										},
										{
											xtype: 'numberfield',
											name: 'pr_rank',
											width: 170,
											tabIndex: 86,
											fieldLabel: 'PR Rank ',
											allowBlank: true,
										},
										]
									}

								]
							},
							{
								columnWidth: 1,
								layout: 'column',
								items: [
									{
										columnWidth: 0.33,
										labelWidth: 115,
										layout: 'form',
										items: [{ height: 10 },
										{
											xtype: 'textfield',
											name: 'sci_total',
											width: 100,
											fieldLabel: 'Total ',
											allowBlank: true,
											hidden: true
										}
										]
									},
									{
										columnWidth: 0.33,
										labelWidth: 100,
										layout: 'form',
										items: [{ height: 10 },
										{
											xtype: 'numberfield',
											name: 'sci_percentage',
											width: 100,
											fieldLabel: 'Percentage ',
											allowBlank: true,
											hidden: true,
											autoCreate: { tag: 'input', maxlength: '5' }
										}
										]
									},

								]
							}, {
								columnWidth: 1,
								layout: 'column',
								items: [
									{
										columnWidth: 0.50,
										labelWidth: 160,
										layout: 'form',
										items: [{ height: 5 },
										{
											html: '<b>GNM Detail</b>',       // My Label

										}, { height: 5 },
										{
											xtype: 'textfield',
											name: 'gnm_passcol',
											fieldLabel: 'GNM Passing College ',
											id: 'gnm_passcol',
											width: 170,
											tabIndex: 88,
											allowBlank: true
										}
											, {
											xtype: 'textfield',
											name: 'gnm_regname',
											id: 'gnm_regname',
											tabIndex: 90,
											fieldLabel: 'Current Council Name ',
											forceSelection: true,
											displayField: 'gnm_regname',
											valueField: 'gnm_regname',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local'

										},


										{
											xtype: 'numberfield',
											name: 'gnm_percentage',
											width: 170,
											tabIndex: 92,
											fieldLabel: 'Percentage ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '5' }
										}, {
											xtype: 'combo',
											name: 'gnm_month',
											id: 'gnm_month',
											fieldLabel: 'Passing Month ',
											forceSelection: true,
											displayField: 'month',
											valueField: 'month',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local',
											store: monthstore,
											tabIndex: 69
										}, {
											xtype: 'numberfield',
											name: 'gnm_year',
											fieldLabel: 'Passing  Year ',
											width: 170,
											tabIndex: 94,
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '4' }
										},
										{
											xtype: 'textfield',
											name: 'gnm_regname',
											id: 'gnm_regname',
											tabIndex: 90,
											fieldLabel: 'Current Council Name ',
											forceSelection: true,
											displayField: 'gnm_regname',
											valueField: 'gnm_regname',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local'

										},
										{
											xtype: 'textfield',
											name: 'degdiploma_certino',
											fieldLabel: 'Degree/Diploma Certificate No ',
											id: 'degdiploma_certino',
											width: 170,
											tabIndex: 96,
											allowBlank: true

										},
										{
											xtype: 'datefield',
											name: 'reviling_date',
											id: 'reviling_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Reviling Date',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 98,
											maxValue: new Date(),
											//value: new Date(),
										}



										]
									},
									{
										columnWidth: 0.50,
										labelWidth: 170,
										layout: 'form',
										items: [{ height: 20 },
										{
											xtype: 'textfield',
											name: 'uni_name',
											fieldLabel: 'Name of Council ',
											id: 'uni_name',
											width: 170,
											tabIndex: 89,
											allowBlank: true,
											autoCreate: { tag: 'input', type: 'text', maxlength: '150' }
										},
										{
											xtype: 'textfield',
											name: 'registration_no1',
											fieldLabel: 'Registration No1 ',
											id: 'registration_no1',
											width: 170,
											tabIndex: 91,
											allowBlank: true

										},
										{
											xtype: 'textfield',
											name: 'registration_no2',
											fieldLabel: 'Registration No2 ',
											id: 'registration_no2',
											width: 170,
											tabIndex: 93,
											allowBlank: true

										},
										{
											xtype: 'datefield',
											name: 'reg_date',
											id: 'reg_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 95,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'council_date',
											id: 'council_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Renewal Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 97,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'reg_enddate',
											id: 'reg_enddate',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration End Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 99,
											maxValue: new Date(),
											//value: new Date(),
										}
										]
									}
								]
							},
							{
								columnWidth: 1,
								layout: 'column',
								items: [
									{
										columnWidth: 0.50,
										labelWidth: 160,
										layout: 'form',
										items: [{ height: 5 },
										{
											html: '<b>ANM Detail</b>',       // My Label

										}, { height: 5 },
										{
											xtype: 'textfield',
											name: 'anm_passcol',
											fieldLabel: 'ANM Passing College ',
											id: 'anm_passcol',
											width: 170,
											tabIndex: 100,
											allowBlank: true
										}
											, {
											xtype: 'textfield',
											name: 'anm_regname',
											id: 'anm_regname',
											tabIndex: 102,
											fieldLabel: 'Current Council Name ',
											forceSelection: true,
											displayField: 'anm_regname',
											valueField: 'anm_regname',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local'

										},


										{
											xtype: 'numberfield',
											name: 'anm_percentage',
											width: 170,
											tabIndex: 104,
											fieldLabel: 'Percentage ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '5' }
										}, {
											xtype: 'combo',
											name: 'anm_month',
											id: 'anm_month',
											fieldLabel: 'Passing Month ',
											forceSelection: true,
											displayField: 'month',
											valueField: 'month',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local',
											store: monthstore,
											tabIndex: 69
										}, {
											xtype: 'numberfield',
											name: 'anm_year',
											fieldLabel: 'Passing Year ',
											width: 170,
											tabIndex: 106,
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '4' }
										},
										{
											xtype: 'textfield',
											name: 'anmdegdiploma_certino',
											fieldLabel: 'Degree/Diploma Certificate No ',
											id: 'anmdegdiploma_certino',
											width: 170,
											tabIndex: 96,
											allowBlank: true

										},
										{
											xtype: 'datefield',
											name: 'anmreviling_date',
											id: 'anmreviling_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Reviling Date',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 98,
											maxValue: new Date(),
											//value: new Date(),
										}


										]
									},
									{
										columnWidth: 0.50,
										labelWidth: 170,
										layout: 'form',
										items: [{ height: 20 },
										{
											xtype: 'textfield',
											name: 'anm_uniname',
											fieldLabel: 'Name of Council ',
											id: 'anm_uniname',
											width: 170,
											tabIndex: 101,
											allowBlank: true,
											autoCreate: { tag: 'input', type: 'text', maxlength: '150' }
										},
										{
											xtype: 'textfield',
											name: 'anmregistration_no1',
											fieldLabel: 'Registration No1 ',
											id: 'anmregistration_no1',
											width: 170,
											tabIndex: 103,
											allowBlank: true

										},
										{
											xtype: 'textfield',
											name: 'anmregistration_no2',
											fieldLabel: 'Registration No2 ',
											id: 'anmregistration_no2',
											width: 170,
											tabIndex: 105,
											allowBlank: true

										},
										{
											xtype: 'datefield',
											name: 'anmreg_date',
											id: 'anmreg_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 107,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'anmcouncil_date',
											id: 'anmcouncil_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Renewal Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 108,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'anmreg_enddate',
											id: 'anmreg_enddate',
											width: 170,
											format: JSDateFormat,
											fieldLabel: ' Registration End Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 109,
											maxValue: new Date(),
											//value: new Date(),
										}
										]
									}
								]
							},
							{
								columnWidth: 1,
								layout: 'column',
								items: [
									{
										columnWidth: 0.50,
										labelWidth: 160,
										layout: 'form',
										items: [{ height: 5 },
										{
											html: '<b>BSC  Detail</b>',       // My Label

										}, { height: 5 },
										{
											xtype: 'textfield',
											name: 'bsc_passcol',
											fieldLabel: 'BSC Passing College ',
											id: 'bsc_passcol',
											width: 170,
											tabIndex: 110,
											allowBlank: true
										}
											, {
											xtype: 'textfield',
											name: 'bsc_regname',
											id: 'bsc_regname',
											tabIndex: 112,
											fieldLabel: 'Current Council Name ',
											forceSelection: true,
											displayField: 'bsc_regname',
											valueField: 'bsc_regname',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local'

										},
										{
											xtype: 'numberfield',
											name: 'bsc_per',
											width: 170,
											tabIndex: 114,
											fieldLabel: 'Percentage ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '5' }
										}, {
											xtype: 'combo',
											name: 'bsc_month',
											id: 'bsc_month',
											fieldLabel: 'Passing Month ',
											forceSelection: true,
											displayField: 'month',
											valueField: 'month',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local',
											store: monthstore,
											tabIndex: 69
										}, {
											xtype: 'numberfield',
											name: 'bsc_year',
											fieldLabel: 'Passing Year ',
											width: 170,
											tabIndex: 116,
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '4' }
										}, {
											xtype: 'textfield',
											name: 'bscdegdiploma_certino',
											fieldLabel: 'Degree/Diploma Certificate No ',
											id: 'bscdegdiploma_certino',
											width: 170,
											tabIndex: 118,
											allowBlank: true

										},
										{
											xtype: 'textfield',
											name: 'additional_regno',
											fieldLabel: 'Additional Registration No ',
											id: 'additional_regno',
											width: 170,
											tabIndex: 120,
											allowBlank: true
										}
										]
									},
									{
										columnWidth: 0.50,
										labelWidth: 170,
										layout: 'form',
										items: [{ height: 20 },
										{
											xtype: 'textfield',
											name: 'bsc_uniname',
											fieldLabel: 'Name of University ',
											id: 'bsc_uniname',
											width: 170,
											tabIndex: 111,
											allowBlank: true,
											autoCreate: { tag: 'input', type: 'text', maxlength: '150' }
										},
										{
											xtype: 'textfield',
											name: 'bscregistration_no1',
											fieldLabel: 'Registration No1 ',
											id: 'bscregistration_no1',
											width: 170,
											tabIndex: 113,
											allowBlank: true

										},
										{
											xtype: 'textfield',
											name: 'bscregistration_no2',
											fieldLabel: 'Registration No2 ',
											id: 'bscregistration_no2',
											width: 170,
											tabIndex: 115,
											allowBlank: true

										},
										{
											xtype: 'datefield',
											name: 'bscreg_date',
											id: 'bscreg_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 117,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'bsccouncil_date',
											id: 'bsccouncil_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Renewal Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 119,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'bscreg_enddate',
											id: 'bscreg_enddate',
											width: 170,
											format: JSDateFormat,
											fieldLabel: ' Registration End Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 121,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'bscreviling_date',
											id: 'bscreviling_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Reviling Date',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 98,
											maxValue: new Date(),
											//value: new Date(),
										}
										]
									}
								]
							},
							{
								columnWidth: 1,
								layout: 'column',
								items: [
									{
										columnWidth: 0.50,
										labelWidth: 160,
										layout: 'form',
										items: [{ height: 5 },
										{
											html: '<b>P.B.B.SC. Detail</b>',       // My Label

										}, { height: 5 },
										{
											xtype: 'textfield',
											name: 'pbbsc_passcol',
											fieldLabel: 'PBBSC Passing College ',
											id: 'pbbsc_passcol',
											width: 170,
											tabIndex: 122,
											allowBlank: true
										}
											, {
											xtype: 'textfield',
											name: 'pbbsc_regname',
											id: 'pbbsc_regname',
											tabIndex: 124,
											fieldLabel: 'Current Council Name ',
											forceSelection: true,
											displayField: 'pbbsc_regname',
											valueField: 'pbbscregname',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local'

										},


										{
											xtype: 'numberfield',
											name: 'pbbsc_percentage',
											width: 170,
											tabIndex: 126,
											fieldLabel: 'Percentage ',
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '5' }
										}, {
											xtype: 'combo',
											name: 'pbbsc_month',
											id: 'pbbsc_month',
											fieldLabel: 'Passing Month ',
											forceSelection: true,
											displayField: 'month',
											valueField: 'month',
											width: 170,
											allowBlank: true,
											triggerAction: 'all',
											mode: 'local',
											store: monthstore,
											tabIndex: 69
										}, {
											xtype: 'numberfield',
											name: 'pbbsc_year',
											fieldLabel: 'Passing  Year ',
											width: 170,
											tabIndex: 128,
											allowBlank: true,
											autoCreate: { tag: 'input', maxlength: '4' }
										},
										{
											xtype: 'textfield',
											name: 'pbbscdegdiploma_certino',
											fieldLabel: 'Degree/Diploma Certificate No ',
											id: 'pbbscdegdiploma_certino',
											width: 170,
											tabIndex: 118,
											allowBlank: true

										},
										]
									},
									{
										columnWidth: 0.50,
										labelWidth: 170,
										layout: 'form',
										items: [{ height: 20 },
										{
											xtype: 'textfield',
											name: 'pbbsc_uniname',
											fieldLabel: 'Name of Council/University ',
											id: 'pbbsc_uniname',
											width: 170,
											tabIndex: 123,
											allowBlank: true,
											autoCreate: { tag: 'input', type: 'text', maxlength: '150' }
										},
										{
											xtype: 'textfield',
											name: 'pbbscregistration_no1',
											fieldLabel: 'Registration No1 ',
											id: 'pbbscregistration_no1',
											width: 170,
											tabIndex: 125,
											allowBlank: true

										},
										{
											xtype: 'textfield',
											name: 'pbbscregistration_no2',
											fieldLabel: 'Registration No2 ',
											id: 'pbbscregistration_no2',
											width: 170,
											tabIndex: 127,
											allowBlank: true

										},
										{
											xtype: 'datefield',
											name: 'pbbscreg_date',
											id: 'pbbscreg_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 129,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'pbbsccouncil_date',
											id: 'pbbsccouncil_date',
											width: 170,
											format: JSDateFormat,
											fieldLabel: 'Registration Renewal Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 130,
											maxValue: new Date(),
											//value: new Date(),
										},
										{
											xtype: 'datefield',
											name: 'pbbscreg_enddate',
											id: 'pbbscreg_enddate',
											width: 170,
											format: JSDateFormat,
											fieldLabel: ' Registration End Date ',
											vtype: 'daterange',
											allowBlank: true,
											tabIndex: 131,
											maxValue: new Date(),
											//value: new Date(),
										}
										]
									}
								]
							}

						]
					},

					{
						xtype: 'fieldset',
						title: 'Bank Details',
						collapsible: true,
						collapsed: false,
						forceLayout: true,
						autoHeight: true,
						id: 'Bankdetails',

						hideBorders: true,
						layout: 'column',
						items: [{
							columnWidth: 1,
							layout: 'column',
							items: [{
								columnWidth: 0.5,
								labelWidth: 150,
								layout: 'form',
								items: [{ height: 10 }, {
									xtype: 'textfield',
									name: 'bank_name',
									fieldLabel: 'Bank Name ',
									width: 200,
									tabIndex: 158,
									allowBlank: true
								},
								{
									xtype: 'numberfield',
									name: 'bank_account_no',
									width: 200,
									tabIndex: 160,
									fieldLabel: 'Account No ',
									allowBlank: true
								},
								{
									xtype: 'textfield',
									name: 'bank_ifsc_code',
									width: 200,
									tabIndex: 161,
									fieldLabel: ' IFSC Code ',
									allowBlank: true
								}]
							}, {
								columnWidth: 0.5,
								labelWidth: 150,
								layout: 'form',
								items: [{ height: 10 },
								{
									xtype: 'textarea',
									name: 'bank_address',
									id: 'bank_address',
									fieldLabel: 'Bank Address ',
									forceSelection: true,
									width: 200,
									height: 48,
									allowBlank: true,
									triggerAction: 'all',
									mode: 'local',
									tabIndex: 159
								}, {
									xtype: 'textfield',
									name: 'bank_city',
									id: 'bank_city',
									labelSeparator: '',
									fieldLabel: 'Bank Branch Name: ',
									forceSelection: true,
									width: 200,
									allowBlank: true,
									triggerAction: 'all',
									mode: 'local',
									tabIndex: 162
								}
								]
							}]
						}
						]
					}
				]
			});
			function validate() {
				var fruits = ["txt", "TXT", "xls", "XLS", "pdf", "PDF", "jpg", "JPG", "gif", "gif", "png", "PNG", "jpeg", "JPEG", "doc", "DOC", "docx", "DOCX", "ppt", "pptx", "flv"];
				var f_ext = document.getElementById("student_photo").value.match(/(.{3}$)/)[1];

				var a = fruits.indexOf(f_ext);
				if (a == -1) {
					alert(" Invalid file format, please try again!");
					document.getElementById("student_photo").value = '';
					document.getElementById("student_photo").focus();
					return false;
				}
				else {
					return true;
				}
			}
			var StudentWindow = new Ext.Window({
				title: 'Student Detail Form',
				width: 930,
				height: 460,
				modal: true,
				autoHeight: true,
				shadow: false,
				border: false,
				layout: 'fit',
				closeAction: 'close',
				collapsible: true,
				items: studententry,
				buttonAlign: 'center',
				buttons: [{
					text: 'Save',
					tabIndex: 181,
					iconCls: 'icon-save',
					handler: function () {
						var flage = 0;
						//alert("IN sAVE");
						if (Ext.getCmp('student_photo').getValue() != '') {

							var res = validate();
							if (res) {
								flage = 1;
							}
							else {
								flage = 0;
							}
						}
						else {
							flage = 1;
						}
						if (flage == 1) {
							studententry.getForm().submit({
								waitMsg: 'Saving...',
							
									success: function (form, action) {
									if (action.result && action.result.sessionExpired) {
								
										Ext.MessageBox.show({
											title: 'Session Expired',
											msg: 'Your session has expired. Please log in again.',
											buttons: Ext.MessageBox.OK,
											icon: Ext.MessageBox.ERROR,
											fn: function () {
												window.location = 'login.php';  
											}
										});
									} else {
										fflag = 1;
										Ext.MessageBox.show({
											title: 'Message',
											msg: 'Data has been saved..',
											buttons: Ext.MessageBox.OK,
											icon: Ext.MessageBox.INFO
										});
										studententry.getForm().reset();
										if (formMode == 'edit') {
											window.location = 'manage-student.php';
										}
										Ext.getDom('pic').src = '<?php print "upload" . $StudentPath . "/" . $SiteDefaultImage; ?>';
									}
								},
								failure: function (form, action) {
									Ext.MessageBox.show({
										title: 'Error',
										msg: 'Please fill complete form!',
										buttons: Ext.MessageBox.OK,
										icon: Ext.MessageBox.ERROR
									});
									if (formMode == 'edit') {
										studententry.getForm().findField('student_grno').disable();
									}
								}
							});
						}
					}
				},
				{
					text: 'Reset',
					tabIndex: 182,
					iconCls: 'icon-reset',
					handler: function () {

						if (formMode != 'edit') {
							studententry.getForm().reset();
							Ext.getDom('pic').src = '<?php print "upload" . $StudentPath . $student_id . "/" . $SiteDefaultImage; ?>';
						}
						Ext.getCmp('branch_id').focus(true, 1000);

					}
				},
				{
					text: 'Close',
					iconCls: 'icon-close',
					tabIndex: 183,
					handler: function () {
						StudentWindow.close();
					}
				}
				]

			});
			studententry.getForm().findField('sci_mark').on('blur', function () {

				var maths = studententry.getForm().findField('maths_mark').getValue();

				var sci = studententry.getForm().findField('sci_mark').getValue();

				var eng = studententry.getForm().findField('eng_mark').getValue();
				//alert(1);
				var total_mark = (sci * 100);

				var per = total_mark / maths;

				var set = studententry.getForm().findField('eng_mark').setValue(per);

			});

			studententry.getForm().findField('obtain_mark').on('blur', function () {

				var twle_total_mark = studententry.getForm().findField('twle_total_mark').getValue();

				var obtain_mark = studententry.getForm().findField('obtain_mark').getValue();


				var total_mark = (obtain_mark * 100);

				var per = total_mark / twle_total_mark;

				var set = studententry.getForm().findField('twle_percentage').setValue(per);

			});


			studententry.getForm().findField('sci_total').on('blur', function () {

				var twle_maths = Number(studententry.getForm().findField('twle_maths').getValue()); twle_biology
				var twle_biology = Number(studententry.getForm().findField('twle_biology').getValue());
				var twle_chemistry = Number(studententry.getForm().findField('twle_chemistry').getValue());
				var twle_physics = Number(studententry.getForm().findField('twle_physics').getValue());
				var twle_other = Number(studententry.getForm().findField('twle_other').getValue());
				var chemistry_practical = Number(studententry.getForm().findField('chemistry_practical').getValue());
				var physics_practical = Number(studententry.getForm().findField('physics_practical').getValue());
				var other_practical = Number(studententry.getForm().findField('other_practical').getValue());

				var total = twle_maths + twle_biology + twle_chemistry + twle_physics + twle_other + chemistry_practical + physics_practical + other_practical;
				var settotal = studententry.getForm().findField('sci_obtain').setValue(total);

				var sci_total = Number(studententry.getForm().findField('sci_total').getValue());

				var total_mark = (total * 100);

				var per = total_mark / sci_total;

				var set = studententry.getForm().findField('sci_percentage').setValue(per);

			});

			var varWidth = (screen.width - StudentWindow.width) / 2;
			StudentWindow.setPosition(varWidth, ((screen.height / 4) - 180));
			StudentWindow.show();

			Ext.getCmp('student_gturegno').on('blur', function () {
				var student_gturegno = Ext.getCmp('student_gturegno').getValue();
				var student_id = '<?php echo $student_id; ?>';
				if (student_gturegno != "") {
					Ext.Ajax.request({
						loadMask: true,
						sync: true,
						url: 'data/check-duplication.php',
						params: { action: 'gtuno', student_gturegno: student_gturegno, student_id: student_id },
						success: function (resp) {
							resbool = Ext.decode(resp.responseText).success;
							if (resbool == 'false') {
								Ext.MessageBox.show({
									title: 'Error',
									msg: 'gtu reg no is already exists.',
									buttons: Ext.MessageBox.OK,
									icon: Ext.MessageBox.ERROR
								});
								Ext.getCmp('student_gturegno').reset();
							}
						}
					});
				}
			});

			Ext.getCmp('student_examseatno').on('blur', function () {
				var student_examseatno = Ext.getCmp('student_examseatno').getValue();
				var student_id = '<?php echo $student_id; ?>';
				if (student_examseatno != "") {
					Ext.Ajax.request({
						loadMask: true,
						sync: true,
						url: 'data/check-duplication.php',
						params: { action: 'student_examseatno', student_examseatno: student_examseatno, student_id: student_id },
						success: function (resp) {
							resbool = Ext.decode(resp.responseText).success;
							if (resbool == 'false') {
								Ext.MessageBox.show({
									title: 'Error',
									msg: 'gtu reg no is already exists.',
									buttons: Ext.MessageBox.OK,
									icon: Ext.MessageBox.ERROR
								});
								Ext.getCmp('student_gturegno').reset();
							}
						}
					});
				}
			});

			if (formMode == 'edit') {
				<?php

				
				$student_remarks = replaceSpecial($student_remarks); ?>

				Ext.getDom('pic').src = '<?php print "upload" . $StudentPath . $student_id . "/" . $student_photo; ?>';

				studententry.getForm().findField('branch_id').disable();
				studententry.getForm().findField('year_id').disable();
				studententry.getForm().findField('branchyear_id').disable();
				studententry.getForm().findField('semester_id').disable();
				
				studententry.getForm().findField('branch_id').setValue(<?php echo $cur_branchid; ?>);
				
				studententry.getForm().findField('semester_id').setValue(<?php echo $cur_semesterid; ?>);
				studententry.getForm().findField('msc_subject').setValue('<?php echo $msc_subject; ?>');
				studententry.getForm().findField('student_mother').setValue('<?php echo $student_mother; ?>');

				studententry.getForm().findField('student_father').setValue('<?php echo $student_father; ?>');

				studententry.getForm().findField('student_formno').setValue('<?php echo $student_formno; ?>');
				studententry.getForm().findField('student_surname').setValue('<?php echo $student_surname; ?>');
				studententry.getForm().findField('student_firstname').setValue('<?php echo $student_firstname; ?>');
				studententry.getForm().findField('student_lastname').setValue('<?php echo $student_lastname; ?>');
				studententry.getForm().findField('student_category').setValue('<?php echo $student_category; ?>');
				studententry.getForm().findField('student_gender').setValue('<?php echo $student_gender; ?>');
				studententry.getForm().findField('student_bloodgroup').setValue('<?php echo $student_bloodgroup; ?>');
				studententry.getForm().findField('student_birthdate').setValue('<?php echo $student_birthdate; ?>');
				studententry.getForm().findField('student_birthdateplace').setValue('<?php echo $student_birthdateplace; ?>');
				studententry.getForm().findField('student_age').setValue('<?php echo $student_age; ?>');
				studententry.getForm().findField('parent_occupation').setValue('<?php echo $parent_occupation; ?>');
				studententry.getForm().findField('student_nri').setValue('<?php echo $student_nri; ?>');
				studententry.getForm().findField('student_gturegno').setValue('<?php echo $student_gturegno; ?>');
				studententry.getForm().findField('student_admdate').setValue('<?php echo $student_admdate; ?>');
				studententry.getForm().findField('student_lastcollege').setValue('<?php echo $student_lastcollege; ?>');

				studententry.getForm().findField('student_nameboard').setValue('<?php echo $student_nameboard; ?>');
				studententry.getForm().findField('student_examseatno').setValue('<?php echo $student_examseatno; ?>');

				studententry.getForm().findField('student_mobileother').setValue('<?php echo $student_mobileother; ?>');
				studententry.getForm().findField('student_yearofpassing').setRawValue('<?php echo $student_yearofpassing; ?>');
				//2/08
				studententry.getForm().findField('student_addressat').setValue('<?php echo $student_addressat; ?>');
				studententry.getForm().findField('student_addresspost').setValue('<?php echo $student_addresspost; ?>');

				studententry.getForm().findField('permanent_addressat').setValue('<?php echo $permanent_addressat; ?>');
				studententry.getForm().findField('permanent_addresspost').setValue('<?php echo $permanent_addresspost; ?>');

				studententry.getForm().findField('student_pincode').setValue('<?php echo $student_pincode; ?>');
				studententry.getForm().findField('student_phoneo').setValue('<?php echo $student_phoneo; ?>');
				studententry.getForm().findField('student_mobilestudents').setValue('<?php echo $student_mobilestudents; ?>');
				studententry.getForm().findField('student_emailid').setValue('<?php echo $student_emailid; ?>');
				studententry.getForm().findField('student_cast').setValue('<?php echo $student_cast; ?>');
				studententry.getForm().findField('student_subcast').setValue('<?php echo $student_subcast; ?>');
				studententry.getForm().findField('student_religion').setValue('<?php echo $student_religion; ?>');

				studententry.getForm().findField('maths_mark').setValue('<?php echo $maths_mark; ?>');
				studententry.getForm().findField('sci_mark').setValue('<?php echo $sci_mark; ?>');
				studententry.getForm().findField('eng_mark').setValue('<?php echo $eng_mark; ?>');
				studententry.getForm().findField('previous_school').setValue('<?php echo $previous_school; ?>');
				studententry.getForm().findField('previous_school_address').setValue('<?php echo preg_replace("/\r|\n/", " ", $previous_school_address); ?>');
				studententry.getForm().findField('twl_school_address').setValue('<?php echo preg_replace("/\r|\n/", " ", $twl_school_address); ?>');
				studententry.getForm().findField('notrials').setValue('<?php echo $notrials; ?>');
				studententry.getForm().findField('passing_month').setValue('<?php echo $passing_month; ?>');
				studententry.getForm().findField('twlepassing_month').setValue('<?php echo $twlepassing_month; ?>');
				studententry.getForm().findField('twle_total_mark').setValue('<?php echo $twle_total_mark; ?>');
				studententry.getForm().findField('obtain_mark').setValue('<?php echo $obtain_mark; ?>');
				studententry.getForm().findField('twle_percentage').setValue('<?php echo $twle_percentage; ?>');
				studententry.getForm().findField('twle_grade').setValue('<?php echo $twle_grade; ?>');
				studententry.getForm().findField('twle_board').setValue('<?php echo $twle_board; ?>');
				studententry.getForm().findField('bank_name').setValue('<?php echo $bank_name; ?>');
				studententry.getForm().findField('bank_account_no').setValue('<?php echo $bank_account_no; ?>');
				studententry.getForm().findField('bank_ifsc_code').setValue('<?php echo $bank_ifsc_code; ?>');
				studententry.getForm().findField('bank_city').setValue('<?php echo $bank_city; ?>');
				studententry.getForm().findField('bank_address').setValue('<?php echo preg_replace("/\r|\n/", " ", $bank_address); ?>');
			
				studententry.getForm().findField('student_adharno').setValue('<?php echo $student_adharno; ?>');
				studententry.getForm().findField('dist_nameeng').setValue('<?php echo $dist_nameeng; ?>');
				studententry.getForm().findField('taluko_nameeng').setValue('<?php echo $taluko_nameeng; ?>');
				studententry.getForm().findField('state_nameeng').setValue('<?php echo $state_nameeng; ?>');
				studententry.getForm().findField('dist_nameeng1').setValue('<?php echo $dist_nameeng1; ?>');

				studententry.getForm().findField('student_pincode1').setValue('<?php echo $student_pincode1; ?>');
				studententry.getForm().findField('taluko_nameeng1').setValue('<?php echo $taluko_nameeng1; ?>');
				studententry.getForm().findField('state_nameeng1').setValue('<?php echo $state_nameeng1; ?>');
				studententry.getForm().findField('parent_income').setValue('<?php echo $parent_income; ?>');
				studententry.getForm().findField('twle_rank').setValue('<?php echo $twle_rank; ?>');


				//mansi
				studententry.getForm().findField('branchyear_id').setValue('<?php echo $cur_branchyearid; ?>');
				studententry.getForm().findField('year_id').setValue(<?php echo $year_id; ?>);
				studententry.getForm().findField('adm_conformation').setValue('<?php echo $adm_conformation; ?>');
				studententry.getForm().findField('reporting_date').setValue('<?php echo $reporting_date; ?>');
				studententry.getForm().findField('student_admby').setValue('<?php echo $student_admby; ?>');
				studententry.getForm().findField('student_ref').setValue('<?php echo $student_ref; ?>');
				studententry.getForm().findField('transport_facility').setValue('<?php echo $transport_facility; ?>');
				studententry.getForm().findField('hostel_admdate').setValue('<?php echo $hostel_admdate; ?>');
				studententry.getForm().findField('hostel_candate').setValue('<?php echo $hostel_candate; ?>');
				studententry.getForm().findField('updown_strdate').setValue('<?php echo $updown_strdate; ?>');
				studententry.getForm().findField('updown_enddate').setValue('<?php echo $updown_enddate; ?>');
				studententry.getForm().findField('tfw_scheme').setValue('<?php echo $tfw_scheme; ?>');
				studententry.getForm().findField('student_grno').setValue('<?php echo $student_grno; ?>');
				studententry.getForm().findField('student_guardian').setValue('<?php echo $student_guardian; ?>');
				studententry.getForm().findField('student_relation').setValue('<?php echo $student_relation; ?>');
				studententry.getForm().findField('gnm_passcol').setValue('<?php echo $gnm_passcol; ?>');
				studententry.getForm().findField('uni_name').setValue('<?php echo $uni_name; ?>');
				studententry.getForm().findField('gnm_regname').setValue('<?php echo $gnm_regname; ?>');
				studententry.getForm().findField('gnm_percentage').setValue('<?php echo $gnm_percentage; ?>');
				studententry.getForm().findField('gnm_year').setValue('<?php echo $gnm_year; ?>');
				studententry.getForm().findField('degdiploma_certino').setValue('<?php echo $degdiploma_certino; ?>');
				studententry.getForm().findField('reviling_date').setValue('<?php echo $reviling_date; ?>');
				studententry.getForm().findField('reg_date').setValue('<?php echo $reg_date; ?>');
				studententry.getForm().findField('council_date').setValue('<?php echo $council_date; ?>');
				studententry.getForm().findField('reg_enddate').setValue('<?php echo $reg_enddate; ?>');

				studententry.getForm().findField('anm_passcol').setValue('<?php echo $anm_passcol; ?>');
				studententry.getForm().findField('anm_regname').setValue('<?php echo $anm_regname; ?>');
				studententry.getForm().findField('anm_percentage').setValue('<?php echo $anm_percentage; ?>');
				studententry.getForm().findField('anm_year').setValue('<?php echo $anm_year; ?>');
				//2-08
				studententry.getForm().findField('anmdegdiploma_certino').setValue('<?php echo $anmdegdiploma_certino; ?>');
				studententry.getForm().findField('anmreviling_date').setValue('<?php echo $anmreviling_date; ?>');
				studententry.getForm().findField('anm_uniname').setValue('<?php echo $anm_uniname; ?>');
				studententry.getForm().findField('anmregistration_no1').setValue('<?php echo $anmregistration_no1; ?>');
				studententry.getForm().findField('anmregistration_no2').setValue('<?php echo $anmregistration_no2; ?>');
				studententry.getForm().findField('anmreg_date').setValue('<?php echo $anmreg_date; ?>');
				studententry.getForm().findField('anmcouncil_date').setValue('<?php echo $anmcouncil_date; ?>');
				studententry.getForm().findField('anmreg_enddate').setValue('<?php echo $anmreg_enddate; ?>');


				studententry.getForm().findField('bsc_passcol').setValue('<?php echo $bsc_passcol; ?>');
				studententry.getForm().findField('bsc_regname').setValue('<?php echo $bsc_regname; ?>');
				studententry.getForm().findField('bsc_per').setValue('<?php echo $bsc_per; ?>');
				studententry.getForm().findField('bsc_year').setValue('<?php echo $bsc_year; ?>');
				studententry.getForm().findField('bscdegdiploma_certino').setValue('<?php echo $bscdegdiploma_certino; ?>');
				studententry.getForm().findField('additional_regno').setValue('<?php echo $additional_regno; ?>');
				studententry.getForm().findField('bsc_uniname').setValue('<?php echo $bsc_uniname; ?>');
				studententry.getForm().findField('bscregistration_no1').setValue('<?php echo $bscregistration_no1; ?>');
				studententry.getForm().findField('bscregistration_no2').setValue('<?php echo $bscregistration_no2; ?>');
				studententry.getForm().findField('bscreg_date').setValue('<?php echo $bscreg_date; ?>');
				studententry.getForm().findField('bsccouncil_date').setValue('<?php echo $bsccouncil_date; ?>');
				studententry.getForm().findField('bscreg_enddate').setValue('<?php echo $bscreg_enddate; ?>');
				//02-08
				studententry.getForm().findField('bscreviling_date').setValue('<?php echo $bscreviling_date; ?>');

				studententry.getForm().findField('pbbsc_passcol').setValue('<?php echo $pbbsc_passcol; ?>');
				studententry.getForm().findField('pbbsc_regname').setValue('<?php echo $pbbsc_regname; ?>');
				studententry.getForm().findField('pbbsc_percentage').setValue('<?php echo $pbbsc_percentage; ?>');
				studententry.getForm().findField('pbbsc_year').setValue('<?php echo $pbbsc_year; ?>');
				studententry.getForm().findField('pbbscdegdiploma_certino').setValue('<?php echo $pbbscdegdiploma_certino; ?>');

				studententry.getForm().findField('pbbsc_uniname').setValue('<?php echo $pbbsc_uniname; ?>');
				studententry.getForm().findField('pbbscregistration_no1').setValue('<?php echo $pbbscregistration_no1; ?>');
				studententry.getForm().findField('pbbscregistration_no2').setValue('<?php echo $pbbscregistration_no2; ?>');
				studententry.getForm().findField('pbbscreg_date').setValue('<?php echo $pbbscreg_date; ?>');
				studententry.getForm().findField('pbbsccouncil_date').setValue('<?php echo $pbbsccouncil_date; ?>');

				studententry.getForm().findField('pbbscreg_enddate').setValue('<?php echo $pbbscreg_enddate; ?>');


				studententry.getForm().findField('twle_stream').setValue('<?php echo $twle_stream; ?>');
				studententry.getForm().findField('pr_rank').setValue('<?php echo $pr_rank; ?>');
				studententry.getForm().findField('student_phoner').setValue('<?php echo $student_phoner; ?>');
				studententry.getForm().findField('student_mobileguardian').setValue('<?php echo $student_mobileguardian; ?>');
				studententry.getForm().findField('student_fathermobile').setValue('<?php echo $student_fathermobile; ?>');
				studententry.getForm().findField('student_mothermobile').setValue('<?php echo $student_mothermobile; ?>');
				studententry.getForm().findField('student_mobileparents').setValue('<?php echo $student_mobileparents; ?>');
				studententry.getForm().findField('marital_status').setValue('<?php echo $marital_status; ?>');
				studententry.getForm().findField('student_nationality').setValue('<?php echo $student_nationality; ?>');
				studententry.getForm().findField('parent_nationality').setValue('<?php echo $parent_nationality; ?>');
				studententry.getForm().findField('passport_validity').setValue('<?php echo $passport_validity; ?>');
				studententry.getForm().findField('passport_no').setValue('<?php echo $passport_no; ?>');
				studententry.getForm().findField('issued_by').setValue('<?php echo $issued_by; ?>');

				studententry.getForm().findField('registration_no1').setValue('<?php echo $registration_no1; ?>');
				studententry.getForm().findField('registration_no2').setValue('<?php echo $registration_no2; ?>');

				studententry.getForm().findField('gnm_month').setValue('<?php echo $gnm_month; ?>');
				studententry.getForm().findField('anm_month').setValue('<?php echo $anm_month; ?>');
				studententry.getForm().findField('bsc_month').setValue('<?php echo $bsc_month; ?>');
				studententry.getForm().findField('pbbsc_month').setValue('<?php echo $pbbsc_month; ?>');

				if (student_lastcollege != "") {
					studententry.getForm().findField('student_lastcollege').enable();
					Ext.getCmp('student_lastcollege_check').setValue(1);
				}

				if (tfw_scheme == 1) {
					Ext.getCmp('tfw_scheme').setValue(1);
				}


				if (transport_facility != "") {
					studententry.getForm().findField('student_lastcollege').enable();
					Ext.getCmp('student_lastcollege_check').setValue(1);
				}
				var msc_subjectField = studententry.getForm().findField('msc_subject');
				if (msc_subjectField.getValue() !== '') {
					msc_subjectField.show();
				}

				var semester_idField = studententry.getForm().findField('semester_id');
				if (semester_idField.getValue() !== '') {
					semester_idField.enable();
				}
				var hostel_admdateField = studententry.getForm().findField('hostel_admdate');
				var hostel_candateField = studententry.getForm().findField('hostel_candate');
				var updown_strdateField = studententry.getForm().findField('updown_strdate');
				var updown_enddateField = studententry.getForm().findField('updown_enddate');

				if (hostel_admdateField.getValue() !== '') {
					hostel_admdateField.enable();
				}

				if (hostel_candateField.getValue() !== '') {
					hostel_candateField.enable();
				}

				if (updown_strdateField.getValue() !== '') {
					updown_strdateField.enable();
				}

				if (updown_enddateField.getValue() !== '') {
					updown_enddateField.enable();
				}


				var parentNationalityField = Ext.getCmp('parent_nationality');
				var passportValidityField = Ext.getCmp('passport_validity');
				var passportNoField = Ext.getCmp('passport_no');
				var issuedByField = Ext.getCmp('issued_by');

				if (parentNationalityField.getValue() !== '') {
					parentNationalityField.enable();

				}

				if (passportValidityField.getValue() !== '') {
					passportValidityField.enable();
				}

				if (passportNoField.getValue() !== '') {
					passportNoField.enable();
				}
				if (issuedByField.getValue() !== '') {
					issuedByField.enable();
				}

				studententry.getForm().findField('twle_seat').setValue('<?php echo $twle_seat; ?>');
				studententry.getForm().findField('twl_notrials').setValue('<?php echo $twl_notrials; ?>');
				studententry.getForm().findField('sci_total').setValue('<?php echo $sci_total; ?>');
				studententry.getForm().findField('sci_percentage').setValue('<?php echo $sci_percentage; ?>');



				var tfw_scheme = '<?php echo $tfw_scheme; ?>';


				var student_lastcollege = '<?php echo $student_lastcollege; ?>';


			}
			else {

				//Ext.getCmp('fees_flag').setValue('0');
			}

			Ext.getCmp('branch_id').focus(true, 1000);
			function take_snapshot() {
				//webcam.snap();
			}
			function PhotoCapture() {
			}

		});
	</script>
	<script type="text/javascript">
		webcam.set_hook('onComplete', 'my_completion_handler');
		function crop(image_url) {
			new Cropper.ImgWithPreview(
				image_url,
				{
					minWidth: 100,
					minHeight: 150,
					ratioDim: { x: 100, y: 150 },
					displayOnInit: true,
					onEndCrop: saveCoords,
					onloadCoords: { x1: 0, y1: 0, x2: 100, y2: 150 },
					previewWrap: 'preview'
				}
			)
		}
		function saveCoords(coords, dimensions) {
			$('x1').value = coords.x1;
			$('y1').value = coords.y1;
			$('width').value = dimensions.width;
			$('height').value = dimensions.height;
		}
		function take_snapshot() {
			webcam.snap();
		}

	</script>

	<div align="center">
		<div id="abcd" align="left"></div>
	</div>
</div>

<?php require "_footer.php"; ?>