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


Current Path : /proc/thread-self/root/var/www/html/orms-gug/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/orms-gug/js/home_arun.js

/* var urlarr = window.location.pathname.split('/');
var $url="http://"+window.location.host+"/";
var $hoststr = '';
for(var j=1;j<urlarr.length-1;j++)
{
	$hoststr += window.location.pathname.split('/')[j]+"/"; 
}	
$host_url = $url+$hoststr+"app.php?a=";

$image_path = $url+$hoststr+"jqGrid3.5/cmes/tarka/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/";
 
function loadhomedropdown() 
{
	$("#TDISABILITY").hide();
	$("#PDISABILITY").hide();
	alert('arun');
	$.ajax({
	type: "POST",
	async:false,
	url:$host_url+'getdropdown', 
	success: function getcatcoderesponce(responce)
	{
		responce = eval('(' + responce + ')');
		document.getElementById("S3").options.length = 0;		
		var catcode =responce.data['catcode'];			
		$op = new Option("Select Category","#");
		$op.id=0;//specifying the id  for options
		document.getElementById("S3").options.add($op)
		for($i=0;$i < catcode.length;$i++)                                  
		{            
			$op = new Option(catcode[$i]['value'], catcode[$i]['internal_code']);
			$op.id=catcode[$i]['internal_code'];//specifying the id  for options
			document.getElementById("S3").options.add($op);
		}	
		
		document.getElementById("TBA42").options.length = 0;		
		var ugcode =responce.data['UG'];			
		$op = new Option("Select Bachelor’s degree","#");
		$op.id=0;//specifying the id  for options
		document.getElementById("TBA42").options.add($op)
		for($i=0;$i < ugcode.length;$i++)                                  
		{            
			$op = new Option(ugcode[$i]['value'], ugcode[$i]['internal_code']);
			$op.id=ugcode[$i]['internal_code'];//specifying the id  for options
			document.getElementById("TBA42").options.add($op);
		}
		
		document.getElementById("T49").options.length = 0;		
		var pgcode =responce.data['PG'];			
		$op = new Option("Select Master's degree","#");
		$op.id=0;//specifying the id  for options
		document.getElementById("T49").options.add($op)
		for($i=0;$i < pgcode.length;$i++)                                  
		{            
			$op = new Option(pgcode[$i]['value'], pgcode[$i]['internal_code']);
			$op.id=pgcode[$i]['internal_code'];//specifying the id  for options
			document.getElementById("T49").options.add($op);
		}
		//
		document.getElementById("1S1").options.length = 0;		
		var post =responce.data['post'];			
		$op = new Option("Select Post","");
		$op.id=0;//specifying the id  for options
		document.getElementById("1S1").options.add($op)
		for($i=0;$i < post.length;$i++)                                  
		{            
			$op = new Option(post[$i]['value'], post[$i]['internal_code']);
			$op.id=post[$i]['internal_code'];//specifying the id  for options
			document.getElementById("1S1").options.add($op);
		}
		
		document.getElementById("1S2").options.length = 0;		
		var course =responce.data['course'];
		setCookie('course',course);		
		$op = new Option("Select Qualifying Exam",'');
		$op.id=0;//specifying the id  for options
		document.getElementById("1S2").options.add($op)
		for($i=0;$i < course.length;$i++)                                  
		{            
			$op = new Option(course[$i]['value'], course[$i]['internal_code']);
			$op.id=course[$i]['internal_code'];//specifying the id  for options
			document.getElementById("1S2").options.add($op);
		}			
	}
	});	
	getDocumentsTable();	
} 

function postdeportment()
{
	$.ajax({
	type: "POST",
	async:false,
	url:$host_url+'getdropdown', 
	success: function getcatcoderesponce(responce)
	{
		responce = eval('(' + responce + ')');
		document.getElementById("S3").options.length = 0;		
		var catcode =responce.data['catcode'];			
		$op = new Option("Select Category",0);
		$op.id=0;//specifying the id  for options
		document.getElementById("S3").options.add($op)
		for($i=0;$i < catcode.length;$i++)                                  
		{            
			$op = new Option(catcode[$i]['value'], catcode[$i]['internal_code']);
			$op.id=catcode[$i]['internal_code'];//specifying the id  for options
			document.getElementById("S3").options.add($op);
		}
	}	
	});	
}

function enableappeared(id)
{
	//$("input[name=fqualify]:checked").val();

	if(document.getElementById(id).value == 'T')
	{
		$("#TDISABILITY").show();
		$("#PDISABILITY").show();
		document.getElementById("T14").value = '';
		document.getElementById("T15").value = '';	
		
	}
	else 
	{
		$("#TDISABILITY").hide();
		$("#PDISABILITY").hide();
		document.getElementById("T14").value = '';
		document.getElementById("T15").value = '';
	} 
}

/* function savepersonaldetails()
{
	var myobject = {};

	fldorder = 'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27';
	mandfields = 'T1';
	fieldarr = fldorder.split(",");

	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
	var fieldarrval = new Object();
	for(i=0; i<fieldarr.length; i++)
	{
		fieldarrval[fieldarr[i]] = document.getElementById(fieldarr[i]).value;
	} 		
	var fieldarrvalue  = encodeURIComponent(JSON.stringify(fieldarrval)); 
	var data = "fieldarrvalue="+fieldarrvalue;
	if(Object.size(fieldarrval)>0)
	{
		$upload = $host_url+"savepersonaldetails&"+data;	
		document.getElementById("form_module_image_upload").setAttribute("action",$upload);		
		return AIM.submit(document.getElementById("form_module_image_upload"), 'same_tab',{'onComplete' : savepersonaldetailssuccess});
		
	}
} */

