0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.138.120.112


Current Path : /var/www/html/vskub/adm_stop/js/
Upload File :
Current File : /var/www/html/vskub/adm_stop/js/MainPage.js

var verify = 0;

var $host_url =
  "https://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1] +
  "/" +
  window.location.pathname.split("/")[2] +
  "/app.php?a=";

//var $host_url="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/app.php?a=";

function acceptNumbersOnlyForModule(evt) {
  var charCode;
  if (window.event) charCode = window.event.keyCode;
  //if IE
  else charCode = evt.which; //if firefox
  if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
  return true;
}

function charKeydown(evt) {
  var charCode;
  if (window.event) charCode = window.event.keyCode;
  //for IE
  else charCode = evt.which; //for firefox
  if (charCode == 32)
    //for &lt;space&gt; symbol
    return true;
  if (charCode > 31 && charCode < 65)
    //for characters before 'A' in ASCII Table
    return false;
  if (charCode > 90 && charCode < 97)
    //for characters between 'Z' and 'a' in ASCII Table
    return false;
  if (charCode > 122)
    //for characters beyond 'z' in ASCII Table
    return false;
  return true;
}
var ftotsub;
function loadMasters() {
  $("#subject_det").hide();
  $("#fee_det").hide();
  $("#personal_det").show();
  $("#success_card").hide();
  verify = 1;
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getcmsdropdownmenuvalues",
    success: function GetCMSDropDownMenuValuesResponce(responce) {
      responce = eval("(" + responce + ")");
      var serv_arr = responce.data["category"];
      var serv_title = "";
      FillDropdownValues(serv_arr, "category", serv_title);
    },
  });
  getRegnoDetails_give_edit();
}

//global variables for re-rigistration
var cat;
var reg_no;
var payment_type;
var total_fee;
var fexamno;
var mand_sub = [];
var opt_cnt;

function getRegnoDetails_give_edit() {
  var page = getUrlParameter("page");
  var lateral = getUrlParameter("lateral");
  $("#dee").hide();
  $("#passuniv").hide();
  $("#lyear").hide();
  if (lateral != undefined) {
    $("#optionsdiv").hide();
    $("#mbacomb").hide();
    $("#subjectdet").hide();
    $("#feedetl").hide();
    $("#passuniv").show();
    $("#lyear").show();
    $("#def").hide();
    $("#dee").show();
  }
  //  console.log(lateral);

  if (page != undefined) {
    var datastring = "&page=mainpage";
    $.ajax({
      type: "POST",
      async: false,
      data: datastring,
      url: $host_url + "getRerigistrationDetails",
      success: function getsubjectdetResponce(responce) {
        responce = eval("(" + responce + ")");

        $("#regno").append(
          '<b>Register Number</b><div class="form-group p-b-20"><div class="form-line"><input type="text" id="RegisterNumber"  class="form-control" maxlength="60" style="text-transform: uppercase" disabled value=' +
            responce.FREGNO +
            ' autocomplete="off"></div></div>'
        );
        if (responce.FNAME !== "") {
          $("#studname").val(responce.FNAME);
          $("#studname").prop("disabled", true);
        }
        if (responce.FFATNAME !== "") {
          $("#fatname").val(responce.FFATNAME);
          $("#fatname").prop("disabled", true);
        }
        if (responce.FRELIGION !== "") {
          $("#religion").val(responce.FRELIGION);
          $("#religion").prop("disabled", true);
        }
        if (responce.FCASTE !== "") {
          $("#category option[value='" + responce.FCASTE + "']").prop(
            "selected",
            "selected"
          );
          $("#category").prop("disabled", true);
        }
        if (responce.FSEX !== "") {
          $("input[name=gender][value=" + responce.FSEX + "]").attr(
            "checked",
            "checked"
          );
          $("input[name=gender]").prop("disabled", true);
        }
        if (responce.FHANDICAP !== "") {
          $("input[name=handicap][value=" + responce.FHANDICAP + "]").attr(
            "checked",
            "checked"
          );
          $("input[name=handicap]").prop("disabled", true);
        }
        if (responce.FNATIONAL !== "") {
          $("input[name=nationality][value=" + responce.FNATIONAL + "]").attr(
            "checked",
            "checked"
          );
          $("input[name=nationality]").prop("disabled", true);
        }
        if (responce.FPHOTOPATH != "") {
          $("#frmFileUpload").hide();
          $("#studphoto").attr("src", responce.FPHOTOPATH);
          $("#studphoto").show();
        }
        $("#photomsg1").hide();
        $("#photomsg2").hide();
        $("#signdiv").hide();
        $("#signmsgdiv").hide();
        photo_filename = responce.FPHOTOPATH;
        //sign_filename = responce.FSIGNPATH;
        if (responce.FDOB !== "") {
          $("#dob").val(responce.FDOB);
          $("#dob").prop("disabled", true);
        }
        if (responce.FAADHARNO !== "") {
          $("#adhar").val(responce.FAADHARNO);
          $("#adhar").prop("disabled", true);
        }
        if (responce.FPERMADD1 !== "") {
          $("#padd1").val(responce.FPERMADD1);
          $("#padd1").prop("disabled", true);
        }
        if (responce.FPERMADD2 !== "") {
          $("#padd2").val(responce.FPERMADD2);
          $("#padd2").prop("disabled", true);
        }
        if (responce.FPERMADD3 !== "") {
          $("#padd3").val(responce.FPERMADD3);
          $("#padd3").prop("disabled", true);
        }
        if (responce.FPERMDISTRICT !== "") {
          $("#pdistrict").val(responce.FPERMDISTRICT);
          $("#pdistrict").prop("disabled", true);
        }
        if (responce.FPERMADDPIN !== "") {
          $("#ppincode").val(responce.FPERMADDPIN);
          $("#ppincode").prop("disabled", true);
        }
        if (responce.FPERMSTATE !== "") {
          $("#pstate").val(responce.FPERMSTATE);
          $("#pstate").prop("disabled", true);
        }
        if (responce.FCURRADD1 !== "") {
          $("#cadd1").val(responce.FCURRADD1);
          $("#cadd1").prop("disabled", true);
        }
        if (responce.FCURRADD2 !== "") {
          $("#cadd2").val(responce.FCURRADD2);
          $("#cadd2").prop("disabled", true);
        }
        if (responce.FCURRADD3 !== "") {
          $("#cadd3").val(responce.FCURRADD3);
          $("#cadd3").prop("disabled", true);
        }
        if (responce.FCURRDISTRICT !== "") {
          $("#cadistrict").val(responce.FCURRDISTRICT);
          $("#cadistrict").prop("disabled", true);
        }
        if (responce.FCURRADDPIN !== "") {
          $("#cpincode").val(responce.FCURRADDPIN);
          $("#cpincode").prop("disabled", true);
        }
        if (responce.FCURRSTATE !== "") {
          $("#castate").val(responce.FCURRSTATE);
          $("#castate").prop("disabled", true);
        }
        if (responce.FCONTACT_NO !== "") {
          $("#mobile").val(responce.FCONTACT_NO);
          $("#mobile").prop("disabled", true);
        }
        if (responce.FLANDLINE !== "") {
          $("#landline").val(responce.FLANDLINE);
          $("#landline").prop("disabled", true);
        }
        if (responce.FEMAIL !== "") {
          $("#email").val(responce.FEMAIL);
          $("#email").prop("disabled", true);
        }
        if (responce.FFAT_OCC !== "") {
          $("#ocupation").val(responce.FFAT_OCC);
          $("#ocupation").prop("disabled", true);
        }
        if (responce.FINCOME !== "") {
          $("#income").val(responce.FINCOME);
          $("#income").prop("disabled", true);
        }

        $("#optionsdiv").hide();
        $("#subjectdiv").hide();
        $("#graduationdiv").hide();

        $("#coursediv").addClass("col-md-offset-2");
        $("#mediumdiv").removeClass("row clearfix");
        var option =
          "<option value=" +
          responce.FDEGREE +
          " selected>" +
          responce.FDESCPN +
          "</option>";
        $("#degree").append(option);
        //console.log(responce.FENGLISH);

        $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
        //$.unblockUI();
        $.ajax({
          type: "POST",
          async: false,
          url: $host_url + "getdropdownmenuvalues",
          success: function getdropdownmenuvaluesResponce(responce) {
            $.unblockUI();
            responce = eval("(" + responce + ")");
            ug = responce.data["UG"];
            pg = responce.data["PG"];
            pgd = responce.data["PGD"];
            combcode = responce.data["combcode"];
            centercode = responce.data["centercode"];
            fmedium = responce.data["medium"];
            serv_title = "";
            FillDropdownValues(centercode, "centercode", serv_title);
          },
        });
        $("#centerSelection").hide();
        $("#cstate option[value='" + responce.FCENSTATE + "']").prop(
          "selected",
          "selected"
        );
        $("#cdistrict option[value='" + responce.FCENDISTRICT + "']").prop(
          "selected",
          "selected"
        );
        $("#centercode option[value='" + responce.FCOLLCODE + "']").prop(
          "selected",
          "selected"
        );
        var optional = "";

        ftotsub = responce.FTOTSUB;
        console.log(responce.FDEGREE);

        if (responce.FDEGREE == "DNMB1" || responce.FDEGREE == "DNMB") {
          $("#mbacomb").show();
        } else {
          var datastring =
            "&exam=" +
            responce.FEXAMNO +
            "&degree=" +
            responce.FDEGREE +
            "&regno=" +
            responce.FREGNO +
            "&ftotsub=" +
            ftotsub;
          $.ajax({
            type: "POST",
            data: datastring,
            url: $host_url + "getsubjectsforreregistration",
            success: function getsubjectdetResponce(responce) {
              responce = eval("(" + responce + ")");

              $("#subdet").html(responce.data["html"]);
              //mand_sub = responce.data['mand_sub'];
              opt_cnt = responce.data["opt_cnt"];
            },
          });
        }
        reg_no = responce.FREGNO;
        cat = responce.FCASTE;
        fexamno = responce.FEXAMNO;
        degree = responce.FDEGREE;
        combcode = responce.FCOMBCODE;
        $("#prev1").hide();
        $("#prev2").hide();
        $("#prev3").hide();
        $("#ceninstitut").val(responce.fcollname);
        $("#ceninst").css("display", "block");
      },
    });
  }
}

