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.148.115.43


Current Path : /proc/thread-self/root/var/www/oasis/js/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/js/index.js

//var $host_url='http://10.10.200.172/activity/app.php?a=';
//var $image_path='http://10.10.200.172/activity/libs/jquery/themes/basic/images/';
//var $host_url="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/app.php?a=";
//var $image_path="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/jqGrid3.5/cmes/tarka/images/";

if (location.protocol != "https:") {
  var protocol = "http://";
} else {
  var protocol = "https://";
}

let ldegas = "Degree";
let lsubas = "Subject";
let lregas = "Reg. No.";

var urlarr = window.location.pathname.split("/");
var $url = protocol + window.location.host + "/";
var $hoststr = "";

for (var j = 1; j < urlarr.length - 2; j++) {
  $hoststr += window.location.pathname.split("/")[j] + "/";
}
var db = window.location.pathname.split("/")[urlarr.length - 2];
/*console.log($hoststr);*/

console.log(db);

if (db == "dypatil") {
  ldegas = "Programme";
  lsubas = "Course";
  lregas = "USN";
}

$host_url = $url + $hoststr + "app.php?db=" + db + "&a=";

/*console.log($host_url);*/
$image_path = $url + $hoststr + "jqGrid3.5/cmes/tarka/images/";
//var $host_url="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/"+window.location.pathname.split('/')[2]+"/"+window.location.pathname.split('/')[3]+"/app.php?a=";
//var $image_path="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/"+window.location.pathname.split('/')[2]+"/"+window.location.pathname.split('/')[3]+"/jqGrid3.5/cmes/tarka/images/";

function trim($str) {
  return $str.replace(/^\s*|\s*$/g, "");
}

function loadwindow() {
  loadUniversityDetails();

  CheckIE6Version();
  if (db != "demo") {
    if (getCookie("username")) {
      document.getElementById("user_name").value = getCookie("username");
    } else {
      document.getElementById("user_name").value = "Username";
    }

    if (getCookie("college_code")) {
      document.getElementById("college_code").value = getCookie("college_code");
    } else {
      document.getElementById("college_code").value = "";
    }
  }
}

function getMessages() {
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>",
  });

  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getMessages",
    success: displayMessages,
  });
}

var garray = new Array();

function displayMessages(response) {
  response = eval("(" + response + ")");
  $.unblockUI();
  result = response.data;
  if (result.length <= 0) {
    window.location.href = "MainPage.html";
  } else {
    garray = result;
    var msg = garray.pop();
    // console.log("arrMsgarrMsg",msg);
    $("#message").html(msg);
    $("#continue").html(
      "<br><span class=\"remodal-cancel\" onclick='continueMsg()'>Continue</span>"
    );
  }
}

function continueMsg() {
  if (garray.length > 0) {
    var msg = garray.pop();
    // console.log("arrMsgarrMsg",msg);
    $("#message").html(msg);
  } else {
    window.location.href = "MainPage.html";
  }
}
function validate() {
  return true;
}

