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 : 18.223.170.253


Current Path : /var/www/student/cug/js/
Upload File :
Current File : /var/www/student/cug/js/jscript.js

var path_name=window.location.pathname;
var funivcode=getCookie("univcode");
path_name=path_name.replace("result.php","");
path_name=path_name.replace("index.php","");
path_name=path_name.replace("student.php","");
path_name=path_name.replace("payment_gate_way_responce.php","");
//var $host_url="http://"+window.location.host+"/"+path_name+"/app.php?a=";
var $host_url="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/"+window.location.pathname.split('/')[2]+"/app.php?a=";
$g_dropdown_data='';
$g_edit_app_code=0;

function GetUrlParameters()
{
	 var url_object=new Object();
	var data_set=window.location.href.split("?");
	if(data_set.length>1)
	{
		var params_set=data_set[1].split("&");
		for(i=0;i<params_set.length;i++)
		{
			var pv=params_set[i];
			var pvv=pv.split("=");
			url_object[pvv[0]]=pvv[1];
		}
	}		
	return url_object;	 
}

function date_format($str)
{
	if(trim($str)=="" || $str=="undefined")
		$date="0000-00-00";	
	else				
	{
		var indx=$str.indexOf("/");
		if(indx==-1)
		return $str;
		else
		{
			$date=$str.split('/');
			return($date[2] +'-'+$date[1]+'-'+$date[0]);
		}
	}	
}

function home()
{
	window.location.href="index.php";
}

function PopulateCategoryList()
{
		$.ajax({
		type: "POST",
		async:false,
		url: $host_url+"PopulateCategoryList",
		success: PopulateCategoryListResponce
		});
}

function PopulateCategoryListResponce(responce)
{
	
	responce = eval('(' + responce + ')');
	var funivcode = responce.data['FUNIVCODE'];
	if(funivcode !='018')
	{
		document.getElementById("category").options.length = 0;
		document.getElementById("FCONSTYPE").options.length = 0;
		var category=responce.data['category'];
	}
	
	var mess_data=responce.data['mess_data']; 
	
	
	setCookie("funivcode",funivcode,1);
	if(funivcode !='018')
	{	var FCONSTYPE=responce.data['FCONSTYPE'];
	for($i=0;$i < category.length;$i++)                                  
	{             
		$op = new Option(category[$i]['value'], category[$i]['internal_code']);
		$op.id=category[$i]['internal_code'];//specifying the id  for options
		document.getElementById("category").options.add($op);
	}
	
	
	for($i=0;$i < FCONSTYPE.length;$i++)                                  
	{   	   
		$op = new Option(FCONSTYPE[$i]['value'], FCONSTYPE[$i]['internal_code']);
		$op.id=FCONSTYPE[$i]['internal_code'];//specifying the id  for options
		document.getElementById("FCONSTYPE").options.add($op);
	}}
	$("#main_message_board").html(mess_data);	
	document.getElementById('reg_no').focus();
}
var reg_no;
function ValidateRegNo()
{ 
	
	var reg_no=trim($("#reg_no").val());
	var category=$("#category").val();
	var FCONSTYPE=$("#FCONSTYPE").val();
	 
	if(empty(reg_no))
	{
		alert("Register number should be entered");
		return false;
	} 	 
	$.ajax({
	type: "POST",
	async:false,
	data:"&r="+reg_no+"&c="+category+"&li="+FCONSTYPE,
	url: $host_url+"validateCandidateRegno",
	success: function($responce)
	{
		$responce = eval('(' + $responce + ')');
		if($responce.error_code == 0)
		{	
			window.location.href="student.php?r="+reg_no+"&c="+category+"&li="+FCONSTYPE;
		}	
		else
		{
			alert($responce.data);
		}
	}
	});		
	
}
 
function personaldetails()
{
	
	//document.getElementById('student_entry_upload').value = '';
	$.ajax({
		type: "POST",
		async:false,
		url: $host_url+"personaldetails",
		success: personaldetailsResponce
		});
}