function getmbasubjects() {
  var mbacombcode = $("#mbacombcode").val();

  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });

  var datastring =
    "&exam=" +
    fexamno +
    "&degree=" +
    degree +
    "&regno=" +
    reg_no +
    "&ftotsub=" +
    ftotsub +
    "&mbacombcode=" +
    mbacombcode;

  $.ajax({
    type: "POST",
    data: datastring,
    url: $host_url + "getsubjectsforreregistration",
    success: function getsubjectdetResponce(responce) {
      responce = eval("(" + responce + ")");
      $.unblockUI();
      $("#subdet").html(responce.data["html"]);
      //mand_sub = responce.data['mand_sub'];
      opt_cnt = responce.data["opt_cnt"];
    },
  });
}

function getRegnoDetails() {
  var page = getUrlParameter("page");
  if (page != undefined) {
    var datastring = "&page=mainpage";
    $.ajax({
      type: "POST",
      async: false,
      data: datastring,
      url: $host_url + "getRerigistrationDetails",
      success: function getsubjectdetResponce(responce) {
        $("#body :input").prop("disabled", true);
        $("#subcarddiv :input").prop("disabled", true);
        $("#fee_det .body :input").prop("disabled", true);

        responce = eval("(" + responce + ")");

        $("#regno").append(
          '<b>Register Number</b><div class="form-group p-b-20"><div class="form-line"><input type="text" id="RegisterNumber"  class="form-control" maxlength="60" style="text-transform: uppercase" disabled value=' +
            responce.FREGNO +
            ' autocomplete="off"></div></div>'
        );
        reg_no = responce.FREGNO;
        $("#studname").val(responce.FNAME);
        $("#fatname").val(responce.FFATNAME);
        $("#religion").val(responce.FRELIGION);
        $("#category option[value='" + responce.FCASTE + "']").prop(
          "selected",
          "selected"
        );
        cat = responce.FCASTE;
        if (responce.FSEX !== "") {
          $("input[name=group1][value=" + responce.FSEX + "]").attr(
            "checked",
            "checked"
          );
        }
        if (responce.FHANDICAP !== "") {
          $("input[name=group2][value=" + responce.FHANDICAP + "]").attr(
            "checked",
            "checked"
          );
        }
        if (responce.FHANDICAP !== "") {
          $("input[name=group3][value=" + responce.FNATIONAL + "]").attr(
            "checked",
            "checked"
          );
        }
        $("#frmFileUpload").hide();
        $("#studphoto").attr("src", responce.FPHOTOPATH);
        $("#studphoto").show();

        $("#signdiv").hide();
        $("#signmsgdiv").hide();
        //$("#studsign").attr("src",responce.FSIGNPATH);
        //$("#studsign").show();

        photo_filename = responce.FPHOTOPATH;
        sign_filename = responce.FSIGNPATH;
        $("#dob").val(responce.FDOB);
        $("#adhar").val(responce.FAADHARNO);
        $("#padd1").val(responce.FPERMADD1);
        $("#padd2").val(responce.FPERMADD2);
        $("#padd3").val(responce.FPERMADD3);
        $("#pdistrict").val(responce.FPERMDISTRICT);
        $("#ppincode").val(responce.FPERMADDPIN);
        $("#pstate").val(responce.FPERMSTATE);
        $("#cadd1").val(responce.FCURRADD1);
        $("#cadd2").val(responce.FCURRADD2);
        $("#cadd3").val(responce.FCURRADD3);
        $("#cadistrict").val(responce.FCURRDISTRICT);
        $("#cpincode").val(responce.FCURRADDPIN);
        $("#castate").val(responce.FCURRSTATE);
        $("#mobile").val(responce.FCONTACT_NO);
        $("#landline").val(responce.FLANDLINE);
        $("#email").val(responce.FEMAIL);
        $("#ocupation").val(responce.FFAT_OCC);
        $("#income").val(responce.FINCOME);

        $("#optionsdiv").hide();
        $("#subjectdiv").hide();
        $("#graduationdiv").hide();

        $("#coursediv").addClass("col-md-offset-2");
        $("#mediumdiv").removeClass("row clearfix");
        var option =
          "<option value=" +
          responce.FDEGREE +
          " selected>" +
          responce.FDESCPN +
          "</option>";
        $("#degree").append(option);

        $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
        $.ajax({
          type: "POST",
          async: false,
          url: $host_url + "getdropdownmenuvalues",
          success: function getdropdownmenuvaluesResponce(responce) {
            $.unblockUI();
            responce = eval("(" + responce + ")");
            ug = responce.data["UG"];
            pg = responce.data["PG"];
            pgd = responce.data["PGD"];
            combcode = responce.data["combcode"];
            centercode = responce.data["centercode"];
            fmedium = responce.data["medium"];
            serv_title = "";
            FillDropdownValues(centercode, "centercode", serv_title);
          },
        });
        $("#centerSelection").hide();
        $("#cstate option[value='" + responce.FCENSTATE + "']").prop(
          "selected",
          "selected"
        );
        $("#cdistrict option[value='" + responce.FCENDISTRICT + "']").prop(
          "selected",
          "selected"
        );
        $("#centercode option[value='" + responce.FCOLLCODE + "']").prop(
          "selected",
          "selected"
        );
        var optional = "";
        fexamno = responce.FEXAMNO;
        var datastring =
          "&exam=" +
          responce.FEXAMNO +
          "&degree=" +
          responce.FDEGREE +
          "&regno=" +
          responce.FREGNO;
        $.ajax({
          type: "POST",
          data: datastring,
          url: $host_url + "getsubjectsforreregistration",
          success: function getsubjectdetResponce(responce) {
            responce = eval("(" + responce + ")");

            $("#subdet").html(responce.data["html"]);
            //mand_sub = responce.data['mand_sub'];
            opt_cnt = responce.data["opt_cnt"];
          },
        });

        $("#qaldeg").val(responce.FBASICQAL);
        $("#qaloption").val(responce.FPREVELECTIVE);
        $("#qalsub").val(responce.FPREVCOMB);
        $("#qalreg").val(responce.FPREVREGNO);
        $("#qalinstitut").val(responce.FPREVCOLLEGE);
        degree = responce.FDEGREE;

        ///payment card \\\
        $("#paymenttype").prop("disabled", false);
        var arr = responce.FPASSMTHYEAR.split("/");
        jQuery.trim(arr[1]);
        //console.log(arr[1]);
        $("#qalpassmonth option[value='" + arr[0] + "']").prop(
          "selected",
          "selected"
        );
        var option =
          "<option value='" + arr[1] + "' selected>" + arr[1] + "</option>";
        $("#qalpassyear").append(option);
      },
    });
  }
}