function login() {
  if (trim(document.getElementById("college_code").value) == "") {
    alert("Enter College Code");
    document.getElementById("college_code").focus();
    return;
  }
  if (trim(document.getElementById("user_name").value) == "") {
    alert("Enter Username");
    document.getElementById("user_name").focus();
    return;
  } else if (trim(document.getElementById("password").value) == "") {
    alert("Enter Password");
    document.getElementById("password").focus();
    return;
  }

  if (CheckIE6Version()) {
    var college_code = document.getElementById("college_code").value;
    var user_name = document.getElementById("user_name").value;
    var password = document.getElementById("password").value;

    password = password.replace(/["']/g, "");
    password = password.replace(/&/g, "");
    password = password.replace(/ /g, "");
    var $parameters =
      "usr=" +
      user_name +
      "&password=" +
      password +
      "&login_college_code=" +
      college_code;
    $.ajax({
      url: $host_url + "validateUsernameAndPassword.demo",
      async: false,
      data: $parameters,
      success: validateUsernameAndPasswordResponse,
    });
  }
}

var collegeInfoPopup;
let admdata;
var arun = "";

function validateUsernameAndPasswordResponse($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == -1) {
    document.getElementById("user_name").focus();
    document.getElementById("password").value = "";
    alert($responce.data);
  } else {
    var user_type = $responce.data.html["user_type"];
    var user_id = $responce.data.internal_code;
    var college_name = $responce.data.html["college_name"];
    var university_name = $responce.data.html["university_name"];
    var real_name = $responce.data.html["real_name"];
    var FCOLLCODE = $responce.data.html["FCOLLCODE"];
    var FCOLLNAME = $responce.data.html["FCOLLNAME"];
    var FTOWN = $responce.data.html["FTOWN"];
    var FPRINCIPALNAME = $responce.data.html["FPRINCIPALNAME"];
    var FPHONE = $responce.data.html["FPHONE"];
    var FMOBILE = $responce.data.html["FMOBILE"];
    var FFAX = $responce.data.html["FFAX"];
    var FALTMOBILE = $responce.data.html["FALTMOBILE"];
    var FCOLLADD1 = $responce.data.html["FCOLLADD1"];
    var FCOLLADD2 = $responce.data.html["FCOLLADD2"];
    var FCOLLADD3 = $responce.data.html["FCOLLADD3"];
    var FCOLLADD4 = $responce.data.html["FCOLLADD4"];
    var FEMAIL = $responce.data.html["FEMAIL"];
    var FUNIVCODE = $responce.data.html["funivcode"];
    //var colldet = $responce.data['colldet'];

    var can_edit_help_text = $responce.data.html["can_edit_help_text"];
    var logo_path = $responce.data.html["university_logo"];
    var a_p = "";
    var d = new Date();
    var curr_hour = d.getHours();
    if (curr_hour < 12) a_p = "AM";
    else a_p = "PM";

    if (curr_hour == 0) {
      curr_hour = 12;
    }
    if (curr_hour > 12) {
      curr_hour = curr_hour - 12;
    }
    var curr_min = d.getMinutes();
    var login_time = curr_hour + ":" + curr_min + " " + a_p;

    var cookie_value =
      "username=" +
      document.getElementById("user_name").value +
      "&pswd=" +
      document.getElementById("password") +
      "&adminlogin=" +
      document.getElementById("user_name").value +
      "&userlogintime=" +
      login_time;
    //setCookie("Qx0",cookie_value,1);
    setCookie("FCOLLCODE", FCOLLCODE, 1);
    setCookie("FUNIVCODE", FUNIVCODE, 1);
    setCookie("FCOLLNAME", FCOLLNAME, 1);
    setCookie("FPHONE", FPHONE, 1);
    setCookie("FPHONE", FPHONE, 1);
    setCookie("FTOWN", FTOWN, 1);
    setCookie("FFAX", FFAX, 1);
    setCookie("FALTMOBILE", FALTMOBILE, 1);
    setCookie("FCOLLADD1", FCOLLADD1, 1);
    setCookie("FCOLLADD2", FCOLLADD2, 1);
    setCookie("FCOLLADD3", FCOLLADD3, 1);
    setCookie("FCOLLADD4", FCOLLADD4, 1);

    //setCookie("colldet",colldet,1);

    setCookie("FPRINCIPALNAME", FPRINCIPALNAME, 1);
    setCookie("FMOBILE", FMOBILE, 1);

    setCookie("FEMAIL", FEMAIL, 1);
    setCookie("username", trim(document.getElementById("user_name").value), 1);
    setCookie("college_code", FCOLLCODE, 1);
    setCookie("login_time", login_time, 1);
    //setCookie("login_date",login_date,1);
    setCookie("user_type", user_type, 1);
    setCookie("college_name", college_name, 1);
    //setCookie("pswd",trim(document.getElementById('password').value),1);
    setCookie("host_url", $host_url, 1);
    setCookie("image_path", $image_path, 1);
    setCookie("university_name", university_name, 1);
    setCookie("real_name", real_name, 1);
    setCookie("user_id", user_id, 1);
    //setCookie("university_logo",logo_path,1);
    $responce.data.admdata = "T";

    var collegeInfoStatus = $responce.data.html["fupdated"];
    if (user_type == "Admin" && collegeInfoStatus != "T") {
      window.location.href = "collegeInfoPopup.html#modal";
    } else if (user_type == "Admin" || $responce.data.admdata == "T") {
      //window.location.href="valuation.html?v=04122018#modal";
      //window.location.href="examinfo.html?v=04122018#modal";
      // window.location.href="admdatasummary.html?v=04122018#modal";
      window.location.href = "flash.html#modal";
    } else {
      window.location.href = "MainPage.html";
    }
  }
}

function getadmdata() {
  $.ajax({
    url: $host_url + "getadmdata",
    success: function ($responce) {
      $responce = eval("(" + $responce + ")");
      let colllable = "";
      if ($responce.error_code == 0) {
        colllable = $responce.data.fcollas;
        /*var str = `<h2>Admission Statistics</h2>
							<table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
								<thead>
									<tr style = "background-color:#8acc51">
										<th width="25" align="center"><b>Sl. No.</b></th>
										<th width="40" align="center"><b>Degree Code</b></th>
										<th width="150" align="left"><b>Degree Name</b></th>
										<th width="70" align="center"><b>No. of Students</b></th>
										<th width="60" align="center"><b>Students Registered</b></th>
										<th width="60" align="center"><b>Adm. Uploaded</b></th>
										<th width="60" align="center"><b>Adm. Pending</b></th>
										<th width="60" align="center"><b>Ack. Done</b></th>
										<th width="60" align="center"><b>Ack. Pending</b></th>
									</tr>
								</thead><tbody>`;
						var y = 1;
						for(var i = 0;i<$responce.data.length;i++)
						{
							var ackpending = (parseInt($responce.data[i]['fcount']) + parseInt($responce.data[i]['fenterednb'])) - $responce.data[i]['fackdone'];
							var admpending = (parseInt($responce.data[i]['fcount']) + parseInt($responce.data[i]['fenterednb'])) - $responce.data[i]['ffinsubdone'];

							str += `<tr>
										<th width="25" align="center"><b>${y}</b></th>
										<th width="40" align="center"><b>${$responce.data[i]['fdegree']}</b></th>
										<th width="150" align="left"><b>${$responce.data[i]['fdescpn']}</b></th>
										<th width="70" align="center"><b>${parseInt($responce.data[i]['fcount']) + parseInt($responce.data[i]['fenterednb'])}</b></th>
										<th width="60" align="center"><b>${$responce.data[i]['factive']}</b></th>
										<th width="60" align="center"><b>${$responce.data[i]['ffinsubdone']}</b></th>
										<th width="60" align="center"><b>${admpending}</b></th>
										<th width="60" align="center"><b>${$responce.data[i]['fackdone']}</b></th>
										<th width="60" align="center"><b>${ackpending}</b></th>
									</tr>`;
							y++;
						}
						str +=`</tbody>
						</table>				  
						<br>
						<span class="remodal-cancel" onclick='admcollegesum()'>Continue</span>`;*/

        /*var str = `<h2>Admission Statistics</h2>
							<table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
								<thead>
									<tr style = "background-color:#8acc51">
										<th width="25" align="center"><b>Sl. No.</b></th>
										<th width="40" align="center"><b>Degree Code</b></th>
										<th width="150" align="left"><b>Degree Name</b></th>
										<th width="70" align="center"><b>No. of Students</b></th>
										<th width="60" align="center"><b>Fee Paid</b></th>
									</tr>
								</thead><tbody>`;
						var y = 1;
						for(var i = 0;i<$responce.data.length;i++)
						{
							str += `<tr>
										<th width="25" align="center"><b>${y}</b></th>
										<th width="40" align="center"><b>${$responce.data[i]['fdegree']}</b></th>
										<th width="150" align="left"><b>${$responce.data[i]['fdescpn']}</b></th>
										<th width="70" align="center"><b>${$responce.data[i]['fcount']}</b></th>
										<th width="60" align="center"><b>${$responce.data[i]['feepaied']}</b></th>
									</tr>`;
							y++;
						}
						str +=`</tbody>
						</table>				  
						<br>
						<span class="remodal-cancel" onclick='admcollegesum()'>Continue</span>`;
*/

        /*var str = `<h2>Theory Center Deatils</h2>
							<table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
								<thead>
									<tr style = "background-color:#8acc51">
										<th width="25" align="center"><b>Examination Center</b></th>
										<th width="40" align="center"><b>Tagged Colleges</b></th>
									</tr>
								</thead><tbody>`;
						
					
							str += `<tr>
										<th width="25" align="left"><b>${$responce.data['fcntr']}</b></th>
										<th width="40" align="left"><b>${trim($responce.data['tagged_college'])}</b></th>
									</tr>`;
						str +=`</tbody>
						</table>				  
						<br>
						<span class="remodal-cancel" onclick='admcollegesum()'>Continue</span>`;*/

        $("#admstaticstics").html($responce.data);
      } else {
        var str = `<h2>Admission Statistics</h2>
						<h3>No Deatils Found.</h3>
						<span class="remodal-cancel" onclick='admcollegesum()'>Continue</span>`;
        $("#admstaticstics").html(str);
      }
    },
  });

  /*Noble Laurate Series*/
  /*	var str = `<h1>LIKE | WATCH | INFLUENCE</h1>
					<div style="text-align: left"><p>Your University offers a rare window into the Nobel Prize Winners.<br/>
					Join. Participate. Share. Among all you know.<br/>
					The Nobel Lecture in the palm of your hand. Watch it live.<br/>
					4.45 pm this Friday, Saturday, and Sunday.<br/>
					<b>Share with all you know! </b><br/>
					Bring the power of change. Influence the influencers!<br/>
					Join the mission. Win a certificate from the Bengaluru Central University! It will add to your job profile.<br/>
					This is a Noble endeavor on the Nobel Series! Spread the good word! <br/>
					<b>Share among friends. Influence the influencers. Watch it live. </b><br/>
					<br/>
					The live-stream and social media links are:<br/>
					1. Facebook: <a href="https://www.facebook.com/bengalurucentraluniversity/" target="blank">https://www.facebook.com/bengalurucentraluniversity/</a><br/><br/>
					2. Instagram: <a href="https://www.instagram.com/bengaluru_central_university/" target="blank">https://www.instagram.com/bengaluru_central_university/</a><br/><br/>
					3. Twitter: <a href="https://twitter.com/BangaloreCentr1" target="blank">https://twitter.com/BangaloreCentr1</a><br/><br/>
					</p></div>

					<span class="remodal-cancel" onclick='admcollegesum()'>Continue</span>`;*/
  //$('#admstaticstics').html(str);
}
function continuetoexaminfo() {
  window.open("examinfo.html?v=04122018#modal");
}

function continuetocenters() {
  window.open("admdatasummary.html?v=04122018#modal");
}

function admcollegesum(flag) {
  if (flag == "T") window.location.href = "MainPage.html";
  else window.open("cntrmesage.html?v=04122018#modal");
}

function admcollegecntr() {
  window.location.href = "MainPage.html";
}
var gsent = "";
function getexamdata() {
  $.ajax({
    url: $host_url + "getexamdata",
    success: function ($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == 0) {
        gsent = $responce.data.colldet["fanssent"];
        var str = `<h2>Information on collecting Question Papers from University</h2>
						<hr style='border:1px solid #16a085;'>
							<table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
								<thead>
									<tr style = "">
										<th width="25" align="center"><b>${$responce.data.colldet["fansreceive"]}</b></th>
									</tr>
								</thead><tbody>
								</table> <br><span class="remodal-cancel" onclick='examandsent()'>Continue</span>`;

        $("#admstaticstics").html(str);
        //$('#admstaticstics').html(str);
      }
    },
  });
}