function savepersonaldetails()
{
	var myobject = {};

	fldorder = 'T1,T2,T3,T4,T5,T6,T7,T8,T9,T11,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26';
	mandfields = 'T1';
	fieldarr = fldorder.split(",");

	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
	var fieldarrval = new Object();
	for(i=0; i<fieldarr.length; i++)
	{
		fieldarrval[fieldarr[i]] = document.getElementById(fieldarr[i]).value;
	} 	
	var fqualify =  $('input[name=fqualify]:checked').val();
	var fcatcode =  document.getElementById('S3').value;
	var fieldarrvalue  = encodeURIComponent(JSON.stringify(fieldarrval)); 
	//var data = "fieldarrvalue="+fieldarrvalue;
		var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var foreign_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "language"  )
		{   
			++rowCnt;
			if(document.getElementById(rowCnt+'HT3').value != 'T')
			{
				++chkCnt;
				foreign_arr[chkCnt] = new Object();
				foreign_arr[chkCnt]['spoken'] = document.getElementById(rowCnt+'HT1').value;
				foreign_arr[chkCnt]['written'] = document.getElementById(rowCnt+'HT2').value;
			}	
		}
	}
	
	
	
	if(Object.size(fieldarrval)>0)
	{
		$.ajax({
			type: "POST",
			url: $host_url+"savepersonaldetails",
			data:"fieldarrvalue="+fieldarrvalue+"&fqualify="+fqualify+"&fcatcode="+fcatcode+"&foreign_arr="+encodeURIComponent(JSON.stringify(foreign_arr)),
			success:savepersonaldetailsuccess
		});  
	}
}

function savepersonaldetailsuccess($responce)
{
	$responce = eval('(' + $responce + ')');
	if($responce.error_code==0)
	{		
		alert($responce.data);
		return;
	}
	else
	{
		alert($responce.data);
		return;		
	}
}

function saveeducationaldetails()
{
	var myobject = {};
	fldorder = 'T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45,T46,T47,T48,T50';
	fldorder +=',T51,T52,T53,T54,T55,T56,T57,T58,T59,T60,T61,T62,T63,T64,T65,T66,T67,T68,T69,T70,T71,T72,T73,T74,T75,T76,T77,T78,T79,T80';
	mandfields = 'T28';
	var fieldarrval = new Object();
	fieldarr = fldorder.split(",");

	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
	var ug = document.getElementById('TBA42').value;
	var pg = document.getElementById('T49').value;
	for(i=0; i<fieldarr.length; i++)
	{
		fieldarrval[fieldarr[i]] = document.getElementById(fieldarr[i]).value;
	} 	
	var fieldarrvalue  = encodeURIComponent(JSON.stringify(fieldarrval));
	if(Object.size(fieldarrval)>0)
	{
		$.ajax({
			type: "POST",
			url: $host_url+"saveeducationaldetails",
			data:"fieldarrvalue="+fieldarrvalue+"&ug="+ug+"&pg="+pg,
			success:saveeducationaldetailsssuccess
		});  
	}
}