function getsubcode(obj) {
  var result = obj.id.substr(obj.id.lastIndexOf("_") + 1);
  $("#subcode_" + result).html("<center>" + obj.value + "</center>");

  console.log(fdegree);

  /*"c67 : HRM:COUNSELING AND INTER--PERSONAL SKILLS FOR MANAGERS"
	stpost("C67*C68*C69"  == true)
	if()
	{	
		$('#subcode').val()
		$('#subcode').val()

		$('#subcode').val()
		$('#subcode').val()

		$('#subcode').val()
		$('#subcode').val()

	}*/
}

var getUrlParameter = function getUrlParameter(sParam) {
  var sPageURL = decodeURIComponent(window.location.search.substring(1)),
    sURLVariables = sPageURL.split("&"),
    sParameterName,
    i;

  for (i = 0; i < sURLVariables.length; i++) {
    sParameterName = sURLVariables[i].split("=");

    if (sParameterName[0] === sParam) {
      return sParameterName[1] === undefined ? true : sParameterName[1];
    }
  }
};

function loadPersonal() {
  $("#subject_det").hide();
  $("#fee_det").hide();
  $("#personal_det").show();
  $("#success_card").hide();
  verify++;
}

function homeLink() {
  var r = confirm(
    "Do you really want to go to homepage!!! Values will be cleared"
  );
  if (r == true) {
    window.location.href = "index.html";
  } else {
  }
}

var ug;
var pg;
var pgd;
var combcode;

function loadCourseStructure() {
  var page = getUrlParameter("page");
  //console.log(page);
  if (page != undefined) {
    return;
  }
  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    url: $host_url + "getdropdownmenuvalues",
    success: function getdropdownmenuvaluesResponce(responce) {
      $.unblockUI();
      responce = eval("(" + responce + ")");
      ug = responce.data["UG"];
      pg = responce.data["PG"];
      pgd = responce.data["PGD"];
      combcode = responce.data["combcode"];
      centercode = responce.data["centercode"];
      fmedium = responce.data["medium"];
      serv_title = "";
      FillDropdownValues(centercode, "centercode", serv_title);
    },
  });
}

function FillDropdownValues(arr, ele_name, def_title) {
  document.getElementById(ele_name).options.length = 0;
  if (ele_name == "S4") {
    var op1 = new Option("  All  " + def_title, "all");
    op1.id = "00";
    op1.selected = "selected";
    document.getElementById(ele_name).options.add(op1);
  }
  var option = "<option value=''>--Select--</option>";
  for (let value of arr) {
    option +=
      "<option value='" + value.int_code + "'>" + value.val + "</option>";
  }
  $("#" + ele_name).append(option);
}

function getdegreedetails() {
  var course = $("#graduation").val();

  serv_title = "";
  if (course == "ug") FillDropdownValues(ug, "degree", serv_title);
  if (course == "pg") FillDropdownValues(pg, "degree", serv_title);
  if (course == "pgd") FillDropdownValues(pgd, "degree", serv_title);
  document.getElementById("degree").disabled = false;
}