function examandsent() {
  var str = `<h2>Information on sending Written Answer Booklets to University</h2>
			<hr style='border:1px solid #16a085;'>
			<table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
			<thead>
			<tr style = "">
			<th width="25" align="center"><b>${gsent}</b></th>
			</tr>
			</thead><tbody>
			</table> <br><span class="remodal-cancel" onclick='exammainpage()'>Continue</span>`;

  $("#admstaticstics").html(str);
}

function exammainpage() {
  window.location.href = "MainPage.html";
}

function loadCollegePopupInfo() {
  let lcollname = "College ";
  $.ajax({
    url: $host_url + "getcolldet.demo",
    async: false,
    success: function ($responce) {
      $responce = eval("(" + $responce + ")");
      console.log($responce);
      console.log($responce.data.fcollas);
      lcollname = $responce.data.fcollas;
      /*document.getElementById("thcntr").length = 0;
						var optionsAsString = "<option value=''>--Select--</option>";
						for(var i = 0; i < $responce.data.colldet.length; i++)
						{
							optionsAsString += "<option value='" + $responce.data.colldet[i].internal_code + "'>" + $responce.data.colldet[i].value + "</option>";
						}
						$("#thcntr" ).append( optionsAsString );

						document.getElementById("prcntr").length = 0;
						var optionsAsString = "<option value=''>--Select--</option>";
						for(var i = 0; i < $responce.data.colldet.length; i++)
						{
							optionsAsString += "<option value='" + $responce.data.colldet[i].internal_code + "'>" + $responce.data.colldet[i].value + "</option>";
						}
						$("#prcntr" ).append( optionsAsString );*/
    },
  });

  $("#fcollegecode").val(getCookie("FCOLLCODE"));
  $("#fcollegename").val(getCookie("FCOLLNAME"));
  $("#fplace").val(getCookie("FTOWN"));
  //document.getElementById('fplace').value = 'BELAGAVI';
  $("#coll_addr1").val(getCookie("FCOLLADD1"));
  $("#coll_addr2").val(getCookie("FCOLLADD2"));
  $("#coll_addr3").val(getCookie("FCOLLADD3"));
  $("#coll_addr4").val(getCookie("FCOLLADD4"));
  $("#flandlinenumb").val(getCookie("FPHONE"));
  $("#ffaxnumb").val(getCookie("FFAX"));
  $("#lcollname").html(lcollname);
  $("#lcollcode").html(lcollname);

  // $("#fprincipalname").val(getCookie("FPRINCIPALNAME"));
  // $("#fmobnumb").val(getCookie("FMOBILE"));
  // $("#fcollemail").val(getCookie("FEMAIL"));
  // $("#faltmobnumb").val(getCookie("FALTMOBILE"));
}