function saveeducationaldetailsssuccess($responce)
{
	$responce = eval('(' + $responce + ')'); 
	
	if($responce.error_code==0)
	{		
		alert($responce.data);
		return;
	}
	else
	{
		alert($responce.data);
		return;		
	}
	
}

function savepublicationdetails()
{
	var myobject;
	fldorder = 'T176,T177,T178,T179,T180,T181,T182,T183,T184,T185,T186,T187,T189,T190,T191,T192,T193,T194,T195,T196,T197,T198,T199,T200,T201,T202,T203,T204,T205,T206,T207,T208,T209,T210,T211,T212,T213,T214,T215,T216,T217';
	mandfieldT = '';
	
	var fieldarrval = new Object();
	fieldarr = fldorder.split(",");

	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
	
	for(i=0; i<fieldarr.length; i++)
	{
		fieldarrval[fieldarr[i]] = document.getElementById(fieldarr[i]).value;
	} 
	
	var fieldarrvalue  = encodeURIComponent(JSON.stringify(fieldarrval));
	if(Object.size(fieldarrval)>0)
	{
		$.ajax({
			type: "POST",
			url: $host_url+"savepublicationdetails",
			data:"fieldarrvalue="+fieldarrvalue,
			success:savepublicationdetailssssuccess
		});  
	}

}

function savepublicationdetailssssuccess($responce)
{
	$responce = eval('('+$responce+')');
	if($responce.error_code == 0)
	{
		alert($responce.data);
		return;
	}
	else
	{	
		alert($responce.data);
		return;
	}
}

function saveexperiencedetails()
{
	var myobject = {};
	fldorder = 'T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45,T46,T47,T48,T49,T50';
	fldorder +=',T51,T52,T53,T54,T55,T56,T57,T58,T59,T60,T61,T62,T63,T64,T65,T66,T67,T68,T69,T70,T71,T72,T73,T74,T75,T76,T77,T78,T79,T80';
	mandfields = 'T28';
	var fieldarrval = new Object();
	fieldarr = fldorder.split(",");

	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
	
	for(i=0; i<fieldarr.length; i++)
	{
		fieldarrval[fieldarr[i]] = document.getElementById(fieldarr[i]).value;
	} 
	
	
	//////////////////////======to read multiple records====///////////
	var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var foreign_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "foreignvisit"  )
		{   
			++rowCnt;
			if(document.getElementById(rowCnt+'IT7').value != 'T')
			{
				++chkCnt;
				foreign_arr[chkCnt] = new Object();
				foreign_arr[chkCnt]['course'] = document.getElementById(rowCnt+'IT1').value;
				foreign_arr[chkCnt]['purpose'] = document.getElementById(rowCnt+'IT2').value;
				foreign_arr[chkCnt]['from']   = document.getElementById(rowCnt+'IT3').value;
				foreign_arr[chkCnt]['to']  = document.getElementById(rowCnt+'IT4').value;
				foreign_arr[chkCnt]['total']  = document.getElementById(rowCnt+'IT5').value;
				foreign_arr[chkCnt]['period']  = document.getElementById(rowCnt+'IT6').value;
			}	
		}
	}
	var dataString ="&array="+encodeURIComponent(JSON.stringify(foreign_arr));
	$.ajax({
	type:"POST",
	url:$host_url+"saveexperiencedetails",
	data:dataString,
	cache:false,
	success:function($responce)
	{	
		$responce = eval('('+$responce+')');
		if($responce.error_code == 0)
		{
			alert($responce.data);
		}
		else
			alert($responce.data);
	}	
	});

	alert(Object.size(fieldarrval));
}

function savepublicdetails()
{
	var myobject = {};

	fldorder = 'T176,T177,T178,T179,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27';
	mandfields = 'T1';
	fieldarr = fldorder.split(",");

	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
}