function getcombinationdetails() {
  var degree = $("#degree").val();
  $("#subdet").html("");
  document.getElementById("subject").options.length = 0;
  for (var i = 0; i < combcode.length; i++) {
    if (combcode[i]["fdegree"] == degree) {
      var op = new Option("  -Select-  ", "");
      op.id = "999";
      document.getElementById("subject").options.add(op);
      var optionarry = combcode[i]["combination"].split(",");
      for (var j = 0; j < optionarry.length; j++) {
        optionarr = optionarry[j].split("->");
        var op = new Option(optionarr[1], optionarr[0]);
        op.id = optionarr[0];
        document.getElementById("subject").options.add(op);
      }
    }
    document.getElementById("subject").disabled = false;
  }
}

function getoptionsdetails() {
  combcode_sub = $("#subject").val();
  degree = $("#degree").val();

  var datastring = "&combcode=" + combcode_sub + "&degree=" + degree;
  $.ajax({
    type: "POST",
    data: datastring,
    url: $host_url + "getsubjectdet",
    success: function getsubjectdetResponce(responce) {
      responce = eval("(" + responce + ")");
      var arr = responce.data["option"];
      def_title = "";
      FillDropdownValues(arr, "options1", def_title);
      FillDropdownValues(arr, "options2", def_title);
    },
  });
}

function autoFilladd() {
  if ($("#basic_checkbox_1").is(":checked")) {
    $("#cadd1").val($("#padd1").val());
    $("#cadd2").val($("#padd2").val());
    $("#cadd3").val($("#padd3").val());
    $("#cdistrict").val($("#pdistrict").val());
    $("#cpincode").val($("#ppincode").val());
    $("#cstate").val($("#pstate").val());
  } else {
    $("#cadd1").val("");
    $("#cadd2").val("");
    $("#cadd3").val("");
    $("#cadistrict").val("");
    $("#cpincode").val("");
    $("#castate").val("");
  }
}

function getsubjectdetails() {
  combcode_sub = $("#subject").val();
  degree = $("#degree").val();
  optional = $("#options1").val();
  optiona2 = $("#options2").val();
  $("#options2").prop("disabled", false);
  if (degree == "BSC1" || degree == "BCOM1") {
    $("#options2").val("A001");
    $("#options2").prop("disabled", true);
  }

  if (optional == optiona2) {
    alert("Both Language Subject are same");
    optional = $("#options1").val("");
    optiona2 = $("#options2").val("");
    return;
  }

  var datastring =
    "&combcode=" +
    combcode_sub +
    "&degree=" +
    degree +
    "&optional=" +
    optional +
    "&optiona2=" +
    optiona2;
  $.ajax({
    type: "POST",
    data: datastring,
    url: $host_url + "getsubjectdet",
    success: function getsubjectdetResponce(responce) {
      responce = eval("(" + responce + ")");
      $("#subdet").html(responce.data["html"]);
      var arr = responce.data["option"];
    },
  });
}
var graduation;
var degree;
var subject;
var moi;
var suboption;
var cstate;
var cdistrict;
var centercode;
var sum;

function Showfeedetl() {
  var page = getUrlParameter("page");
  var lateral = getUrlParameter("lateral");

  var errorCount1 = 0;
  errorCount1 = validateSubjectInfo();
  if (errorCount1 > 0) return;
  fexamno = "A";

  suboption = $("#options1").val();

  var datastring =
    "&degree=" +
    degree +
    "&exam=" +
    fexamno +
    "&category=" +
    category +
    "&gender=" +
    gender;

  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    data: datastring,
    url: $host_url + "getfeedetl",
    success: function getfeedetlResponce(responce) {
      $.unblockUI();
      responce = eval("(" + responce + ")");
      arr = responce.data["payment"];
      sum = responce.data["sum"];
      total_fee = sum;
      $("#sum").val(sum);
      def_title = "";
      FillDropdownValues(arr, "paymenttype", def_title);
    },
  });

  $("#subject_det").hide();
  $("#fee_det").show();
  $("#personal_det").hide();
  $("#success_card").hide();

  if (page == undefined) {
    var option = "<option value=''>--Select--</option>";
    for (var j = 2018; j > 1960; j--) {
      option += "<option value='" + j + "'>" + j + "</option>";
    }
    $("#qalpassyear").append(option);
  }
}

var studname;
var fatname;
var motname;
var category;
var gender = "";
var religion;
var caste;
var handicap = "";
var nationality = "";
var dob;
var adhar;
var padd1;
var padd2;
var padd3;
var pdistrict;
var ppincode;
var pstate;
var cadd1;
var cadd2;
var cadd3;
var cadistrict;
var cpincode;
var castate;
var mobile;
var accnumber;
var branch;
var ifsc;
var landline;
var email;
var ocupation;
var income;
var focusid;