function validateCollegeInfo() {
  if (trim(document.getElementById("fcollegecode").value) == "") {
    alert("Enter the College Code");
    document.getElementById("fcollegecode").focus();
    return;
  }
  if (trim(document.getElementById("fplace").value) == "") {
    alert("Enter the Place");
    document.getElementById("fplace").focus();
    return;
  }
  if (trim(document.getElementById("fcollegename").value) == "") {
    alert("Enter the College Name");
    document.getElementById("fcollegename").focus();
    return;
  }
  if (trim(document.getElementById("coll_addr1").value) == "") {
    alert("Enter the Address");
    document.getElementById("coll_addr1").focus();
    return;
  }
  if (trim(document.getElementById("flandlinenumb").value) == "") {
    alert("Enter the Landline Number");
    document.getElementById("flandlinenumb").focus();
    return;
  }
  if (trim(document.getElementById("ffaxnumb").value) == "") {
    alert("Enter the Fax Number");
    document.getElementById("ffaxnumb").focus();
    return;
  }
  if (trim(document.getElementById("fprincipalname").value) == "") {
    alert("Enter the Principle Name");
    document.getElementById("fprincipalname").focus();
    return;
  }
  var mobileNumber = trim(document.getElementById("fmobnumb").value);
  if (mobileNumber == "" || mobileNumber.length != 10) {
    alert("Enter the Mobile Number");
    document.getElementById("fmobnumb").focus();
    return;
  }
  if (trim(document.getElementById("fcollemail").value) == "") {
    alert("Enter the College Email");
    document.getElementById("fcollemail").focus();
    return;
  } else if (
    trim(document.getElementById("pwd").value) == "" ||
    trim(document.getElementById("pwd").value) == "-"
  ) {
    alert("Enter the Password");
    document.getElementById("pwd").focus();
    return;
  } else {
    var x = trim(document.getElementById("fcollemail").value);
    var atpos = x.indexOf("@");
    var dotpos = x.lastIndexOf(".");
    if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length) {
      alert("Not a valid e-mail address");
      return false;
    }
  }
  var altMobileNumber = trim(document.getElementById("fmobnumb").value);
  if (altMobileNumber == "" || altMobileNumber.length != 10) {
    alert("Enter the Alternate Mobile Number");
    document.getElementById("faltmobnumb").focus();
    return;
  }

  /*if(trim(document.getElementById('thcntr').value) == '')
			{
				alert('Enter the Theory Center');
				document.getElementById('thcntr').focus();
				return;
			}

			if(trim(document.getElementById('prcntr').value) == '')
			{
				alert('Enter the Practical Center');
				document.getElementById('prcntr').focus();
				return;
			}*/

  var cpwd = document.getElementById("cpwd").value;
  var pwd = document.getElementById("pwd").value;

  console.log(cpwd, " - ", pwd);

  if (cpwd != pwd) {
    alert("Password Not Matching");
    document.getElementById("pwd").value = "";
    document.getElementById("cpwd").value = "";
    document.getElementById("pwd").focus();
    return;
  }

  var $lstr_data = "";
  $lstr_data += "&fcollegecode=" + encodeURIComponent($("#fcollegecode").val());
  $lstr_data += "&fcollegename=" + encodeURIComponent($("#fcollegename").val());
  $lstr_data += "&fplace=" + encodeURIComponent($("#fplace").val());
  $lstr_data +=
    "&fprincipalname=" + encodeURIComponent($("#fprincipalname").val());
  $lstr_data +=
    "&flandlinenumb=" + encodeURIComponent($("#flandlinenumb").val());
  $lstr_data += "&fcollemail=" + encodeURIComponent($("#fcollemail").val());
  $lstr_data += "&ffaxnumb=" + encodeURIComponent($("#ffaxnumb").val());
  $lstr_data += "&fmobnumb=" + encodeURIComponent($("#fmobnumb").val());
  $lstr_data += "&faltmobnumb=" + encodeURIComponent($("#faltmobnumb").val());
  $lstr_data += "&coll_addr1=" + encodeURIComponent($("#coll_addr1").val());
  $lstr_data += "&coll_addr2=" + encodeURIComponent($("#coll_addr2").val());
  $lstr_data += "&coll_addr3=" + encodeURIComponent($("#coll_addr3").val());
  $lstr_data += "&coll_addr4=" + encodeURIComponent($("#coll_addr4").val());
  $lstr_data += "&pwd=" + encodeURIComponent($("#pwd").val());
  // $lstr_data+="&prcntr="+encodeURIComponent($("#prcntr").val());
  // $lstr_data+="&thcntr="+encodeURIComponent($("#thcntr").val());

  $.ajax({
    url: $host_url + "saveCollegeInfoPopup.demo",
    data: $lstr_data,
    success: saveCollegeInfoPopupResponce,
  });
}
function saveCollegeInfoPopupResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    window.location.href = "MainPage.html";
  } else {
    alert($responce.data);
    return;
    //logout();
  }
}