function saveorientationdetails()
{
	//////To read Multiple Records///////	
	
	var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var orientation_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "orientationdet" )
		{   
			++rowCnt;
			if(document.getElementById(rowCnt+'DT7').value != 'T')
			{
				++chkCnt; 
				orientation_arr[chkCnt] = new Object();
				orientation_arr[chkCnt]['Name'] = document.getElementById(rowCnt+'DT1').value;
				orientation_arr[chkCnt]['Rname'] = document.getElementById(rowCnt+'DT2').value;
				orientation_arr[chkCnt]['Sname']   = document.getElementById(rowCnt+'DT3').value;
				orientation_arr[chkCnt]['From']  = document.getElementById(rowCnt+'DT4').value;
				orientation_arr[chkCnt]['To']  = document.getElementById(rowCnt+'DT5').value;
				orientation_arr[chkCnt]['Remarks']  = document.getElementById(rowCnt+'DT6').value; 
			} 	
		}
	}
	
	//alert(Object.size(orientation_arr));
	
	var dataString ="&orientation_arr="+encodeURIComponent(JSON.stringify(orientation_arr));
	$.ajax({
	type:"POST",
	url:$host_url+"saveorientationdetails",
	data:dataString,
	cache:false,
	success:function($responce)
	{	
		$responce = eval('('+$responce+')');
		if($responce.error_code == 0)
		{
			alert($responce.data);
		}
		else
			alert($responce.data);
	}	
	});
	
}


function saveworkexperiencedetails()
{
	
	var myobject = {};

	fldorder = 'T81,T82,T83,T84,T85,T86,T87,T88,T89,T148,T149,T150,T151,T345';
	mandfields = '';
	fieldarr = fldorder.split(",");

	/*myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	} */
	var fieldarrval = new Object();
	for(i=0; i<fieldarr.length; i++)
	{
		fieldarrval[fieldarr[i]] = document.getElementById(fieldarr[i]).value;
	} 	
	var fdesignation = document.getElementById("T81").value;
	var forganisation = document.getElementById("T82").value;
	var fdoj = document.getElementById("T83").value;
	var fnature = document.getElementById("T84").value;
	
	var fcontribution = document.getElementById("T90").value;
	var ftotteachexp = document.getElementById("T148").value;
	var fpgexp = document.getElementById("T149").value;
	var fugexp = document.getElementById("T150").value;
	var ftotexp = document.getElementById("T151").value;
	var fpunish = document.getElementById("T345").value;
	
	var fieldarrvalue  = encodeURIComponent(JSON.stringify(fieldarrval)); 
	
	
	//////To read Multiple Records///////	
	
	var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var workexp_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "pastworkexp"  )
		{   
			++rowCnt;
			if(document.getElementById(rowCnt+'AT10').value != 'T')
			{
				++chkCnt;
				workexp_arr[chkCnt] = new Object();
				workexp_arr[chkCnt]['Post'] = document.getElementById(rowCnt+'AT1').value;
				workexp_arr[chkCnt]['Pay'] = document.getElementById(rowCnt+'AT2').value;
				workexp_arr[chkCnt]['Bpay']   = document.getElementById(rowCnt+'AT3').value;
				workexp_arr[chkCnt]['Gsal']  = document.getElementById(rowCnt+'AT4').value;
				workexp_arr[chkCnt]['Ename']  = document.getElementById(rowCnt+'AT5').value;
				workexp_arr[chkCnt]['From']  = document.getElementById(rowCnt+'AT6').value;
				workexp_arr[chkCnt]['To']  = document.getElementById(rowCnt+'AT7').value;
				workexp_arr[chkCnt]['Total']  = document.getElementById(rowCnt+'AT8').value;
				workexp_arr[chkCnt]['Nature']  = document.getElementById(rowCnt+'AT9').value;
			}	
		}
	}
	
	if(Object.size(fieldarrval)>0)
	{
		$.ajax({
			type: "POST",
			url: $host_url+"saveworkexperiencedetails",
			data:"&fieldarrvalue="+fieldarrvalue+"&fdesignation="+fdesignation+"&forganisation="+forganisation+"&workexp_arr="+encodeURIComponent(JSON.stringify(workexp_arr))+"&fdoj="+fdoj+"&fnature="+fnature+"&fcontribution="+fcontribution+"&ftotteachexp="+ftotteachexp+"&fpgexp="+fpgexp+"&fugexp="+fugexp+"&ftotexp="+ftotexp+"&fpunish="+fpunish;
			success:saveworkexperiencedetailssuccess
			alert(data);
			});  
	}

	/* var dataString ="&workexp_arr="+encodeURIComponent(JSON.stringify(workexp_arr))+"&fdesignation=fdesignation";
	$.ajax({
	type:"POST",
	url:$host_url+"saveworkexperiencedetailssuccess",
	data:dataString,
	cache:false,
	success:function($responce)
	{	
		$responce = eval('('+$responce+')');
		if($responce.error_code == 0)
		{
			alert($responce.data);
			return;
		}
		else
		{
			alert($responce.data);
			return;
		}
	}	
	}); */
	
}
function saveworkexperiencedetailssuccess($responce)
{
	$responce = eval('(' + $responce + ')');
	if($responce.error_code==0)
	{		
		alert($responce.data);
		return;
	}
	else
	{
		alert($responce.data);
		return;		
	}
}