function validatePersonalInfo() {
  var errorCount = 0;
  gender = $('input[name="gender"]:checked').val();
  handicap = $('input[name="handicap"]:checked').val();
  nationality = $('input[name="nationality"]:checked').val();

  if (nationality === undefined) {
    $("#nationality_err").addClass("hasError");
    errorCount++;
  } else {
    $("#nationality_err").removeClass("hasError");
  }

  if (handicap === undefined) {
    $("#handicap_err").addClass("hasError");
    errorCount++;
  } else {
    $("#handicap_err").removeClass("hasError");
  }

  if (gender === undefined) {
    $("#gender_err").addClass("hasError");
    errorCount++;
  } else {
    $("#gender_err").removeClass("hasError");
  }

  if (photo_filename === undefined) {
    $("#photo_err").addClass("hasError");
    errorCount++;
  } else {
    $("#photo_err").removeClass("hasError");
  }

  if (sign_filename === undefined) {
    $("#sign_err").addClass("hasError");
    errorCount++;
  } else {
    $("#sign_err").removeClass("hasError");
  }

  fatname = $("#fatname").val();
  if (fatname === "") {
    $("#fatname_err").addClass("hasError");
    focusid = fatname;
    errorCount++;
  } else {
    $("#fatname_err").removeClass("hasError");
  }
  fatname = fatname.toUpperCase();

  motname = $("#motname").val();
  if (motname === "") {
    $("#motname_err").addClass("hasError");
    focusid = motname;
    errorCount++;
  } else {
    $("#motname_err").removeClass("hasError");
  }
  motname = motname.toUpperCase();

  category = $("#category").val();
  if (category === "") {
    $("#category_err").addClass("hasError");
    focusid = category;
    errorCount++;
  } else {
    $("#category_err").removeClass("hasError");
  }
  caste = $("#caste").val();
  if (caste === "") {
    $("#caste_err").addClass("hasError");
    focusid = caste;
    errorCount++;
  } else {
    $("#caste_err").removeClass("hasError");
  }

  religion = $("#religion").val();
  if (religion === "") {
    $("#religion_err").addClass("hasError");
    focusid = religion;
    errorCount++;
  } else {
    $("#religion_err").removeClass("hasError");
  }
  religion = religion.toUpperCase();

  dob = $("#dob").val();
  if (dob === "") {
    $("#dob_err").addClass("hasError");
    focusid = dob;
    errorCount++;
  } else {
    $("#dob_err").removeClass("hasError");
  }
  //var accnumber;var branch;var ifsc;
  accnumber = $("#accnumber").val();
  if (accnumber === "") {
    $("#accnumber_err").addClass("hasError");
    focusid = accnumber;
    errorCount++;
  } else {
    $("#accnumber_err").removeClass("hasError");
  }
  branch = $("#branch").val();
  if (branch === "") {
    $("#branch_err").addClass("hasError");
    focusid = branch;
    errorCount++;
  } else {
    $("#branch_err").removeClass("hasError");
  }
  ifsc = $("#ifsc").val();
  if (ifsc === "") {
    $("#ifsc_err").addClass("hasError");
    focusid = ifsc;
    errorCount++;
  } else {
    $("#ifsc_err").removeClass("hasError");
  }
  adhar = $("#adhar").val();
  adhar = adhar.replace(/\s/g, "");
  if (adhar === "") {
    $("#adhar_err").addClass("hasError");
    focusid = adhar;
    errorCount++;
  } else {
    $("#adhar_err").removeClass("hasError");
  }

  padd1 = $("#padd1").val();
  padd2 = $("#padd2").val();
  padd3 = $("#padd3").val();
  pdistrict = $("#pdistrict").val();
  ppincode = $("#ppincode").val();
  pstate = $("#pstate").val();
  if (
    padd1 === "" ||
    padd2 === "" ||
    padd3 === "" ||
    pdistrict === "" ||
    ppincode === "" ||
    pstate === ""
  ) {
    $("#padd1_err").addClass("hasError");
    errorCount++;
  } else {
    $("#padd1_err").removeClass("hasError");
  }

  cadd1 = $("#cadd1").val();
  cadd2 = $("#cadd2").val();
  cadd3 = $("#cadd3").val();
  cadistrict = $("#cadistrict").val();
  cpincode = $("#cpincode").val();
  castate = $("#castate").val();
  if (
    cadd1 === "" ||
    cadd2 === "" ||
    cadd3 === "" ||
    cadistrict === "" ||
    cpincode === "" ||
    castate === ""
  ) {
    //console.log("cadd1");
    $("#cadd1_err").addClass("hasError");
    errorCount++;
  } else {
    $("#cadd1_err").removeClass("hasError");
  }

  mobile = $("#mobile").val();
  landline = $("#landline").val();
  if (mobile === "" || mobile.length < 10) {
    $("#mobile_err").addClass("hasError");
    focusid = mobile;
    errorCount++;
  } else {
    $("#mobile_err").removeClass("hasError");
  }
  email = $("#email").val();
  if (email === "") {
    $("#email_err").addClass("hasError");
    focusid = email;
    errorCount++;
  } else {
    var event = document.createEvent("Event");
    if (!validateemail(event, email)) {
      $("#emailval_err").addClass("hasError");
      errorCount++;
    } else {
      $("#emailval_err").removeClass("hasError");
    }
    $("#email_err").removeClass("hasError");
  }

  ocupation = $("#ocupation").val();
  if (ocupation === "") {
    $("#ocupation_err").addClass("hasError");
    focusid = ocupation;
    errorCount++;
  } else {
    $("#ocupation_err").removeClass("hasError");
  }
  income = $("#income").val();
  if (income === "") {
    $("#income_err").addClass("hasError");
    focusid = income;
    errorCount++;
  } else {
    $("#income_err").removeClass("hasError");
  }
  studname = $("#studname").val();
  console.log(studname);
  if (studname === "") {
    $("#studname_err").addClass("hasError");
    focusid = studname;
    errorCount++;
  } else {
    $("#studname_err").removeClass("hasError");
  }
  studname = studname.toUpperCase();
  return errorCount;
}

function validateSubjectInfo() {
  var errorCount = 0;
  var lateral = getUrlParameter("lateral");
  graduation = $("#graduation").val();
  if (graduation === "") {
    $("#graduation_err").addClass("hasError");
    focusid = graduation;
    errorCount++;
  } else {
    $("#graduation_err").removeClass("hasError");
  }

  degree = $("#degree").val();
  if (degree === "") {
    $("#course_err").addClass("hasError");
    focusid = degree;
    errorCount++;
  } else {
    $("#course_err").removeClass("hasError");
  }

  if (lateral == undefined) {
    subject = $("#subject").val();
    if (subject === "") {
      $("#subject_err").addClass("hasError");
      focusid = subject;
      errorCount++;
    } else {
      $("#subject_err").removeClass("hasError");
    }
  }

  if (lateral == undefined) {
    options1 = $("#options1").val();
    if (options1 === "") {
      $("#options_err").addClass("hasError");
      focusid = options1;
      errorCount++;
    } else {
      $("#options_err").removeClass("hasError");
    }
  }
  cstate = $("#cstate").val();
  if (cstate === "") {
    $("#state_err").addClass("hasError");
    focusid = cstate;
    errorCount++;
  } else {
    $("#state_err").removeClass("hasError");
  }

  cdistrict = $("#cdistrict").val();
  if (cdistrict === "") {
    $("#district_err").addClass("hasError");
    focusid = cdistrict;
    errorCount++;
  } else {
    $("#district_err").removeClass("hasError");
  }
  centercode = $("#centercode").val();
  if (centercode === "") {
    $("#counselling_err").addClass("hasError");
    focusid = centercode;
    errorCount++;
  } else {
    $("#counselling_err").removeClass("hasError");
  }
  return errorCount;
}

var personal_info;
//var subde_info;