//StudentRegisterNoPopup();

function setCookie(c_name, value, expiredays) {
  var exdate = new Date();
  exdate.setDate(exdate.getDate() + expiredays);
  document.cookie =
    c_name +
    "=" +
    escape(value) +
    (expiredays == null ? "" : ";expires=" + exdate.toGMTString());
}

function getCookie(c_name) {
  if (document.cookie.length > 0) {
    c_start = document.cookie.indexOf(c_name + "=");
    if (c_start != -1) {
      c_start = c_start + c_name.length + 1;
      c_end = document.cookie.indexOf(";", c_start);
      if (c_end == -1) c_end = document.cookie.length;
      return unescape(document.cookie.substring(c_start, c_end));
    }
  }
  return "";
}

function dologin(event) {
  if (event.keyCode == 13) login();
}

function CheckIE6Version() {
  var BrowserType = BrowserDetect.browser;
  var BrowserVersion = BrowserDetect.version;
  if (BrowserType == "Explorer" && BrowserVersion == 6) {
    alert(" You are using IE6 Version,Use Mozilla Firefox or IE8");
    return false;
  }
  return true;
}

function loadUniversityDetails() {
  $.ajax({
    url: $host_url + "loadUniversityDetails.demo",
    success: loadUniversityDetailsResponce,
  });
}

function loadUniversityDetailsResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    var university_logo = $responce.data.pdf_logo_path;
    setCookie("university_logo", university_logo, 1);
    setCookie("date", $responce.data.date, 1);
    $("#university_name").html($responce.data.FUNIVNAME);
    $("#university_logo").attr("src", $responce.data.pdf_logo_path);
    $("#jdate").html($responce.data.date);
    $("#collalb").html($responce.data.fcollas);
  }
}

function resetPasswordValidation() {
  window.open("resetPasswordValidate.html#modal");
}

function resetPasswordOTP() {
  window.open("resetPasswordUserInfo.html#modal");
}
function resetPasswordValidationTosendOTP() {
  var username = trim(document.getElementById("fusername").value);
  var mobileno = trim(document.getElementById("fmabileno").value);
  var emailid = trim(document.getElementById("femailid").value);
  if (username == "") {
    alert("Enter User Name");
    document.getElementById("fusername").focus();
    return;
  }
  if (mobileno == "") {
    alert("Enter Mobile Number");
    document.getElementById("fmabileno").focus();
    return;
  }
  if (emailid == "") {
    alert("Enter Email Id");
    document.getElementById("femailid").focus();
    return;
  }
  //window.location.href="resetPasswordOTP.html#modal";

  $.ajax({
    url: $host_url + "resetPasswordDetailsValidation.demo",
    data:
      "username=" + username + "&mobileno=" + mobileno + "&emailid=" + emailid,
    success: resetPasswordValidationTosendOTPresponce,
  });
}