function savereferences()
{
	var myobject;
		
	fldorder = 'S24,S25,S26,S27,S28,S29,S30,S31,S32,S33,S34,S35,S36,S37,S38,S39,S40,S41';
	mandfields = 'S24,S27,S30,S33,S36,S39';
	var fieldarrval = new Object();
	fieldarr = fldorder.split(",");
	
	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}		
	for(i=0; i<fieldarr.length; i++)
	{
		fieldarrval[fieldarr[i]] = document.getElementById(fieldarr[i]).value;
	} 	
	
	var fieldarrvalue  = encodeURIComponent(JSON.stringify(fieldarrval));

	if(Object.size(fieldarrval)>0)
	{
		$.ajax({
			type: "POST",
			url: $host_url+"savereferences",
			data:"fieldarrvalue="+fieldarrvalue,
			success:savereferencesuccess
		});  
	}
	
}

function savereferencesuccess($responce)
{
	$responce = eval('(' + $responce + ')'); 
	
	if($responce.error_code==0)
	{		
		alert($responce.data);
		return;
	}
	else
	{
		alert($responce.data);
		return;		
	}
}

function DisplayUserSelectedPhoto()
{
	var filepath;
	var valid_file_extentions = new Array("jpg");

	var ext=$("#student_photo_upload").val();
	filepath=ext;
	ext = ext.substring(ext.length-3,ext.length);
	ext = ext.toLowerCase();  

	if(ext != "" && valid_file_extentions == 'jpg' && valid_file_extentions == 'jpeg')
	{	      
		alert("Please Select the Valid Photo!");
		$("#student_photo_upload").val('')
		return false;
	}
	var lstr_data="filepath="+filepath;
	
	$upload = $host_url+"saveUserSelectedPhoto&"+lstr_data;	
	
	//$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });
	document.getElementById("form_module_image_upload").setAttribute("action",$upload);		
	return AIM.submit(document.getElementById("form_module_image_upload"), 'same_tab',{'onComplete' : DiaplayUserSelectedPhotoResponse});		 
		
}



function DiaplayUserSelectedPhotoResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	// $.unblockUI();
	if($responce.error_code==0)
	{		
		$("#student_photo").attr("src", $responce.data);
	}
	else if($responce.error_code==-1)	
		$("#student_photo").attr("src", "img/default_photo.jpg"); 
	else if($responce.error_code==-2)	
	{
		alert($responce.data);
		$("#student_photo").attr("src", "img/default_photo.jpg");
		$("#student_photo_upload").val("");
	} 
}