function getPersonalInfo() {
  var errorCount = 0;
  jsonObj = [];
  $("#personal_det")
    .find("input:text:enabled")
    .each(function () {
      var id = $(this).attr("id");
      var value = $(this).val();
      if (id == "landline") {
        return true;
      }
      //$(this).parents(".row").find(".fieldError").addClass("hasError");

      if (value == "") {
        //$(this).parents(".col").find(".fieldError").addClass("hasError");
        $("#" + id + "_err").addClass("hasError");
        errorCount++;
      } else {
        //$(this).parents(".col").find(".fieldError").removeClass("hasError");
        $("#" + id + "_err").removeClass("hasError");
      }
      item = {};
      item["id"] = id;
      item["value"] = value.toUpperCase();
      jsonObj.push(item);
    });
  if (photo_filename === "") {
    $("#photo_err").addClass("hasError");
    errorCount++;
  } else {
    $("#photo_err").removeClass("hasError");
    item = {};
    item["id"] = "photo_path";
    item["value"] = photo_filename;
    //console.log(photo_filename);
    jsonObj.push(item);
  }
  var radio_names = ["gender", "handicap", "nationality"];
  for (var i = 0; i < radio_names.length; i++) {
    value = $('input[name="' + radio_names[i] + '"]:checked').val();
    item = {};
    item["id"] = radio_names[i];
    item["value"] = value.toUpperCase();
    jsonObj.push(item);
  }

  item = {};
  item["id"] = "category";
  item["value"] = $("#category").val();
  jsonObj.push(item);

  padd1 = $("#padd1").val();
  padd2 = $("#padd2").val();
  padd3 = $("#padd3").val();
  pdistrict = $("#pdistrict").val();
  ppincode = $("#ppincode").val();
  pstate = $("#pstate").val();
  if (
    padd1 === "" ||
    padd2 === "" ||
    padd3 === "" ||
    pdistrict === "" ||
    ppincode === "" ||
    pstate === ""
  ) {
    $("#padd1_err").addClass("hasError");
    focusid = add1;
    errorCount++;
  } else {
    $("#padd1_err").removeClass("hasError");
  }

  cadd1 = $("#cadd1").val();
  cadd2 = $("#cadd2").val();
  cadd3 = $("#cadd3").val();
  cadistrict = $("#cadistrict").val();
  cpincode = $("#cpincode").val();
  castate = $("#castate").val();
  if (
    cadd1 === "" ||
    cadd2 === "" ||
    cadd3 === "" ||
    cadistrict === "" ||
    cpincode === "" ||
    castate === ""
  ) {
    //console.log("cadd1");
    $("#cadd1_err").addClass("hasError");
    errorCount++;
  } else {
    $("#cadd1_err").removeClass("hasError");
  }
  personal_info = JSON.stringify(jsonObj);
  return errorCount;
}

function Showsubdetl() {
  var page = getUrlParameter("page");
  console.log(page);
  var lateral = getUrlParameter("lateral");
  console.log(lateral);
  if (page == undefined && lateral == undefined) {
    var errorCount = validatePersonalInfo();
    var errorCount = 0;
    console.log("errorCount = " + errorCount);
    if (errorCount > 0) return;
  } else if (page == undefined && lateral != undefined) {
    var errorCount = validatePersonalInfo();
    //var errorCount = 0;
    console.log("errorCount = " + errorCount);
    if (errorCount > 0) return;
  } else {
    var errorCount = getPersonalInfo();

    if (errorCount > 0) {
      alert("Fill all the required information");
      return;
    }
    console.log("registrayom");
    var datastring = "personal_info=" + personal_info + "&reg_no=" + reg_no;
    $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
    $.ajax({
      type: "POST",
      data: datastring,
      url: $host_url + "saveReRigistrationPersonal",
      success: function (responce) {
        $.unblockUI();
      },
    });
  }

  $("#subject_det").show();
  $("#fee_det").hide();
  $("#personal_det").hide();
  $("#success_card").hide();
  loadCourseStructure();
}

function Showperdetl() {
  $("#subject_det").hide();
  $("#fee_det").hide();
  $("#personal_det").show();
  $("#success_card").hide();
}

var qaldeg;
var qalsub;
var qalreg;
var qaloption;
var qalpassyear;
var qalinstitut;
var paymenttype;

function validatefeedetl() {
  var errorCount = 0;
  qaldeg = $("#qaldeg").val();
  if (qaldeg === "") {
    $("#qaldeg_err").addClass("hasError");
    focusid = qaldeg;
    errorCount++;
  } else {
    $("#qaldeg_err").removeClass("hasError");
  }
  qalsub = $("#qalsub").val();
  qaloption = $("#qaloption").val();
  if (qalsub === "") {
    $("#qalsub_err").addClass("hasError");
    focusid = qalsub;
    errorCount++;
  } else {
    $("#qalsub_err").removeClass("hasError");
  }
  qalreg = $("#qalreg").val();
  if (qalreg === "") {
    $("#qalreg_err").addClass("hasError");
    focusid = qalreg;
    errorCount++;
  } else {
    $("#qalreg_err").removeClass("hasError");
  }
  qalpassyear = $("#qalpassyear").val();
  qalpassmonth = $("#qalpassmonth").val();
  if (qalpassyear === "") {
    $("#qalpassyear_err").addClass("hasError");
    focusid = qalpassyear;
    errorCount++;
  } else {
    $("#qalpassyear_err").removeClass("hasError");
  }
  qalpassyear = qalpassmonth + "/" + qalpassyear;
  fpassuniv = $("#fpassuniv").val();
  if (fpassuniv === "") {
    $("#qalinstitut_err").addClass("hasError");
    focusid = qalinstitut;
    errorCount++;
  } else {
    $("#qalinstitut_err").removeClass("hasError");
  }
  var lateral = getUrlParameter("lateral");
  if (lateral == "undefined") {
    paymenttype = $("#paymenttype").val();
    if (paymenttype === "") {
      $("#paymenttype_err").addClass("hasError");
      focusid = paymenttype;
      errorCount++;
    } else {
      $("#paymenttype_err").removeClass("hasError");
    }
  }
  return errorCount;
}

var app_no;

function saveRerigistation() {
  paymenttype = $("#paymenttype").val();

  if (paymenttype === "") {
    $("#paymenttype_err").addClass("hasError");
    focusid = paymenttype;
    errorCount++;
  } else {
    $("#paymenttype_err").removeClass("hasError");
  }

  //alert(ftotsub);
  for (var i = 1; i <= ftotsub; i++) {
    mand_sub[i] = $("#subcode_" + i)
      .find("center")
      .html();
  }
  var datastring =
    "&reg_no=" +
    reg_no +
    "&cat=" +
    cat +
    "&FEXAMNO=" +
    fexamno +
    "&payment_type=" +
    paymenttype +
    "&total_fee=" +
    total_fee +
    "&mand_sub=" +
    JSON.stringify(mand_sub);

  console.log(datastring);
  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    data: datastring,
    url: $host_url + "saveReRigistrationDetails",
    success: function (responce) {
      $.unblockUI();
      responce = eval("(" + responce + ")");
      if (responce.error_code === -1) {
        $("#challanBtn").hide();
        $("#paytmBtn").hide();
      } else {
        if (payment_type == "DEBIT/CREDIT/NET BANKING") {
          $("#sbmchallan").hide();
          $("#makepayment").show();
          $("#dapp_no").append(responce.data["app_no"]);
        } else {
          $("#sbmchallan").show();
          $("#makepayment").hide();
        }
      }
      $("#app_no").append(responce.data["app_no"]);
      $("#app_msg").append(responce.data["message"]);
      app_no = responce.data["app_no"];
      //console.log(app_no);
      $("#subject_det").hide();
      $("#fee_det").hide();
      $("#personal_det").hide();
      $("#success_card").show();
    },
  });
}