function personaldetailsResponce(responce)
{
	responce = eval('(' + responce + ')');
	//alert(responce.data['regno']);
	document.getElementById("T6").options.length = 1;	
	var category =responce.data['category'];	
	//$op = new Option("Select ",0);
	//$op.id=0;//specifying the id  for options
	//document.getElementById("T6").options.add($op);

	for($i=0;$i < category.length;$i++)                                  
	{            
		$op = new Option(category[$i]['value'], category[$i]['internal_code']);
		$op.id=category[$i]['internal_code'];//specifying the id  for options
		document.getElementById("T6").options.add($op);
	}
	
	var name = document.getElementById('T1').value = responce.data.regno['FNAME'];
	var dob = document.getElementById('T17').value = responce.data.regno['FDOB'];

	if(name != null)
		document.getElementById('T1').disabled = true;
	else 
		document.getElementById('T1').disabled = false;
	if(responce.data.regno['FDOB'] == null)
		document.getElementById('T17').disabled = false;
	else
		document.getElementById('T17').disabled = true;
	
	document.getElementById('T2').value = responce.data.regno['FFATNAME'];
	document.getElementById('T3').value = responce.data.regno['FMOTNAME'];
	document.getElementById('T5').value = responce.data.regno['FSEX'];
	document.getElementById('T6').value = responce.data.regno['FCASTE'];
	
	document.getElementById('T7').value = responce.data.regno['FCURRADD1'];
	document.getElementById('T8').value = responce.data.regno['FCURRADD2'];
	document.getElementById('T9').value = responce.data.regno['FCURRADD3'];
	document.getElementById('T10').value = responce.data.regno['FCURRADD4'];
	
	document.getElementById('T11').value = responce.data.regno['FPERMADD1'];
	document.getElementById('T12').value = responce.data.regno['FPERMADD2'];
	document.getElementById('T13').value = responce.data.regno['FPERMADD3'];
	document.getElementById('T14').value = responce.data.regno['FPERMADD4'];
	
	document.getElementById('T15').value = responce.data.regno['FMOBILENO'];
	document.getElementById('T16').value = responce.data.regno['FEMAIL'];
	document.getElementById('T18').value = responce.data.regno['FCURRADDPIN'];
	document.getElementById('T19').value = responce.data.regno['FPERMADDPIN'];
	document.getElementById('T20').value = responce.data.regno['FAADHARNO'];

	if(responce.data.regno['FPHOTOPATH'] == null)
	{
		document.getElementById('student_entry_upload').value = '';
		$("#student_entry_upload").show();
	}else
	{
		$("#student_entry_atphoto").attr("src", responce.data.regno['FPHOTOPATH']);
		
	}
	
	var fschship = responce.data.regno['fschship'];
	var fempl = responce.data.regno['fempl'];
	var ftrs = responce.data.regno['ftrs'];
	
	if(fschship == 'Y')
	{
		document.getElementById("T21").checked=true;
		$("#test").show();
	}
	if(fempl == 'Y')
	{
		document.getElementById("T21").checked=true;
		$("#test2").show();
		
	}
	if(ftrs == 'Y')
	{
		document.getElementById("T21").checked=true;
		$("#test3").show();
	}
	
	document.getElementById('T22').value = responce.data.regno['fschsource'];
	document.getElementById('T24').value = responce.data.regno['femplplace'];
	document.getElementById('T26').value = responce.data.regno['fhostal'];
}

function getaddress()
{
	document.getElementById('T11').value = document.getElementById('T7').value;
	document.getElementById('T12').value = document.getElementById('T8').value;
	document.getElementById('T13').value = document.getElementById('T9').value;
	document.getElementById('T14').value = document.getElementById('T10').value;
	document.getElementById('T19').value = document.getElementById('T18').value;
}

var myobject;
function Validate()
{
	fldorder = 'T1,T17,T2,T3,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16';
	mandfields = 'T1,T17,T2,T3,T5,T6,T7,T11,T15,T16';
	
	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
	var name = document.getElementById('T1').value;

	var dob = document.getElementById('T17').value;
	var fathername = document.getElementById('T2').value;
	var mothername = document.getElementById('T3').value;
	var gender = document.getElementById('T5').value;
	var category = document.getElementById('T6').value;
	var curadd1 = document.getElementById('T7').value;
	var curadd2 = document.getElementById('T8').value;
	var curadd3 = document.getElementById('T9').value;
	var curadd4 = document.getElementById('T10').value;
	
	var peradd1 = document.getElementById('T11').value;
	var peradd2 = document.getElementById('T12').value;
	var peradd3 = document.getElementById('T13').value;
	var peradd4 = document.getElementById('T14').value;
	
	var mobile = document.getElementById('T15').value;
	var email = document.getElementById('T16').value;
	
	var datastring = "name="+name+"&dob="+dob+"&fathername="+fathername+"&mothername="+mothername+"&gender="+gender+"&category="+category+"&curadd1="+curadd1+"&curadd2="+curadd2+"&curadd3="+curadd3+"&curadd4="+curadd4+"&peradd1="+peradd1+"&peradd2="+peradd2+"&peradd3="+peradd3+"&peradd4="+peradd4+"&mobile="+mobile+"&email="+email;
	$.ajax({
		type: "POST",
		async:false,
		data:datastring,
		url: $host_url+"savestudentdetails",
		success: savestudentdetailsResponce
		}); 
}