function DisplayUserSelectedSign()
{
	var filepath;
	var valid_file_extentions = new Array("jpg");

	var ext=$("#student_sign_upload").val();
	filepath=ext;
	ext = ext.substring(ext.length-3,ext.length);
	ext = ext.toLowerCase();  

	if(ext != "" && valid_file_extentions == 'jpg' && valid_file_extentions == 'jpeg')
	{	      
		alert("Please Select the Valid Photo!");
		$("#student_sign_upload").val('')
		return false;
	}
	var lstr_data="filepath="+filepath;
	
	$upload = $host_url+"saveUserSelectedSign&"+lstr_data;	
	
	//$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });
	document.getElementById("form_module_image_upload").setAttribute("action",$upload);		
	return AIM.submit(document.getElementById("form_module_image_upload"), 'same_tab',{'onComplete' : DiaplayUserSelectedSignResponse});		 
		
}

function DiaplayUserSelectedSignResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	// $.unblockUI();
	if($responce.error_code==0)
	{		
		$("#student_sign").attr("src", $responce.data);
	}
	else if($responce.error_code==-1)	
		$("#student_sign").attr("src", "img/default_photo.jpg"); 
	else if($responce.error_code==-2)	
	{
		alert($responce.data);
		$("#student_sign").attr("src", "img/default_photo.jpg");
		$("#student_sign_upload").val("");
	} 
}

function saveDetailsofForeignvisit()
{
	var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var foreign_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "foreignvisit"  )
		{   
			++rowCnt;
			if(document.getElementById(rowCnt+'IT7').value != 'T')
			{
				++chkCnt;
				foreign_arr[chkCnt] = new Object();
				foreign_arr[chkCnt]['country'] = document.getElementById(rowCnt+'IT1').value;
				foreign_arr[chkCnt]['purpose'] = document.getElementById(rowCnt+'IT2').value;
				foreign_arr[chkCnt]['from']   = document.getElementById(rowCnt+'IT3').value;
				foreign_arr[chkCnt]['to']  = document.getElementById(rowCnt+'IT4').value;
				foreign_arr[chkCnt]['total']  = document.getElementById(rowCnt+'IT5').value;
				foreign_arr[chkCnt]['period']  = document.getElementById(rowCnt+'IT6').value;
			}	
		}
	}
	var dataString ="&foreign_arr="+encodeURIComponent(JSON.stringify(foreign_arr));
	$.ajax({
	type:"POST",
	url:$host_url+"saveDetailsofForeignvisit",
	data:dataString,
	cache:false,
	success:function($responce)
	{	
		$responce = eval('('+$responce+')');
		if($responce.error_code == 0)
		{
			alert($responce.data);
		}
		else
			alert($responce.data);
	}	
	});
}

function getpersentage(id1,id2,id3)
{
	var num2 = document.getElementById(id1).value;
	var num1 =  document.getElementById(id2).value;
	if(num2 > num1)
	{
		alert('Marks Obtained should be less than Maximum Marks');
		document.getElementById(id2).focus();
		return;
	}
	var per = (num2/num1*100).toFixed(2);
	
	document.getElementById(id3).value = per;
}

function savepostdetails()
{
	var myobject;
	fldorder = '1S1,1S2';
	mandfields = '1S1,1S2';
	myobject = onsavevalidate.call(myobject, 999);
	if (myobject != 999)
	{
		document.getElementById(myobject).focus();
		return false;
	}
	//alert( document.getElementById("student_photo").src);	
	if($("#student_photo").val() == 'default_photo.jpg')
	{
		alert("Select valid photo file(accepts only jpg or jpeg)");
		$("#student_photo_upload").val('')
		return false;
	}	
	if($("#student_sign").val() == 'signature.png')
	{
		alert("Select valid sign file(accepts only jpg or jpeg)");
		$("#student_sign_upload").val('')
		return false;
	}	
	var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var post_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if ( inputFileds[counter].type.toUpperCase()=='HIDDEN'  && inputFileds[counter].name == "postname"  )
		{   
			++rowCnt;
			if(document.getElementById(rowCnt+'HS3').value != 'T')
			{
				++chkCnt;
				if(trim(document.getElementById(chkCnt+"S1").value) == '')
				{
					alert("Select Post");
					document.getElementById(chkCnt+"S1").focus();
					return false;
				}	
				if(trim(document.getElementById(chkCnt+"S2").value) == '')
				{
					alert("Select Qualifying Exam");
					document.getElementById(chkCnt+"S2").focus();
					return false;
				}		
				post_arr[chkCnt] = new Object();
				post_arr[chkCnt]['post'] = document.getElementById(rowCnt+'S1').value;
				post_arr[chkCnt]['course'] = document.getElementById(rowCnt+'S2').value;
			}
		}
	}	
	var dataString ="&post_arr="+encodeURIComponent(JSON.stringify(post_arr));
	$.ajax({
	type:"POST",
	url:$host_url+"savePostDetails",
	data:dataString,
	cache:false,
	success:function($responce)
	{	
		$responce = eval('('+$responce+')');
		if($responce.error_code == 0)
		{
			alert($responce.data);
			document.getElementById("ctab_post").className = "vsuccess";
		}
		else
			alert($responce.data);
	}	
	});
}