function saveDetails() {
  sum = $("#sum").val();

  if (lateral !== undefined) {
    if (sum === "" || sum === null) {
      $("#sum_err").addClass("hasError");
      return;
    }
  }

  var page = getUrlParameter("page");
  var entlateral = getUrlParameter("lateral");
  if (page !== undefined) {
    saveRerigistation();
    return;
  }
  var errorCount = validatefeedetl();
  if (errorCount > 0) return;
  if (verify === 1) {
    loadPersonal();
    $("#verify_app").css("display", "block");
    return;
  }
  paymenttype = $("#paymenttype").val();
  var lateral = "";
  //console.log(paymenttype);
  fpassuniv = $("#fpassuniv").val();
  var year = "";
  if (entlateral == "lateralentry") {
    lateral = "T";
    year = $("#year").val();
  }

  var datastring =
    "&studname=" +
    studname +
    "&fatname=" +
    fatname +
    "&motname=" +
    motname +
    "&category=" +
    category +
    "&gender=" +
    gender +
    "&religion=" +
    religion +
    "&caste=" +
    caste +
    "&handicap=" +
    handicap +
    "&nationality=" +
    nationality +
    "&dob=" +
    dob +
    "&adhar=" +
    adhar +
    "&padd1=" +
    padd1 +
    "&padd2=" +
    padd2 +
    "&padd3=" +
    padd3 +
    "&pdistrict=" +
    pdistrict +
    "&ppincode=" +
    ppincode +
    "&pstate=" +
    pstate +
    "&cadd1=" +
    cadd1 +
    "&cadd2=" +
    cadd2 +
    "&cadd3=" +
    cadd3 +
    "&cpincode=" +
    cpincode +
    "&mobile=" +
    mobile +
    "&landline=" +
    landline +
    "&accnumber=" +
    accnumber +
    "&branch=" +
    branch +
    "&ifsc=" +
    ifsc +
    "&email=" +
    email +
    "&ocupation=" +
    ocupation +
    "&income=" +
    income +
    "&graduation=" +
    graduation +
    "&degree=" +
    degree +
    "&subject=" +
    subject +
    "&moi=English&suboption=" +
    suboption +
    "&cstate=" +
    cstate +
    "&cdistrict=" +
    cdistrict +
    "&centercode=" +
    centercode +
    "&qaldeg=" +
    qaldeg +
    "&qalsub=" +
    qalsub +
    "&qalreg=" +
    qalreg +
    "&qalpassyear=" +
    qalpassyear +
    "&qalinstitut=" +
    fpassuniv +
    "&paymenttype=" +
    paymenttype +
    "&qaloption=" +
    qaloption +
    "&totfee=" +
    sum +
    "&photo_filename=" +
    photo_filename +
    "&sign_filename=" +
    sign_filename +
    "&lateral=" +
    lateral +
    "&fpassuniv=" +
    fpassuniv +
    "&year=" +
    year;

  console.log(datastring);
  $.blockUI({ message: "<img src='img/Loading_icon.gif' border='0'>" });
  $.ajax({
    type: "POST",
    data: datastring,
    url: $host_url + "saveDetails",
    success: function getsubjectdetResponce(responce) {
      $.unblockUI();
      responce = eval("(" + responce + ")");
      if (responce.error_code === -1) {
        $("#challanBtn").hide();
        $("#paytmBtn").hide();
      } else {
        if (paymenttype == "DEBIT/CREDIT/NET BANKING") {
          $("#sbmchallan").hide();
          $("#makepayment").show();
          $("#dapp_no").append(responce.data["app_no"]);
        } else {
          $("#sbmchallan").show();
          $("#makepayment").hide();
        }
      }

      $("#app_no").append(responce.data["app_no"]);
      $("#app_msg").append(responce.data["message"]);
      app_no = responce.data["app_no"];
      //console.log(app_no);
      $("#subject_det").hide();
      $("#fee_det").hide();
      $("#personal_det").hide();
      $("#success_card").show();
    },
  });
}

function challanGenerate() {
  //if(app_no);
  if (paymenttype == "DEBIT/CREDIT/NET BANKING")
    window.location.href = "Paytm/pgRedirect.php?productinfo=" + app_no;
  else
    window.location.href =
      $host_url + "PrintApplicationFormSBM&app_no=" + app_no;
}

function PrintApplicationFormpaytmNETBANKING(app_no) {
  $host_url = "http://oasis.logisys.org/kusdde/adm/app.php?&a=";
  window.location.href = $host_url + "PrintApplicationFormSBM&app_no=" + app_no;
}

function stud_from(event) {
  var selectElement = event.target;
  var stud_type = selectElement.value;
  //   console.log(stud_type);

  if (stud_type == "stud_within_kar") {
    document.getElementById("dataval").value = "1000";
  } else if (stud_type == "stud_outside_kar") {
    document.getElementById("dataval").value = "2000";
  } else if (stud_type == "foreign_stud") {
    document.getElementById("dataval").value = "10000";
  }
}

function submit_fee() {
  var student_name = document.getElementById("sname").value;
  var father_name = document.getElementById("fname").value;
  var mother_name = document.getElementById("mname").value;
  var dob = document.getElementById("dob").value;
  var phone = document.getElementById("pno").value;
  var course = document.getElementById("course").value;
  var student_type = document.getElementById("data").value;
  var fee = document.getElementById("dataval").value;

  // console.log(phone);
  // return;

  if (student_name == "") {
    alert("please enter student name");
    document.getElementById("sname").focus();
    return;
  }
  if (father_name == "") {
    alert("please enter father name");
    document.getElementById("fname").focus();
    return;
  }
  if (mother_name == "") {
    alert("please enter mother name");
    document.getElementById("mname").focus();
    return;
  }
  if (dob == "") {
    alert("please enter date of birth");
    document.getElementById("dob").focus();
    return;
  }
  if (phone == "") {
    alert("please enter phone number");
    document.getElementById("pno").focus();
    return;
  }
  if (course == "") {
    alert("please select course");
    document.getElementById("course").focus();
    return;
  }
  if (student_type == "") {
    alert("please select student type");
    document.getElementById("data").focus();
    return;
  }

  $.ajax({
    type: "POST",
    async: false,
    data:
      "&student_name=" +
      student_name +
      "&father_name=" +
      father_name +
      "&mother_name=" +
      mother_name +
      "&dob=" +
      dob +
      "&phone=" +
      phone +
      "&course=" +
      course +
      "&student_type=" +
      student_type +
      "&fee=" +
      fee,
    url: $host_url + "getfee",
    success: function (responce) {
      var response = eval("(" + responce + ")");

      var appno = response.data.fappno;
      var phone = response.data.fmobileno;
      var dob = response.data.fdob;
      var fee = response.data.ffee;

      // console.log(appno);
      // return;

      if (response.error_code == 0) {
        $("#personal_det").hide();
        $("#payment_det").show();
        document.getElementById("appno").innerHTML = appno;
        document.getElementById("pn").innerHTML = phone;
        document.getElementById("dofb").innerHTML = dob;
        document.getElementById("fe").innerHTML = fee;
      }
    },
  });
}