function savestudentdetailsResponce(responce)
{
	responce = eval('(' + responce + ')');
	if(responce.error_code == '0')
	{
		alert(responce.data);
	}else
	{
		alert(responce.data);
	}
	
}
//######################################################## 
 function DisplayApplications()
{
	var funivcode= getCookie("univcode");
	url_object=GetUrlParameters();
	var r=url_object['r'];
			 
	$.ajax({
		type: "POST",
		async:false,
		data:"r="+r,
		url: $host_url+"DisplayApplications",
		success: DisplayApplicationsResponce
		});		 
}

function DisplayApplicationsResponce(responce)
{
	var funivcode= getCookie("univcode");
	
	responce = eval('(' + responce + ')');
	var html=responce.data['html'];
	if(responce.error_code==0)
	{
		var student_info="";
		if(trim($("#student_info").html())!='undefined' && !empty($("#student_info").html()))
		{	 
		student_info='<table width="100%" align="center" class="result_table_header">'+$("#student_info").html()+'</table><br><br>';
		}
		$("#applications").html(student_info+html);
	}
	 else
	 {
	  
	 }
}
 

function trim($str)
{
  return jQuery.trim($str);
}
 
function empty (mixed_var) 
{
    var key;    
    if (mixed_var === "" ||
        mixed_var === 0 ||
        mixed_var === "0" ||
        mixed_var === null ||        mixed_var === false ||
        typeof mixed_var === 'undefined'
    ){
        return true;
    } 
    if (typeof mixed_var == 'object') {
        for (key in mixed_var) {
            return false;
        }        return true;
    }
 
    return false;
}

function in_array(needle, haystack, argStrict) 
{
    var key = '', strict = !!argStrict;

    if (strict) {
        for (key in haystack) 
		{
            if (haystack[key] === needle) 
			{
                return true;
            }
        }
    } 
	else 
	{
        for (key in haystack) 
		{
            if (haystack[key] == needle) 
			{
                return true;
            }
        }
    }

    return false;
}
//downloadFileFromServer
function DownLoadUpload()
{
	$('#tabs').load("src/download_upload.html");
}

function downloadFileFromServer()
{
	if( trim(document.getElementById('download_upload_path').value) == '' )
		{
			alert('Please Enter the Path.');
			document.getElementById('download_upload_path').focus();
			return;
		}
		else
		{		
		window.location.href=$host_url+"downloadFileFromServer&download_file_path="+$("#download_upload_path").val();
		}
}

function UploadFileToServer()
{

	if( trim(document.getElementById('upload_to_server_file_name').value) == '' )
	{
		alert('Please Enter the File Path.');
		document.getElementById('upload_to_server_file_name').focus();
		return;
	}
	else
	{		
		ext = document.getElementById('upload_to_server_file_name').value;
		filepath = ext;		
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();    
	    if(ext != "")
	    {	  
             document.getElementById('form_upload_download_details').action = $host_url+"UploadFileToServer&filepath="+filepath+"&storage_path="+$("#download_upload_file_path").val();           
			 document.getElementById('form_upload_download_details').target='_new';
			 // document.getElementById('form_module_details_upload').target='report_display';
			 document.getElementById('form_upload_download_details').submit();
 		}    		   		 
	    else 
		{
	      alert("Please select a File");
		}
	} 	  
}
	 
function ValidateStudentMobileNo()
{
	var FMOBILE=$("#FMOBILE").val();
	if(empty(FMOBILE))
	{
		alert(FMOBILE);
		return false;
	}
		url_object=GetUrlParameters();
		 var r=url_object['r'];
		 var e=url_object['e'];
	$.ajax({
		type: "POST",
		async:false,
		data:"r="+r+"&e="+e+"&FMOBILE="+FMOBILE,
		url: $host_url+"ValidateStudentMobileNo",
		success: ValidateStudentMobileNoResponce
		});		 
}


function MakeOnlinePayment(app_no)
{

	window.location.href="payment_gateway.php?productinfo="+app_no;
}