function uploadUserDoc(doc_id)
{
	var ext = $("#"+doc_id).val();
	var filepath = ext;	
	 
	if(empty(filepath))
	{ 
		alert("please select the file!");
		return false;
	}

	var list_data="";
	list_data = $host_url+"uploadUserDoc";			
	list_data += "&filepath="+filepath;	
	list_data += "&doc_id="+doc_id;	
	document.getElementById("form_doc_upload").setAttribute("action",list_data);
	return AIM.submit(document.getElementById("form_doc_upload"), 'report_display',{'onComplete' :uploadUserDocResponce});
}

function uploadUserDocResponce(responce)
{ 
	responce = eval('(' +responce + ')');
	var int_code=responce.data['id'];
	var path=responce.data['path'];
	var file_name=responce.data['file_name'];
	var html='<input type="hidden" id="att_'+int_code+'" value="A" /><a target="_blank" href="'+path+'" style="color:#AB45F9; padding-right:5px;"><img src="images/file-attachment.jpg"/></a>';
	$("#attach_td_"+int_code).html(html);
	$("#ed_"+int_code).focus();		 
}

function getDocumentsTable()
{
	$.ajax({
	type: "POST",
	url:$host_url+'getDocumentsTable', 
	success: function GetCMSAmountValueResponce(responce)
	{
		try
		{
			responce = eval('(' + responce + ')');
			$("#doc_table tbody").remove();	
			$("#doc_table").append(responce.data);			
		}	
		catch(err)
		{
			txt= err.message;
		}	
	}
	});	
}

function saveresearchdetails()
{
	//////To read Multiple Records///////	
	
	var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var research_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "researchexp" )
		{   
			++rowCnt;
			if(document.getElementById(rowCnt+'BT7').value != 'T')
			{
				++chkCnt; 
				research_arr[chkCnt] = new Object();
				research_arr[chkCnt]['Position'] = document.getElementById(rowCnt+'BT1').value;
				research_arr[chkCnt]['Emoluments'] = document.getElementById(rowCnt+'BT2').value;
				research_arr[chkCnt]['Uname']   = document.getElementById(rowCnt+'BT3').value;
				research_arr[chkCnt]['From']  = document.getElementById(rowCnt+'BT4').value;
				research_arr[chkCnt]['To']  = document.getElementById(rowCnt+'BT5').value;
				research_arr[chkCnt]['Noyears']  = document.getElementById(rowCnt+'BT6').value; 
			} 	
		}
	}
	
	var dataString ="&research_arr="+encodeURIComponent(JSON.stringify(research_arr));
	$.ajax({
	type:"POST",
	url:$host_url+"saveresearchdetails",
	data:dataString,
	cache:false,
	success:function($responce)
	{	
		$responce = eval('('+$responce+')');
		if($responce.error_code == 0)
		{
			alert($responce.data);
		}
		else
			alert($responce.data);
	}	
	});

}

function saveDetailsofOtherExp()
{
	var dataString ="&othexpdet="+document.getElementById('S23').value;
	$.ajax({
	type:"POST",
	url:$host_url+"saveDetailsofOtherExp",
	data:dataString,
	cache:false,
	success:function($responce)
	{	
		$responce = eval('('+$responce+')');
		if($responce.error_code == 0)
		{
			alert($responce.data);
		}
		else
			alert($responce.data);
	}	
	});
}