function resetPasswordValidationTosendOTPresponce($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == 0) {
    setCookie("otpusrname", $responce.data["name"], 1);
    setCookie("otpmobile", $responce.data["mobile"], 1);
    setCookie("otpemail", $responce.data["email"], 1);
    window.open("resetPasswordEnterOTP.html#modal");
    /* $("div.error span").html($responce.data['eotp_responce']);
			$("div.error").show(); */
  } else {
    $("div.error span").html($responce.data);
    $("div.error").show();
  }
}

function submitquery() {
  var femail = trim(document.getElementById("femail").value);
  var fsubject = trim(document.getElementById("fsubject").value);
  var fmessage = trim(document.getElementById("fmessage").value);

  if (femail == "") {
    alert("Enter Enter Email ID");
    document.getElementById("femail").focus();
    return;
  }
  if (fsubject == "") {
    alert("Enter Subject");
    document.getElementById("fsubject").focus();
    return;
  }
  if (fmessage == "") {
    alert("Enter Body");
    document.getElementById("fmessage").focus();
    return;
  }

  $.ajax({
    url: $host_url + "submitquery.demo",
    data:
      "femail=" + femail + "&fsubject=" + fsubject + "&fmessage=" + fmessage,
    success: submitqueryresponce,
  });
}

function submitqueryresponce($responce) {
  $responce = eval("(" + $responce + ")");
}

function validateResetPasswordOTP() {
  var mreOTP = trim(document.getElementById("fmreotp").value);

  if (mreOTP == "") {
    alert("Enter OTP sent to Mobile or Email");
    document.getElementById("mreOTP").focus();
    return;
  }

  $.ajax({
    url: $host_url + "validateResetPasswordOTP.demo",
    data:
      "username=" +
      getCookie("otpusrname") +
      "&mobileno=" +
      getCookie("otpmobile") +
      "&emailid=" +
      getCookie("otpemail") +
      "&mreOTP=" +
      mreOTP,
    success: validateResetPasswordOTPresponce,
  });
}

function validateResetPasswordOTPresponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    //window.location.href="resetPasswordSuccess.html#modal";
    //myRedirect("resetPasswordSuccess.html#modal", "paswd", $responce.data);
    //$.redirect('resetPasswordSuccess.html#modal', {"paswd": $responce.data },'POST');
    $("#temp_password").html($responce.data);
    $("div.error span").html(
      "This password is Temporary ,Login and Reset the Password ."
    );
    $("#otpEntry").hide();
    $("#otpVsucess").show();
    $("div.error").show();
  } else {
    //alert($responce.data);
    $("div.error span").html($responce.data);
    $("div.error").show();
  }
}

var myRedirect = function (redirectUrl, arg, value) {
  var form = $(
    '<form action="' +
      redirectUrl +
      '" method="post">' +
      '<input type="hidden" name="' +
      arg +
      '" id="' +
      arg +
      '" value="' +
      value +
      '"></input>' +
      "</form>"
  );
  $("body").append(form);
  $(form).submit();
};

function sendusernameandpassword() {
  var collcode = trim($("#college_code").val());

  if (trim(document.getElementById("college_code").value) != "") {
    $.ajax({
      url: $host_url + "sendusernameandpassword.demo",
      data: "collcode=" + collcode,
      success: sendusernameandpasswordresponce,
    });
  }
}

function sendusernameandpasswordresponce($responce) {
  $responce = eval("(" + $responce + ")");
  $("#resendotp").hide();
  if ($responce.error_code == 0) {
    $("#resendotp").show();
    alert("OTP Will be Sent to College Principle Mobile");
  } else {
    $("#resendotp").hide();
  }
}

function sendotp() {
  var collcode = trim($("#fcollegecode").val());
  var mobile = trim($("#fmobnumb").val());

  if (collcode == "") {
    alert("Please enter College Code");
    document.getElementById("fcollegecode").focus();
    return;
  }
  if (mobile == "") {
    alert("Please enter Mobile Number");
    document.getElementById("fmobnumb").focus();
    return;
  }

  $.ajax({
    url: $host_url + "sendotp",
    data: "collcode=" + collcode + "&mobile=" + mobile,
    success: sendotpresponse,
  });
}

function sendotpresponse($response) {
  alert($response);
  $response = eval("(" + $response + ")");
  $("#resendotp").hide();
  if ($response.error_code == 0) {
    $("#resendotp").show();
    alert("OTP Will be Sent to College Principle Mobile");
  } else {
    $("#resendotp").hide();
  }
}

function validateotp() {
  var collcode = trim($("#fcollegecode").val());
  var mobile = trim($("#fmobile").val());
  var otp = trim($("#fmotp").val());
  if (otp == "") {
    alert("Please enter valid OTP");
  } else {
    alert("OTP verified!");
    return true;
  }
}

function checkPassword() {
  password1 = trim($("#password1").val());
  password2 = trim($("#password2").val());
  if (password1 == "") alert("Please enter Password");
  else if (password2 == "") alert("Please enter Confirm Password");
  else if (password1 != password2) {
    alert("\nPassword did not match:Please try again");
    return false;
  } else {
    alert("Password Matched!");
    return true;
  }
  $.ajax({
    url: $host_url + "checkPassword",
    data: "password2=" + password2 + "&mobile=" + mobile,
    success: checkPassword,
  });
}

function myFunction() {
  var x = document.getElementById("pwd");
  if (x.type === "password") {
    x.type = "text";
  } else {
    x.type = "password";
  }
}

/*function newpassword($responce)
	{
		$responce=eval('('+ $responce +')');
		if($responce.error_code == 0)
		{	
			alert(`Password has been changed successfully. \n Your new password is ${$responce.data}.`);
			$('#fmessage').val('');
			$('#fsubject').val('');
			closeForm();
			return;
		}
		else
		{
			alert($responce);
			$('#fmessage').val('');
			$('#fsubject').val('');
			closeForm();
			return;
		}	
*/