function ValidateStudentMobileNoResponce(responce)
{
	responce = eval('(' + responce + ')');
	if(responce.error_code==0)
	{
		DisplayRevalutionApplications();
	}
	else
	{
		alert("Invalid Mobile No");
		$("#your_app_div").html("");
	}
} 

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 onsavevalidate(lobj,lval)
{
	forder = {};
	msfields = {};
	findex = {};
	if(mandfields.length ==  mandfields.lastIndexOf(",")+1)
		var mdfields = mandfields.substring(0, mandfields.length - 1);
	else 
		var mdfields =  mandfields;
	var msfields = mdfields.split(',');
	var validateStr ='';
	var findex = new Array();
	
	for(var i=0,j=0;i<msfields.length;i++)
	{
		if(trim(document.getElementById(msfields[i]).value) == '')
		{
			findex[j]=msfields[i];
			fieldtitle = document.getElementById(msfields[i]).title;
			fieldtitlearr = fieldtitle.split(',');
			validateStr += fieldtitlearr[0]+'\r\n';	
			j++;
		}	
	}	
	
	if(validateStr != '')
	{
		alert("Following fields are missing  / invalid\r\n\r\n"+validateStr);
		document.getElementById(findex[0]).focus();
		return findex[0];			
	}
	else
	{
		return 999;
	}
	
}

function onfocusvalidatepersonal(e)
{
	fldorder = 'T1,T17,T2,T3,T5,T6,T7,T8,T9,T10,T18,T11,T12,T13,T14,T19,T15,T16,T20';
	mandfields = 'T1,T17,T2,T3,T5,T6,T7,T8,T11,T12,T18,T19,T15,T16';
	
	if(e.keyCode == 13 || e.keyCode == 9  || e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 46)
	{ 
		var rtfocus = onfocusvalidate(e,999);		
		if(rtfocus!=999)
		{	
			return false;
		}	
	}
}
function acceptNumbersOnlyForModule(evt)
{
	var event = '';
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;

	return true;
}
var fldorder = '';
var mandfields = '';

function onfocusvalidate(event)
{
	function processkey3()
	{
	}
	document.body.onkeydown = processkey3;
	forder = {};
	mfields = {};
	if(fldorder.length ==  fldorder.lastIndexOf(",")+1)
		var tflorder = fldorder.substring(0, fldorder.length - 1);
	else 
		var tflorder =  fldorder;
	if(mandfields.length ==  mandfields.lastIndexOf(",")+1)
		var tmfields = mandfields.substring(0, mandfields.length - 1);
	else 
		var tmfields =  mandfields;
	
	var forder = tflorder.split(',');
	var mfields = tmfields.split(',');

    if ( event.keyCode == 9 ) 
	{
        event.preventDefault();
		event.stopPropagation();
    } 
	if(event.keyCode == 13)
	{	
		var focusid = document.activeElement.id;
		return formcontrol(forder,mfields,focusid);
	}
	/* if(event.keyCode == 9)
	{	
		var focusid = document.activeElement.id;
		return formcontrol(forder,mfields,focusid);
	} */
	if(event.keyCode == 38)
	{
		var focusid = document.activeElement.id;
		var Tindex = forder.indexOf(focusid);
		if(Tindex > 0)
			document.getElementById(forder[Tindex-1]).focus();
	}
	if(event.keyCode == 40)
	{
		var focusid = document.activeElement.id;
		var Tindex = forder.indexOf(focusid);
		if(Tindex > 0 && Tindex< forder.length-1)
			document.getElementById(forder[Tindex+1]).focus();
	}
}

function formcontrol(fcorder,mffields,lastfocus)
{
	var Tindex = mffields.indexOf(lastfocus);
	if(Tindex != -1)
	{
		if(trim(document.getElementById(lastfocus).value) =='')
		{	
			fieldtitle = document.getElementById(lastfocus).title;
			fieldtitlearr = fieldtitle.split(',');
			alert("Enter " +fieldtitlearr[0]);
			document.getElementById(lastfocus).focus();
			return lastfocus;
		}
		else
		{
			var Tcurrindex = fcorder.indexOf(lastfocus);
			if(Tcurrindex < fcorder.length-1)
			{
				document.getElementById(fcorder[Tcurrindex+1]).focus();
				return 999;
			}
			else
			{
				return 999;
			}	
		}
	}
	else
	{
		var Tcurrindex = fcorder.indexOf(lastfocus);
		if(Tcurrindex < fcorder.length-1)
		{
			document.getElementById(fcorder[Tcurrindex+1]).focus();
			return false;
		}
		else
		{
			return 999;
		}
	}
}