function getreprint() {
  var appno = document.getElementById("rappno").value;
  var dob = document.getElementById("rdob").value;

  $.ajax({
    type: "POST",
    async: false,
    data: "&appno=" + appno + "&dob=" + dob,
    url: $host_url + "getprint",
    success: function (responce) {
      var response = eval("(" + responce + ")");
      if (response.error_code == 0) {
        window.location.href =
          $host_url + "appPrint&fappno=" + response.data.fappno,"_blank";
      } else {
        alert(response.data.msg);
        return;
      }
    },
  });
}

function make_payment() {
  var id = document.getElementById("appno").innerHTML;
  var funivcode = "026";
  window.location.href ="Paytm/pgRedirect.php?productinfo=" + id + "&funivcode=" + funivcode;
  
}

function saveRegApp() {
  var fregno = document.getElementById("fregno").value;
  var fhcollcode = document.getElementById("fhcollcode").value;
  var fhdegree = document.getElementById("fhdegree").value;
  var ffatname = document.getElementById("ffatname").value;
  var fmotname = document.getElementById("fmotname").value;
  var fdob = document.getElementById("fdob").value;
  var fmob = document.getElementById("fmob").value;
  var fcatcode = document.getElementById("fcatcode").value;
  var feetype = document.getElementById("feetype").value;  
  var fee = document.getElementById("fee").value;  
  var fname = document.getElementById("fname").value;    


  if (fregno == "") {
    alert("please enter Register No.");
    document.getElementById("fregno").focus();
    return;
  }

  if (fhcollcode == "") {
    alert("please enter College");
    document.getElementById("fcollcode").focus();
    return;
  }

  if (ffatname == "") {
    alert("please enter father name");
    document.getElementById("ffatname").focus();
    return;
  }

  if (fmotname == "") {
    alert("please enter mother name");
    document.getElementById("fmotname").focus();
    return;
  }
  if (fdob == "") {
    alert("please enter date of birth");
    document.getElementById("fdob").focus();
    return;
  }
  if (fmob == "") {
    alert("please enter phone number");
    document.getElementById("fmob").focus();
    return;
  }

  if (fcatcode == "") {
    alert("please select Category");
    document.getElementById("fcatcode").focus();
    return;
  }

  // if (feetype == "") {
  //   alert("please select admission fee type");
  //   document.getElementById("feetype").focus();
  //   return;
  // }

  if(fcatcode == 'GM')
    feetype = "GM_FEE";
  else if(fcatcode == 'SC' || fcatcode == 'ST')  
    feetype = "SCST_FEE";
  else
    feetype = "OBC_FEE";

  if (fee == "") {
    alert("please select admission fee cant be zero");
    document.getElementById("fee").focus();
    return;
  }

  if(fname == "")
  {
    alert("Please Enter Student Name");
    document.getElementById("fname").focus();
    return;
  }

  $.ajax({
    type: "POST",
    async: false,
    data:
      "&fregno=" +
      fregno +
      "&fhcollcode=" +
      fhcollcode +
      "&fhdegree=" +
      fhdegree +
      "&dob=" +
      fdob +
      "&phone=" +
      fmob +
      "&ffatname=" +
      ffatname +
      "&feetype=" +
      feetype +
      "&fee=" +
      fee+"&fmotname="+fmotname+"&fcatcode="+fcatcode+"&fname="+fname,
    url: $host_url + "saveRegApp",
    success: function (responce) {
      var response = eval("(" + responce + ")");

      var appno = response.data.fappno;
      var phone = response.data.fmobileno;
      var dob = response.data.fdob;
      var fee = response.data.ffee;

      // console.log(appno);
      // return;

      if (response.error_code == 0) {
        $("#personal_det").hide();
        $("#payment_det").show();
        document.getElementById("appno").innerHTML = appno;
        document.getElementById("pn").innerHTML = phone;
        document.getElementById("dofb").innerHTML = dob;
        document.getElementById("fe").innerHTML = fee;
      }else
      {
        alert(response.data.msg);
        return;
      }
    },
  });
}

function getStudDet() {
  var fregno = document.getElementById("fregno").value;
  $.ajax({
    type: "POST",
    async: false,
    data:"&fregno=" + fregno,
    url: $host_url + "getStudDet",
    success: function (responce) {
      var response = eval("(" + responce + ")");
      if(response.error_code == 0)
      {

        document.getElementById('fdegree').value = response.data.fdescpn;
        document.getElementById('fhdegree').value = response.data.fdegree;
        document.getElementById('fcollcode').value = response.data.collname;
        document.getElementById('fhcollcode').value = response.data.fcollcode;
        document.getElementById('fname').value = response.data.fname;
        document.getElementById('fcatcode').value = response.data.FCASTE;
        document.getElementById('fdob').value = response.data.FDOB;
        document.getElementById('fmotname').value = response.data.FMOTNAME;
        document.getElementById('ffatname').value = response.data.FFATNAME;

        getStudFee();

      }else
      {
        alert(response.data);
        document.getElementById('fregno').value = '';
        document.getElementById('fdegree').value = '';
        document.getElementById('fhdegree').value = '';
        document.getElementById('fcollcode').value = '';
        document.getElementById('fhcollcode').value = '';
        document.getElementById('fname').value = '';
        document.getElementById('fregno').focus();
        return;
      }
  
    }
  });
}
function getStudFee() {
  var fregno = document.getElementById("fregno").value;
  var fcatcode = document.getElementById("fcatcode").value;
  if(fcatcode == 'GM')
    feetype = "GM_FEE";
  else if(fcatcode == 'SC' || fcatcode == 'ST')  
    feetype = "SCST_FEE";
  else
    feetype = "OBC_FEE";
  //var feetype = document.getElementById("feetype").value;
  var fdegree = document.getElementById("fhdegree").value;
  var fcollcode = document.getElementById("fhcollcode").value;
  $.ajax({
    type: "POST",
    async: false,
    data:
      "&fregno=" + fregno+"&feetype="+feetype+"&fdegree="+fdegree+"&fcollcode="+fcollcode,
    url: $host_url + "getStudFee",
    success: function (responce) {
      var response = eval("(" + responce + ")");
      if(response.error_code == 0)
      {

        document.getElementById('fee').value = response.data.ffee;

      }else
      {
        alert(response.data);
        document.getElementById('fee').value = '';
        return;
      }
    }
  });
}