/*jsp functions starts here*/

var countryArray = new Array();
var stateArray = new Array();
var districtArray = new Array();
var nationalityArray = new Array();
var tablecheckboxid;
var prevCheckboxList;
var univSelectVal = '0';
var applicationData = new Array();

/*
            $(function() {

                $('#container-11').tabs();

               

            });

*/

            $(function() {

                $('#container-11').tabs();
				$('#showcontent2').click(function() {     
				
				// start : coded by Shaikh Nawaz (Date: 23 Mar, 2010) 
					
														
					if(isNaN(document.getElementById('txtPincode').value)){
						alert("Please enter number in Pin Code");
						document.getElementById('txtPincode').value='';
						document.getElementById('txtPincode').focus();
						$(this).parents('div').parents('div').eq(1).triggerTab(1);
						return false;
					}
					else if(isNaN(document.getElementById('txtSTDCode').value)){
						alert("Please enter number in STD Code");
						document.getElementById('txtSTDCode').value='';
						document.getElementById('txtSTDCode').focus();
						$(this).parents('div').parents('div').eq(1).triggerTab(1);
						return false;
					}
					else if(isNaN(document.getElementById('txtPhone').value)){
						alert("Please enter number in Telephone Field");
						document.getElementById('txtPhone').value='';
						document.getElementById('txtPhone').focus();
						$(this).parents('div').parents('div').eq(1).triggerTab(1);
						return false;
					}
					else if(isNaN(document.getElementById('txtMobile').value)){
						alert("Please enter number in Mobile Field");
						document.getElementById('txtMobile').value='';
						document.getElementById('txtMobile').focus();
						$(this).parents('div').parents('div').eq(1).triggerTab(1);
						return false;
					}
					else{				
                    	$(this).parents('div').parents('div').eq(1).triggerTab(2);
                    	return false;
                    }
                });
				//end : coded by Shaikh Nawaz (Date: 23 Mar, 2010) 
				
				$('#showcontent3').click(function() {
                    $(this).parents('div').parents('div').eq(1).triggerTab(3);
                    return false;
                });
				
				$('#showcontent4').click(function() {
                    $(this).parents('div').parents('div').eq(1).triggerTab(4);
                    return false;
                });
               
               

            });
			
			function fnChallanDownload()
			{
				//alert(templateName);
				document.onlineAppForm.method="POST";
				document.onlineAppForm.action="FileDownload";
				document.onlineAppForm.submit();
			}



function saveData()
	{
	
	//  var isVerified = verify();
	    var isVerified = true;
	    
	   
 		
 	  if(isVerified){

	   // document.getElementById("seccode").value = "";
	   var isValidate = doValidate();	

       if(isValidate){
       
       eval(document.getElementById("ajaxMethod").value);
         
    /*  
    	if(postSubmitValidationCall()){
        document.onlineAppForm.encoding = "multipart/form-data";
		document.onlineAppForm.subAction.value="saveFormData";
	    document.onlineAppForm.action = "onlineApplicationAction.do";
		document.onlineAppForm.submit();
		}
	*/	
		}		
		return isValidate;

      }
	}
	
	var s ;
function reloadcaptcha(){	    
		
        var img = document.getElementById("captcha_img_id");
		img.src = "/EForms/jsp/captcha.jsp?r="+(new Date()+"&pngRequest=true");		
		
		  setTimeout("update()", 1000);  // 3 Minuts  or 180 Sec
		  $('#container-11').triggerTab(4);
}

function cleardiv(pDivName)
{
	var lDIV = document.getElementById(pDivName);
	
	var lCount;
	if (lDIV.childNodes != null)
	{
		if (lDIV.childNodes.length > 0)
		{
			for(lCount = lDIV.childNodes.length - 1; lCount >= 0; lCount--)
			{
				lDIV.removeChild(lDIV.childNodes[lCount]);
			}
		}
	}
}


function update()
{	
	var lAJAXInteraction = new AJAXInteraction("/EForms/jsp/getcaptchadata.jsp?r="+(new Date())+"&pngRequest=true", null, true);
	lRequest = lAJAXInteraction.doGet('a=');		
	s= lRequest.responseText;
}	

function clearDefault(obj){
  // obj.value = "";
}

function checkSignUpEnter(e){
  var characterCode;
  
  if(e && e.which){
  		e = e;
  		characterCode = e.which;
  }
  else{
  	//e = event;
  	characterCode = e.keyCode;
  	
  }
  
  if(characterCode == 13){
	  //alert(characterCode);
  	verify();
  }
}

function verify(){
	var sec = trim(document.getElementById("seccode").value);
	var ses = trim(s);	
    ses = ses.replace(/\n/g, "");
    
   
 if(ses != sec){
      alert("The text you entered is Incorrect");
      document.getElementById("seccode").value = "";
      reloadcaptcha(); 
      return false;
   }   
   return true;   
}

function ltrim(str){
	if (str==null){return null;}
	for(var i=0;str.charAt(i)==" ";i++);
	return str.substring(i,str.length);
	}
function rtrim(str){
	if (str==null){return null;}
	for(var i=str.length-1;str.charAt(i)==" ";i--);
	return str.substring(0,i+1);
	}
function trim(str){return ltrim(rtrim(str));}


function copyUpload(){
   document.getElementById("submitPlace").innerHTML = document.getElementById("submitButton").innerHTML
   document.getElementById("submitButton").innerHTML = ""; 
 }


	function fnLogin(){
		document.onlineAppForm.method="POST";
		document.onlineAppForm.action="loginAction.do?subAction=ViewLoginPage";
		document.onlineAppForm.submit();
	}

 function  openImagePopUp(){
 
 window.open("applicantImageUploadAction.do?subAction=Display&formid=1","image","status=yes,height=600,width=800,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,top=100; left=100;");
  
 }

function displayMandatoryMark(){
//document.getElementById('span1').style.display = 'block';
//document.getElementById('span2').style.display = 'block';
//document.getElementById('span3').style.display = 'block';
//document.getElementById('span4').style.display = 'block';
document.getElementById('span1').style.display = '';
document.getElementById('span2').style.display = '';
document.getElementById('span3').style.display = '';
document.getElementById('span4').style.display = '';
}
 

function uploadPhotos(){

/*
 var photographFile=document.onlineAppForm.photographFile.value;
 var signatureImgFile=document.onlineAppForm.signatureImgFile.value;
 var parentSignatureImgFile=document.onlineAppForm.parentSignatureImgFile.value;
 var thumbImgFile=document.onlineAppForm.thumbImgFile.value;
 */
 
	 if(document.onlineAppForm.isPhotoUpload.value=='Y'){
	 	var valueTxtPhotoPath=	document.getElementById("txtPhotopath").value;
		if(valueTxtPhotoPath == ''){
			alert("Please upload latest photo.");
	        return false;
		}
	 }

 	if(document.onlineAppForm.isSignatureUpload.value=='Y'){
 		var valueTxtSignaturepath = document.getElementById("txtSignaturepath").value;
		if(valueTxtSignaturepath == ''){
			alert("Please upload scanned signature image.");
        	return false;
		}
	}
   
	if(document.onlineAppForm.isThumbUpload.value=='Y'){
		var valueTxtThumbpath = document.getElementById("txtThumbpath").value;
		if(valueTxtThumbpath == ''){
			alert("Please upload scanned thumb impression image.");
        	return false;
		}
	}
	
	if(document.onlineAppForm.isParentSignUpload.value=='Y'){
		var valueTxtParentSignpath = document.getElementById("txtParentSignpath").value;
		if(valueTxtParentSignpath == '')
    	{    	
			alert("Please upload scanned parent signature image.");
        	return false;
		}
	}
 	
 	document.onlineAppForm.method="POST";
	document.onlineAppForm.action="ImageFileUpload";
	document.onlineAppForm.submit();
}
/*jsp functions ends here*/

/* Ajax call starts here*/
function replace(str)
{	
	var string="";	
	var newstr = str.replace(/<!\[CDATA\[/, string);
	newstr=newstr.replace(/\]\]>/, string);	
	return newstr;
}


function ajaxValidationForEntity1(){
  
 // alert('working ajax.....');
    var http_request = false;	   
	if (window.XMLHttpRequest)
		{ // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType)
			{
				http_request.overrideMimeType('text/xml');
			}
		} 
	else if (window.ActiveXObject)
		{ // IE		           
			try {
				 http_request = new ActiveXObject("Msxml2.XMLHTTP");
		 		} catch (e)
					{
			   			 try {
			     		  http_request = new ActiveXObject("Microsoft.XMLHTTP");
				  			 } catch (e) {}
			    	}
		 }
		
	 if (!http_request)
	  {
	         return false;
       }
	
	
	var orgId = document.getElementById("OID");
 	var formId = document.getElementById("FID"); 
 	var txtCourseGroup = document.getElementById("txtCourseGroup");
 	var txtCourses = document.getElementById("txtCourses");
 	var txtTC1 = document.getElementById("txtTC1");
 	var txtTC2= document.getElementById("txtTC2");
 	var txtTC3= document.getElementById("txtTC3");
 	var txtCategory= document.getElementById("txtCategory");
 	var txtCourseUniversity = document.getElementById("txtCourseUniversity");
 	var vClassName = document.getElementById("vClassName");
    var pValidationServlet = document.onlineAppForm.preSubmitValidation.value;
    
    var parameters = "orgId="+orgId.value
    +"&formId="+formId.value
    +"&txtCourseGroup="+txtCourseGroup.value
    +"&txtCourses="+txtCourses.value
    +"&txtTC1="+txtTC1.value
    +"&txtTC2="+txtTC2.value
    +"&txtTC3="+txtTC3.value
    +"&txtCategory="+txtCategory.value
    +"&txtCourseUniversity="+txtCourseUniversity.value
    +"&vClassName="+vClassName.value
    +"&txtAppName="+document.getElementById('txtAppName').value
    
    +"&appDob="+document.getElementById('appDob').value
    +"&txtAppSex="+document.getElementById('txtAppSex').value
    +"&txtAppNationality="+document.getElementById('txtAppNationality').value
    +"&txtParentName="+document.getElementById('txtParentName').value
    +"&txtAddress1="+document.getElementById('txtAddress1').value
    +"&txtAddress2="+document.getElementById('txtAddress2').value
    +"&txtAddress3="+document.getElementById('txtAddress3').value
    +"&txtCity="+document.getElementById('txtCity').value
    +"&txtStateCode="+document.getElementById('txtStateCode').value
    +"&txtPincode="+document.getElementById('txtPincode').value
    +"&txtSTDCode="+document.getElementById('txtSTDCode').value
    +"&txtPhone="+document.getElementById('txtPhone').value
    +"&txtMobile="+document.getElementById('txtMobile').value
    +"&txtEmail="+document.getElementById('txtEmail').value
    +"&txtAltEmail="+document.getElementById('txtAltEmail').value
    +"&txt_InstPresentStudying="+document.getElementById('txt_InstPresentStudying').value
    +"&txtQualifyingExam="+document.getElementById('txtQualifyingExam').value
    +"&txtBoard_University="+document.getElementById('txtBoard_University').value
    +"&txt_YearPassing="+document.getElementById('txt_YearPassing').value
    +"&txt_DD_NO="+document.getElementById('txt_DD_NO').value
    +"&dt_DD="+document.getElementById('dt_DD').value
    +"&txt_DD_Drawn_Branch="+document.getElementById('txt_DD_Drawn_Branch').value
    +"&txt_DD_Issue_Branch="+document.getElementById('txt_DD_Issue_Branch').value
    +"&txt_DD_Code="+document.getElementById('txt_DD_Code').value
    +"&txtCourseUniversity="+document.getElementById('txtCourseUniversity').value
    +"&ug_pg_options="+document.getElementById('ug_pg_options').value;
   
 /*  
    +"&exam_statusOptions="+document.getElementById('exam_statusOptions').value
    +"&txt_UgInstPresentStudying="+document.getElementById('txt_UgInstPresentStudying').value
    +"&txtUgBoard_University="+document.getElementById('txtUgBoard_University').value
    +"&txtPGQualifyingExam="+document.getElementById('txtPGQualifyingExam').value
    +"&exam_pgStatusOptions="+document.getElementById('exam_pgStatusOptions').value;
    
  
    +"&txt12thSubject1="+document.getElementById('txt12thSubject1').value
    +"&txt12thSubject2="+document.getElementById('txt12thSubject2').value
    +"&txt12thSubject3="+document.getElementById('txt12thSubject3').value
    +"&txt12thSubject4="+document.getElementById('txt12thSubject4').value
    +"&txt12thSubject5="+document.getElementById('txt12thSubject5').value
    +"&txt12thSubject6="+document.getElementById('txt12thSubject6').value
    +"&txt12thSubject7="+document.getElementById('txt12thSubject7').value
    +"&txt12thSubject8="+document.getElementById('txt12thSubject8').value
    +"&txt12thSubject9="+document.getElementById('txt12thSubject9').value
    +"&txt12thSubject10="+document.getElementById('txt12thSubject10').value
    +"&txt12thMarksObt1="+document.getElementById('txt12thMarksObt1').value
    +"&txt12thMarksObt2="+document.getElementById('txt12thMarksObt2').value
    +"&txt12thMarksObt3="+document.getElementById('txt12thMarksObt3').value
    +"&txt12thMarksObt4="+document.getElementById('txt12thMarksObt4').value
    +"&txt12thMarksObt5="+document.getElementById('txt12thMarksObt5').value
    +"&txt12thMarksObt6="+document.getElementById('txt12thMarksObt6').value
    +"&txt12thMarksObt7="+document.getElementById('txt12thMarksObt7').value
    +"&txt12thMarksObt8="+document.getElementById('txt12thMarksObt8').value
    +"&txt12thMarksObt9="+document.getElementById('txt12thMarksObt9').value
    +"&txt12thMarksObt10="+document.getElementById('txt12thMarksObt10').value
    +"&txt12thMaxMarks1="+document.getElementById('txt12thMaxMarks1').value
    +"&txt12thMaxMarks2="+document.getElementById('txt12thMaxMarks2').value
    +"&txt12thMaxMarks3="+document.getElementById('txt12thMaxMarks3').value
    +"&txt12thMaxMarks4="+document.getElementById('txt12thMaxMarks4').value
    +"&txt12thMaxMarks5="+document.getElementById('txt12thMaxMarks5').value
    +"&txt12thMaxMarks6="+document.getElementById('txt12thMaxMarks6').value
    +"&txt12thMaxMarks7="+document.getElementById('txt12thMaxMarks7').value
    +"&txt12thMaxMarks8="+document.getElementById('txt12thMaxMarks8').value
    +"&txt12thMaxMarks9="+document.getElementById('txt12thMaxMarks9').value
    +"&txt12thMaxMarks10="+document.getElementById('txt12thMaxMarks10').value
    +"&txt12thPercent1="+document.getElementById('txt12thPercent1').value
    +"&txt12thPercent2="+document.getElementById('txt12thPercent2').value
    +"&txt12thPercent3="+document.getElementById('txt12thPercent3').value
    +"&txt12thPercent4="+document.getElementById('txt12thPercent4').value
    +"&txt12thPercent5="+document.getElementById('txt12thPercent5').value
    +"&txt12thPercent6="+document.getElementById('txt12thPercent6').value
    +"&txt12thPercent7="+document.getElementById('txt12thPercent7').value
    +"&txt12thPercent8="+document.getElementById('txt12thPercent8').value
    +"&txt12thPercent9="+document.getElementById('txt12thPercent9').value
    +"&txt12thPercent10="+document.getElementById('txt12thPercent10').value
    +"&txt12thMarksObtTot="+document.getElementById('txt12thMarksObtTot').value
    +"&txt12thMaxMarksTot="+document.getElementById('txt12thMaxMarksTot').value
    +"&txt12thPercentTot="+document.getElementById('txt12thPercentTot').value
    +"&txtUGMarksObt1="+document.getElementById('txtUGMarksObt1').value
    +"&txtUGMarksObt2="+document.getElementById('txtUGMarksObt2').value
    +"&txtUGMarksObt3="+document.getElementById('txtUGMarksObt3').value
    +"&txtUGMarksObt4="+document.getElementById('txtUGMarksObt4').value
    +"&txtUGMarksObt5="+document.getElementById('txtUGMarksObt5').value
    +"&txtUGMarksObt6="+document.getElementById('txtUGMarksObt6').value
    +"&txtUGMarksObt7="+document.getElementById('txtUGMarksObt7').value
    +"&txtUGMarksObt8="+document.getElementById('txtUGMarksObt8').value
    +"&txtUgMaxMarks1="+document.getElementById('txtUgMaxMarks1').value
    +"&txtUgMaxMarks2="+document.getElementById('txtUgMaxMarks2').value
    +"&txtUgMaxMarks3="+document.getElementById('txtUgMaxMarks3').value
    +"&txtUgMaxMarks4="+document.getElementById('txtUgMaxMarks4').value
    +"&txtUgMaxMarks5="+document.getElementById('txtUgMaxMarks5').value
    +"&txtUgMaxMarks6="+document.getElementById('txtUgMaxMarks6').value
    +"&txtUgMaxMarks7="+document.getElementById('txtUgMaxMarks7').value
    +"&txtUgMaxMarks8="+document.getElementById('txtUgMaxMarks8').value
    +"&txtUgPercent1="+document.getElementById('txtUgPercent1').value
    +"&txtUgPercent2="+document.getElementById('txtUgPercent2').value
    +"&txtUgPercent3="+document.getElementById('txtUgPercent3').value
    +"&txtUgPercent4="+document.getElementById('txtUgPercent4').value
    +"&txtUgPercent5="+document.getElementById('txtUgPercent5').value
    +"&txtUgPercent6="+document.getElementById('txtUgPercent6').value
    +"&txtUgPercent7="+document.getElementById('txtUgPercent7').value
    +"&txtUgPercent8="+document.getElementById('txtUgPercent8').value
    +"&txtUgMonthYr1="+document.getElementById('txtUgMonthYr1').value
    +"&txtUgMonthYr2="+document.getElementById('txtUgMonthYr2').value
    +"&txtUgMonthYr3="+document.getElementById('txtUgMonthYr3').value
    +"&txtUgMonthYr4="+document.getElementById('txtUgMonthYr4').value
    +"&txtUgMonthYr5="+document.getElementById('txtUgMonthYr5').value
    +"&txtUgMonthYr6="+document.getElementById('txtUgMonthYr6').value
    +"&txtUgMonthYr7="+document.getElementById('txtUgMonthYr7').value
    +"&txtUgMonthYr8="+document.getElementById('txtUgMonthYr8').value
    +"&txtUgMarksObtTot="+document.getElementById('txtUgMarksObtTot').value
    +"&txtUgMaxMarksTot="+document.getElementById('txtUgMaxMarksTot').value
    +"&txtUgPercentTot="+document.getElementById('txtUgPercentTot').value;
   */ 
    
    http_request.open('POST',pValidationServlet+parameters,true);       
	http_request.onreadystatechange = function() { handleServerResponse(http_request); }; 	 	                    
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");           
    // http_request.send("orgId="+orgId.value+"&formId="+formId.value+"&txtCourseGroup="+txtCourseGroup.value+"&txtCourses="+txtCourses.value+"&txtTC1="+txtTC1.value+"&txtTC2="+txtTC2.value+"&txtCategory="+txtCategory.value+"&txtCourseUniversity="+txtCourseUniversity.value+"&vClassName="+vClassName.value); //Posting txtname to Servlet
    // http_request.setRequestHeader("Content-Type", "multipart/form-data");  
	http_request.send(null); //Posting txtname to Servlet
	
}


function handleServerResponse(http_request){

var ERRORStr = new Array();
var MandCheck = new Array();
var responseError='';	
var fields;	
var flag='';
var flag1='';
  if (http_request.readyState == 4) { 
 //alert('inside http_request.readyState == 4'); 
          if (http_request.status == 200) {
//  alert('inside http_request.status == 200'); 
               if(http_request.responseText != null)
                {   
     			   	 var responseDoc= http_request.responseXML;	 
					 var docs = responseDoc.getElementsByTagName("DOCUMENT");
					 var noOfDocuments = docs.length; 
					 
					 for(count=0;count<noOfDocuments;count++)		//loop document
			 	    {	
			 		  fields = docs[count].getElementsByTagName("FIELD");
			 	    
				 	    for(fieldCount=0;fieldCount<fields.length;fieldCount++)  //loop field
							{	
							
							  var fieldName = fields[fieldCount].getAttribute("name");	
				   
				   
				 			  if(fieldName=="mandatoryCheck")
								{
									MandCheck[count] = fields[fieldCount].firstChild.nodeValue;
									MandCheck[count] = replace(MandCheck[count]);
								   
								    alert('Please enter '+MandCheck[count]);
								    flag1 = 'true';
								}	
				   
				   
				   
				   
				   		    	if(fieldName=="error")
								{
									ERRORStr[count] = fields[fieldCount].firstChild.nodeValue;
									ERRORStr[count] = replace(ERRORStr[count]);
								
								    responseError = responseError+'<br/>'+ERRORStr[count];
								    
								    //alert(ERRORStr[count]);
								}	
							
							
								if(fieldName=="status")
								{
									//ERRORStr[count] = fields[fieldCount].firstChild.nodeValue;
									//ERRORStr[count] = replace(ERRORStr[count]);
								    //alert('AJAX '+ERRORStr[count]);
								    //    if(ERRORStr[count]!='Saved'){
								    
								    responseError = responseError+'<br/>'+"Image Not Uploaded";
								    flag='Image not uploaded.';
								    alert("Please Upload your photos before submitting the form.");
								   // }
								}	
								
								
								
								
						
							}  
							// document.getElementById('message').innerHTML=responseError; 
					}
			    }
				
				
				if( (flag!=null && flag!='') || flag1!=''){
				$('#container-11').triggerTab(1);
				}
				else if(responseError!=null && responseError!=''){
				
				$('#container-11').triggerTab(3);
				}else{
				
				 document.onlineAppForm.encoding = "multipart/form-data";
		         //document.onlineAppForm.subAction.value="saveFormData";
		         document.getElementById("subAction").value="saveFormData";
		         document.onlineAppForm.action = "onlineApplicationAction.do";
		         document.onlineAppForm.submit();
			
				}
            }
        }
    }

    
 /*Ajax call ends here*/   
    
  
  
/*validation starts here*/ 
	function acceptcourse() {
		var txt_Amount;
		var txtCourseGroup;
		var txtCourses;
		var categoryarray = new Array();	
		var testcenterarray = new Array();
		var courseType;
		var y = '';
        
	    $("#ctl00_PlaceHolderMain_gvCourses").find('input').each(function () {
	        if ($(this).attr('checked') == true) {
	            x = $(this).val();
	            y = y + x + ',';
	            //alert(y);
	
	        }
	    });
		
	    if(y == ''){
	      alert("Please select a course before proceeding");
		  return false;     
	    }
	    var mystr = y.slice(0, -1);
		
		txtCourseGroup = tablecheckboxid;
		
		txtCourses = mystr;		
		
		testcenterarray = document.getElementById("testcenter_"+txtCourseGroup).value;
		//alert(testcenterarray);
		//alert(document.getElementById("category_"+txtCourseGroup));
		categoryarray = document.getElementById("category_"+txtCourseGroup).value;
		
		txt_Amount = document.getElementById("fee_"+txtCourseGroup).value;
		txt_dob = document.getElementById("dob_"+txtCourseGroup).value;
		courseType = document.getElementById("type_"+txtCourseGroup).value;
		
		// changes for universities

	    var q = '';
	
	    $("#ctl00_PlaceHolderMain_gvUniversities").find('input').each(function () {
	        if ($(this).attr('checked') == true) {
	            p = $(this).val();
	            q = q + p + ',';
	           }
	    });
	
	
	 	if(q == ''){
	      alert("Please select University before proceeding");
		  return false;     
	    }else{
	         q = q.slice(0,q.length-1); 
	         document.getElementById("txtCourseUniversity").value = q;
	    }
		// end:universities
		
		validate(txtCourseGroup, txtCourses, testcenterarray, txt_dob, txt_Amount, categoryarray,courseType);
		    
	} 

    /* 
  function acceptcourse() {



    var y = '';

    $("#ctl00_PlaceHolderMain_gvCourses").find('input').each(function () {
        if ($(this).attr('checked') == true) {
            x = $(this).val();
            y = y + x + '&';
            //alert(y);

        }
    });

    if(y == ''){
      alert("Please select a course before proceeding");
	  return false;     
    }
    var mystr = y.slice(0, -1);

    var course_array = mystr.split("&");
    if (tablecheckboxid == 'CheckBoxList1') {
        var binarystring = arraycontains(course_array, '996') + arraycontains(course_array, '997') + arraycontains(course_array, '998') + arraycontains(course_array, '999');
    }
    if (tablecheckboxid == 'CheckBoxList2') {
        var binarystring = arraycontains(course_array, '984') + arraycontains(course_array, '983') + arraycontains(course_array, '982');
    }
    if (tablecheckboxid == 'CheckBoxList3') {
        var binarystring = arraycontains(course_array, '977') + arraycontains(course_array, '976') + arraycontains(course_array, '975') + arraycontains(course_array, '974');
    }

    if (tablecheckboxid == 'CheckBoxList4') {
        var binarystring = arraycontains(course_array, '962');
    }
    if (tablecheckboxid == 'CheckBoxList5') {
        var binarystring = arraycontains(course_array, '961');
    }
    if (tablecheckboxid == 'CheckBoxList6') {
        var binarystring = arraycontains(course_array, '960') + arraycontains(course_array, '959');
    }

    if (tablecheckboxid == 'CheckBoxList7') {
        var binarystring = arraycontains(course_array, '958');
    }

    if (tablecheckboxid == 'CheckBoxList8') {
        var binarystring = arraycontains(course_array, '957');
    }

    if (tablecheckboxid == 'CheckBoxList9') {
        var binarystring = arraycontains(course_array, '956');
    }

    if (tablecheckboxid == 'CheckBoxList10') {
        var binarystring = arraycontains(course_array, '955');
    }
    if (tablecheckboxid == 'CheckBoxList11') {
        var binarystring = arraycontains(course_array, '954');
    }
    if (tablecheckboxid == 'CheckBoxList12') {
        var binarystring = arraycontains(course_array, '953');
    }
    if (tablecheckboxid == 'CheckBoxList13') {
        var binarystring = arraycontains(course_array, '952');
    }
    if (tablecheckboxid == 'CheckBoxList14') {
        var binarystring = arraycontains(course_array, '951');
    }
    if (tablecheckboxid == 'CheckBoxList15') {
        var binarystring = arraycontains(course_array, '950') + arraycontains(course_array, '949') + arraycontains(course_array, '948');
    }

    if (tablecheckboxid == 'CheckBoxList16') {
        var binarystring = arraycontains(course_array, '943');
    }

    if (tablecheckboxid == 'CheckBoxList17') {
        var binarystring = arraycontains(course_array, '942') + arraycontains(course_array, '941') + arraycontains(course_array, '940');
    }
    if (tablecheckboxid == 'CheckBoxList18') {
        var binarystring = arraycontains(course_array, '939');
    }
    if (tablecheckboxid == 'CheckBoxList19') {
        var binarystring = arraycontains(course_array, '938');
    }
    if (tablecheckboxid == 'CheckBoxList20') {
        var binarystring = arraycontains(course_array, '937');
    }
    if (tablecheckboxid == 'CheckBoxList21') {
        var binarystring = arraycontains(course_array, '936');
    }

    if (tablecheckboxid == 'CheckBoxList22') {
        var binarystring = arraycontains(course_array, '935');
    }
    if (tablecheckboxid == 'CheckBoxList23') {
        var binarystring = arraycontains(course_array, '934');
    }

    if (tablecheckboxid == 'CheckBoxList24') {
        var binarystring = arraycontains(course_array, '933') + arraycontains(course_array, '932') + arraycontains(course_array, '931');
    }
    if (tablecheckboxid == 'CheckBoxList25') {
        var binarystring = arraycontains(course_array, '926');
    }

    if (tablecheckboxid == 'CheckBoxList26') {
        var binarystring = arraycontains(course_array, '925') + arraycontains(course_array, '924');
    }
    if (tablecheckboxid == 'CheckBoxList27') {
        var binarystring = arraycontains(course_array, '922');
    }
    if (tablecheckboxid == 'CheckBoxList28') {
        var binarystring = arraycontains(course_array, '921');
    }
    if (tablecheckboxid == 'CheckBoxList29') {
        var binarystring = arraycontains(course_array, '920');
    }
    if (tablecheckboxid == 'CheckBoxList30') {
        var binarystring = arraycontains(course_array, '919') + arraycontains(course_array, '918');
    }
    if (tablecheckboxid == 'CheckBoxList31') {
        var binarystring = arraycontains(course_array, '916') + arraycontains(course_array, '915');
    }
    if (tablecheckboxid == 'CheckBoxList32') {
        var binarystring = arraycontains(course_array, '914');
    }
    if (tablecheckboxid == 'CheckBoxList33') {
        var binarystring = arraycontains(course_array, '913');
    }
    if (tablecheckboxid == 'CheckBoxList34') {
        var binarystring = arraycontains(course_array, '912');
    }

    if (tablecheckboxid == 'CheckBoxList35') {
        var binarystring = arraycontains(course_array, '911');
    }
    if (tablecheckboxid == 'CheckBoxList36') {
        var binarystring = arraycontains(course_array, '910');
    }

    if (tablecheckboxid == 'CheckBoxList37') {
        var binarystring = arraycontains(course_array, '909') + arraycontains(course_array, '908') + arraycontains(course_array,'907');
    }

    if (tablecheckboxid == 'CheckBoxList38') {
        var binarystring = arraycontains(course_array, '906');
    }

    if (tablecheckboxid == 'CheckBoxList39') {
        var binarystring = arraycontains(course_array, '905');
    }

    if (tablecheckboxid == 'CheckBoxList40') {
        var binarystring = arraycontains(course_array, '904');
    }

    if (tablecheckboxid == 'CheckBoxList41') {
        var binarystring = arraycontains(course_array, '903');
    }

    if (tablecheckboxid == 'CheckBoxList42') {
        var binarystring = arraycontains(course_array, '902') + arraycontains(course_array, '901');
    }

    if (tablecheckboxid == 'CheckBoxList43') {
        var binarystring = arraycontains(course_array, '899') + arraycontains(course_array, '898') + arraycontains(course_array, '897');
    }

    if (tablecheckboxid == 'CheckBoxList44') {
        var binarystring = arraycontains(course_array, '896');
    }
    if (tablecheckboxid == 'CheckBoxList45') {
        var binarystring = arraycontains(course_array, '895') + arraycontains(course_array, '894') + arraycontains(course_array, '893');
    }
    if (tablecheckboxid == 'CheckBoxList46') {
        var binarystring = arraycontains(course_array, '888');
    }

    if (tablecheckboxid == 'CheckBoxList47') {
        var binarystring = arraycontains(course_array, '887');
    }
    if (tablecheckboxid == 'CheckBoxList48') {
        var binarystring = arraycontains(course_array, '886') + arraycontains(course_array, '885') + arraycontains(course_array, '884');
    }
    if (tablecheckboxid == 'CheckBoxList49') {
        var binarystring = arraycontains(course_array, '879');
    }
    if (tablecheckboxid == 'CheckBoxList50') {
        var binarystring = arraycontains(course_array, '878');
    }
    if (tablecheckboxid == 'CheckBoxList51') {
        var binarystring = arraycontains(course_array, '877');
    }
    if (tablecheckboxid == 'CheckBoxList52') {
        var binarystring = arraycontains(course_array, '876') + arraycontains(course_array, '875');
    }
    if (tablecheckboxid == 'CheckBoxList53') {
        var binarystring = arraycontains(course_array, '874') + arraycontains(course_array, '873') + arraycontains(course_array, '872') + arraycontains(course_array, '871');
    }
    if (tablecheckboxid == 'CheckBoxList54') {
        var binarystring = arraycontains(course_array, '870');
    }
    if (tablecheckboxid == 'CheckBoxList55') {
        var binarystring = arraycontains(course_array, '869');
    }
    if (tablecheckboxid == 'CheckBoxList56') {
        var binarystring = arraycontains(course_array, '868');
    }
    if (tablecheckboxid == 'CheckBoxList57') {
        var binarystring = arraycontains(course_array, '867') + arraycontains(course_array, '866');
    }
    if (tablecheckboxid == 'CheckBoxList58') {
        var binarystring = arraycontains(course_array, '864');
    }
    if (tablecheckboxid == 'CheckBoxList59') {
        var binarystring = arraycontains(course_array, '863');
    }
    if (tablecheckboxid == 'CheckBoxList60') {
        var binarystring = arraycontains(course_array, '862');
    }
    if (tablecheckboxid == 'CheckBoxList61') {
        var binarystring = arraycontains(course_array, '861');
    }
    if (tablecheckboxid == 'CheckBoxList62') {
        var binarystring = arraycontains(course_array, '860');
    }


    var rownum = bin2dec(binarystring);

    getrowdata(tablecheckboxid, rownum);
    
 // changes for universities

    var q = '';

    $("#ctl00_PlaceHolderMain_gvUniversities").find('input').each(function () {
        if ($(this).attr('checked') == true) {
            p = $(this).val();
            q = q + p + ',';
           }
    });


 	if(q == ''){
      alert("Please select University before proceeding");
	  return false;     
    }else{
         q = q.slice(0,q.length-1); 
         document.getElementById("txtCourseUniversity").value = q;
    }
// end:universities    

}*/




function changetotalamount(valueindex) {

    var tableid = $(prevCheckboxList).attr('id');
    rownum = tableid.substring(12);

    if ((rownum >= 18 && rownum <= 25) || (rownum >= 29 && rownum <= 30) || (rownum == 32) || (rownum == 33) || (rownum == 36) || (rownum == 43) || (rownum == 50)) {
        if (valueindex == 2 || valueindex == 3) {
            
            document.getElementById('txt_Amounthidden').value = 500;
            document.getElementById('testcentertr').style.display = 'none';

        }

        if (valueindex == 1) {

            document.getElementById('txt_Amounthidden').value = 1500;
            document.getElementById('testcentertr').style.display = '';

        }
    }
}

// arrays



function addOption(selectbox, text, value) {

    var optn = document.createElement("OPTION");
    optn.text = text;
    optn.value = value;
    selectbox.options.add(optn);
}



function showdatetimepicker(fieldid) {

    jQuery("#" + fieldid).datepicker({
        yearRange: '1900:2100'

    });

    document.getElementById(fieldid).focus();

}


Date.prototype.defaultView=function(){
var dd=this.getDate();
if(dd<10)dd='0'+dd;
var mm=this.getMonth()+1;
if(mm<10)mm='0'+mm;
var yyyy=this.getFullYear();
return String(mm+"\/"+dd+"\/"+yyyy)
}



function doValidate() {

     	var currentTime = new Date();
		var todayDate = currentTime.defaultView();

    if (document.getElementById("txtAppName").value == '') {
        $('#container-11').triggerTab(1);
        alert("Please enter name of the applicant");
       
        return false;
    }
    if (document.getElementById("appDob").value == '') {
         $('#container-11').triggerTab(1);
        alert("Please enter the applicant Date of Birth.");
        return false;
    }
    
   
  // return   CompareDates_1(todayDate, "appDob");
    
    
  
    var str1 = document.getElementById('appDob').value;
    var str2 = todayDate;
   
    var mon1 = parseInt(str1.substring(0, 2), 10);
    var dt1 = parseInt(str1.substring(3, 5), 10);
    var yr1 = parseInt(str1.substring(6, 10), 10);
  
    var mon2 = parseInt(str2.substring(0, 2), 10);
    var dt2 = parseInt(str2.substring(3, 5), 10);
    var yr2 = parseInt(str2.substring(6, 10), 10);
    
    var date1 = new Date(yr1, mon1, dt1);
    var date2 = new Date(yr2, mon2, dt2);
     
    if (date2 < date1) {
        $('#container-11').triggerTab(1);
        alert("Applicant's Date of Birth cannot be greater than " + str2);
        return false;
    }
    
       
    
    
    if (document.getElementById("txtAppSex").value == '0') {
        $('#container-11').triggerTab(1);
        alert("Please select applicant's gender.");
        return false;
    }
    //alert("Nationality: "+document.getElementById("txtAppNationality").value);
    if (document.getElementById("txtAppNationality").value == '0') {
         $('#container-11').triggerTab(1);
        alert("Please select your Nationality.");
        return false;
    }

 	if(document.getElementById("txtParentName").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Parent's name.");
        return false;
    }
   
	if(document.getElementById("txtAddress1").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Address Line 1.");
        return false;
    }
    if(document.getElementById("txtAddress2").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Address Line 2.");
        return false;
    }
    /*
    if(document.getElementById("txtAddress3").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Address Line 3.");
        return false;
    }
    */
    if(document.getElementById("txtStateCode").value == '0'){
	  	$('#container-11').triggerTab(1);
		alert("Please select State.");
        return false;
    }
    
    if(document.getElementById("txtCity").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter the City.");
        return false;
    }
    if(document.getElementById("txtPincode").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter the Pincode.");
        return false;
    }
     if(document.getElementById("txtSTDCode").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Telephone STD Code.");
        return false;
    }
     if(document.getElementById("txtPhone").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Telephone Number.");
        return false;
    }
     if(document.getElementById("txtMobile").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Mobile Number.");
        return false;
    }
	
	 // start : coded by Shaikh Nawaz (Date: 23 Mar, 2010) 
	   
					if(isNaN(document.getElementById('txtPincode').value)){
						alert("Please enter number in Pin Code");
						$('#container-11').triggerTab(1);
						document.getElementById('txtPincode').value='';
						/*commented by Shaikh Nawaz(Date: 23 Mar, 2010)
							 document.getElementById('txtPincode').focus();
					    */
						return false;
					}
					
					if(isNaN(document.getElementById('txtSTDCode').value)){
						alert("Please enter number in STD Code");
						$('#container-11').triggerTab(1);
						document.getElementById('txtSTDCode').value='';
						/*commented by Shaikh Nawaz(Date: 23 Mar, 2010)
							 document.getElementById('txtSTDCode').focus();
					    */
						return false;
					}
					
					if(isNaN(document.getElementById('txtPhone').value)){
						alert("Please enter number in Telephone Field");
						$('#container-11').triggerTab(1);
						document.getElementById('txtPhone').value='';
						/*commented by Shaikh Nawaz(Date: 23 Mar, 2010)
							 document.getElementById('txtPhone').focus();
					    */
						return false;
					}
					
					if(isNaN(document.getElementById('txtMobile').value)){
						alert("Please enter number in Mobile Field");
						$('#container-11').triggerTab(1);
						document.getElementById('txtMobile').value='';
						/*commented by Shaikh Nawaz(Date: 23 Mar, 2010)
							 document.getElementById('txtMobile').focus();
					    */
						return false;
					}
					
 		//end : coded by Shaikh Nawaz (Date: 23 Mar, 2010)
     
   

	if(document.getElementById("txtEmail").value == ''){
		$('#container-11').triggerTab(1);
		alert("Please enter email id.");
        return false;
    }

	if(document.getElementById("txtConfirmEmail").value == ''){
		$('#container-11').triggerTab(1);
		alert("Please confirm email id.");
        return false;
    }

	if(document.getElementById("txtEmail").value != document.getElementById("txtConfirmEmail").value){
		$('#container-11').triggerTab(1);
		alert("The confirmed email id does not match with email id.");
        return false;
    }
    
    

	if(!validateEmail(document.getElementById('txtEmail').value,false)){
	  $('#container-11').triggerTab(1);	
	  alert('Invalid Email ID format valid Email Id - name@org.com or name@org.co.in ' );
 	//document.forms[0].emailId.focus();
	return false;
    }
    
    if(!validateEmail(document.getElementById('txtConfirmEmail').value,false)){
      $('#container-11').triggerTab(1);	
	  alert('Invalid Email ID format valid Email Id - name@org.com or name@org.co.in ' );
 	//document.forms[0].emailId.focus();
	return false;
    }


	if(document.getElementById('txtEmail').value == document.getElementById("txtAltEmail").value){
	$('#container-11').triggerTab(1);
	alert("Alternate Email can not same as Email.");
	return false;
	}
	/*
	 if(document.getElementById("txtAltEmail").value == ''){
	  	$('#container-11').triggerTab(1);
		alert("Please enter Alternate Email.");
        return false;
    }*/
    

	if (document.getElementById("ug_pg_options").value == '') {
    	$('#container-11').triggerTab(2);
        alert("Please choose UG/PG Course.");
        return false;
    }
	

	if (document.getElementById("ug_pg_options").value == 'UG') {
    
   	if( document.getElementById('txt_InstPresentStudying').value==''){
     	$('#container-11').triggerTab(2);
        alert("Please enter name of the Institute Presently studying In / Last Attend.");
        return false;
  	 }
    
   	 if( document.getElementById('txtQualifyingExam').value==''){
     	$('#container-11').triggerTab(2);
        alert("Please enter Qualifying Examination.");
        return false;
  	 }
    
    if( document.getElementById('exam_statusOptions').value==''){
     	$('#container-11').triggerTab(2);
        alert("Please choose exam Passed/Appearing status.");
        return false;
  	 }
    
      
    if( document.getElementById('exam_statusOptions').value=='Passed'){
     	
     	for(i=1;i<=8;i++){
     	
	     	 	 if (document.getElementById("txt12thSubject"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter "+i+" Subject Offered.");
			        return false;
			   	 }
			     if (document.getElementById("txt12thMarksObt"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter "+i+" Marks obtained.");
			        return false;
			   	 }
			    
			     if (document.getElementById("txt12thMaxMarks"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter "+i+" Maximum marks.");
			        return false;
			    	} 
	     	
	 			  if (document.getElementById("txt12thPercent"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter subject "+i+" % of marks.");
			        return false;
			    	}     	
			    	
			     if (document.getElementById("txt12thPercent"+i).value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Percentage can not grater than 100 for Subject "+i);
			        return false;
			    	}     
			    	
     	}
     	
     	
     	for(i=8;i<=10;i++){
     	
	     	 	if (document.getElementById("txt12thPercent"+i).value!='') {
			    	 if (document.getElementById("txt12thPercent"+i).value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Percentage can not grater than 100 for Subject "+i);
			        return false;
			    	}
			    	}  	
     	}
     	
     	
     	
     	
     	
           if (document.getElementById("txt12thMarksObtTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Marks Obtained");
			        return false;
			    	}
			    	
			    	 
	    	 if (document.getElementById("txt12thMaxMarksTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Maximum Marks");
			        return false;
			    	}
			    	
			    	 
	    	    if (document.getElementById("txt12thPercentTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Percentage of marks");
			        return false;
			    	}     	     	
     	
     	     if (document.getElementById("txt12thPercentTot").value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Total percentage can not grater than 100");
			        return false;
			    	}     
     	
     	
		     if( document.getElementById('txt_YearPassing').value==''){
		     	$('#container-11').triggerTab(2);
		        alert("Please select Year of Passing.");
		        return false;
		  	 }	
		     	
		     
      	
  	 }    
  	  if( document.getElementById('txtBoard_University').value==''){
		     	$('#container-11').triggerTab(2);
		        alert("Please enter name of the board university.");
		        return false;
		  	 }
     
    
    
    }


if (document.getElementById("ug_pg_options").value == 'PG') {
   
   			if( document.getElementById('InstPresentStudying').value==''){
		     	$('#container-11').triggerTab(2);
		        alert("Please enter name of the Institute Attended (10+2).");
		        return false;
		  	 }else{
		  	 document.getElementById('txt_InstPresentStudying').value = document.getElementById('InstPresentStudying').value;
		  	 }

			if( document.getElementById('Board_University').value==''){
		     	$('#container-11').triggerTab(2);
		        alert("Please select name of the Board/University (10+2).");
		        return false;
		  	 }else{
		  	 document.getElementById('txtBoard_University').value = document.getElementById('Board_University').value;
		  	 }

		  if( document.getElementById('YearPassing').value==''){
		     	$('#container-11').triggerTab(2);
		        alert("Please select Year of passing (10+2).");
		        return false;
		  	 }else{
		  	 document.getElementById('txt_YearPassing').value = document.getElementById('YearPassing').value;
		  	 }

	for(i=1;i<=8;i++){
     	
	     	 	 if (document.getElementById("txtSubject"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter "+i+" Subject Offered.");
			        return false;
			   	 }else{
			   	 document.getElementById("txt12thSubject"+i).value=document.getElementById("txtSubject"+i).value;
			   	 }
			   	 
			     if (document.getElementById("txtMarksObt"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter "+i+" Marks obtained.");
			        return false;
			   	 }else{
			   	 document.getElementById("txt12thMarksObt"+i).value=document.getElementById("txtMarksObt"+i).value;
			   	 }
			    
			     if (document.getElementById("txtMaxMarks"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter "+i+" Maximum marks.");
			        return false;
			    	}else{
			   	  document.getElementById("txt12thMaxMarks"+i).value=document.getElementById("txtMaxMarks"+i).value;
			   	 }
			    	
	     	
	 			  if (document.getElementById("txtPercent"+i).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter subject "+i+" % of marks.");
			        return false;
			    	}else{
			    	
			    	 if (document.getElementById("txtPercent"+i).value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Percentage can not greater than 100 for Subject "+i);
			        return false;
			    	}else{ 
			      document.getElementById("txt12thPercent"+i).value=document.getElementById("txtPercent"+i).value;
			   	}
			   	
			   	 }     	
     	}
     	
     	
     	for(i=8;i<=10;i++){
     	
	     	 	 if (document.getElementById("txtSubject"+i).value!='') {
			    	document.getElementById("txt12thSubject"+i).value=document.getElementById("txtSubject"+i).value;
			   	 }
			   	 
			     if (document.getElementById("txtMarksObt"+i).value!='') {
			     document.getElementById("txt12thMarksObt"+i).value=document.getElementById("txtMarksObt"+i).value;
			   	 }
			    
			     if (document.getElementById("txtMaxMarks"+i).value!='') {
			    	 document.getElementById("txt12thMaxMarks"+i).value=document.getElementById("txtMaxMarks"+i).value;
			   	}
			    	
	     	
	 			  if (document.getElementById("txtPercent"+i).value!='') {
			    	 if (document.getElementById("txtPercent"+i).value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Percentage can not greater than 100 for Subject "+i);
			        return false;
			    	}else{ 
			      		document.getElementById("txt12thPercent"+i).value=document.getElementById("txtPercent"+i).value;
			   			}
			    	}  	
     	}
     	
     	
     	
     	
     	
     	
     	
     	
     	      if (document.getElementById("txtMarksObtTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Marks Obtained");
			        return false;
			    	}else{
			    	 document.getElementById("txt12thMarksObtTot").value=document.getElementById("txtMarksObtTot").value;
			   	
			    	}
			    	
			    	 
	    	 if (document.getElementById("txtMaxMarksTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Maximum Marks");
			        return false;
			    	}else{
			   	    document.getElementById("txt12thMaxMarksTot").value=document.getElementById("txtMaxMarksTot").value;
			    	}
			    	
			    	 
	    	    if (document.getElementById("txtPercentTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Percentage of marks");
			        return false;
			    	}else{
			    	
			    	 if (document.getElementById("txtPercentTot").value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Total percentage can not greater than 100");
			        return false;
			    	}else{     
     		    	  document.getElementById("txt12thPercentTot").value=document.getElementById("txtPercentTot").value;
			    	}
			    	
			    	} 
	    	
     	
     	
			if (document.getElementById("txt_UgInstPresentStudying").value=='') {
	    	$('#container-11').triggerTab(2);
	        alert("Please enter name of the Institute Presently studying In /Last Attend(UG)");
	        return false;
	    	}

	        if (document.getElementById("txtUgBoard_University").value=='') {
	    	$('#container-11').triggerTab(2);
	        alert("Please enter name of the Board/University (UG)");
	        return false;
	    	}
	    	 if (document.getElementById("txtPGQualifyingExam").value=='') {
	    	$('#container-11').triggerTab(2);
	        alert("Please enter name of Qualifying Examination");
	        return false;
	    	}
	    	
	    	 if (document.getElementById("exam_pgStatusOptions").value=='') {
	    	$('#container-11').triggerTab(2);
	        alert("Please choose Exam Passed/Appearing status.");
	        return false;
	    	}
	    	
	    	if(document.getElementById("exam_pgStatusOptions").value=='Passed'){
	    	
	    	for(j=1;j<=8;j++){
	    	
	    	    if (document.getElementById('txtUGMarksObt'+j).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Semester "+j+"  Marks obtained.");
			        return false;
			   	 }
			     if (document.getElementById("txtUgMaxMarks"+j).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Semester "+j+" Maximum marks.");
			        return false;
			   	 }
			    
			     if (document.getElementById("txtUgPercent"+j).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Semester "+j+" Percentage of marks.");
			        return false;
			    	} 
	     	
	     	    if (document.getElementById("txtUgPercent"+j).value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Percentage can not greater than 100 for Semester "+j);
			        return false;
			    	}
	     	
	 			  if (document.getElementById("txtUgMonthYr"+j).value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Semester "+j+" Month & Year");
			        return false;
			    	}  
	    		
	    	}
	    	
	    	 if (document.getElementById("txtUgMarksObtTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Marks Obtained");
			        return false;
			    	}  
	    	 if (document.getElementById("txtUgMaxMarksTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Maximum Marks");
			        return false;
			    	}  
	    	 if (document.getElementById("txtUgPercentTot").value=='') {
			    	$('#container-11').triggerTab(2);
			        alert("Please enter Total Percentage of marks");
			        return false;
			    	}  
	    	 if (document.getElementById("txtUgPercentTot").value>100) {
			    	$('#container-11').triggerTab(2);
			        alert("Total percentage can not grater than 100");
			        return false;
			    	}
	    	
	    	
	    	
	    	}
	    	
	    	
	    	
	    	

}


    if(univSelectVal == '0'){
    	//alert("univSelectVal's value is zero......");
    	$('#container-11').triggerTab(3);
        alert("Please get the course details for the selected universities.");
        return false;    
    }



    if (document.getElementById("txtCategory").value == '0') {
    	$('#container-11').triggerTab(3);
        alert("Please select a Category.");
        return false;
    }

	

    if ((document.getElementById('testcentertr').style.display != 'none')) {
        if (document.getElementById("txtTC1").value == '0') {
            $('#container-11').triggerTab(3);
            alert("Please select a Test Center 1.");
            return false;
        }

        if ((document.getElementById('testcenterchoicetd2').style.display != 'none')) {
            if (document.getElementById("txtTC2").value == '0') {
                $('#container-11').triggerTab(3);
                alert("Please select a Test Center 2.");
                return false;
            }
            
            if(document.getElementById("txtTC1").value == document.getElementById("txtTC2").value){
             $('#container-11').triggerTab(3);
             alert("Please select different Test Center 2, Test Center 2 should not same as Test Center 1.");
             return false;
            
            }
            
            
            
        }
        
        if ((document.getElementById('testcenterchoicetd3').style.display != 'none')) {
            if (document.getElementById("txtTC3").value == '0') {
                $('#container-11').triggerTab(3);
                alert("Please select a Test Center 3.");
                return false;
            }
            
            if(document.getElementById("txtTC1").value == document.getElementById("txtTC3").value){
             $('#container-11').triggerTab(3);
             alert("Please select different Test Center 3, Test Center 3 should not same as Test Center 1.");
             return false;
            
            }
            
            if(document.getElementById("txtTC2").value == document.getElementById("txtTC3").value){
             $('#container-11').triggerTab(3);
             alert("Please select different Test Center 3, Test Center 3 should not same as Test Center 2.");
             return false;
            
            }
            
        }

    }

    if (document.getElementById('testcenterchoicetd2').style.display != 'none') {
        if (document.getElementById("txtTC1").value == '0') {
            $('#container-11').triggerTab(3);
            alert("Please select a Test Center 1");
            return false;
        }

        if (document.getElementById("txtTC2").value == '0') {
            $('#container-11').triggerTab(3);
            alert("Please select a Test Center 2.");
            return false;
        }
        
         if(document.getElementById("txtTC1").value == document.getElementById("txtTC2").value){
             $('#container-11').triggerTab(3);
             alert("Please select different Test Center 2, Test Center 2 should not same as Test Center 1.");
             return false;
            
            }
           
        
    }


		

//	if(document.getElementById('choose_dd').style.display != 'none'){
			if(document.getElementById("txt_DD_NO").value == ''){
			  $('#container-11').triggerTab(4);
			  alert("Please enter the DD Number.");
			  return false;
            } 
			
			if(document.getElementById('dt_DD').value == ''){
              $('#container-11').triggerTab(4);
              alert("Please select the DD date");
			  return false;
            } 

			if(document.getElementById('dd_Amount').value == ''){
				$('#container-11').triggerTab(4);
				alert("Please select course to know the DD Amount.");
				return false;
			}

			if(document.getElementById('txt_DD_Drawn_Branch').value == ''){
				$('#container-11').triggerTab(4);
				alert("Please enter the DD Drawn Bank Branch Name.");
				return false;
			}

            if(document.getElementById('txt_DD_Issue_Branch').value == ''){
				$('#container-11').triggerTab(4);
				alert("Please enter the DD Issuing Bank Branch Name.");
				return false;
			}
			
			if(document.getElementById('txt_DD_Code').value == ''){
				$('#container-11').triggerTab(4);
				alert("Please enter the DD Code.");
				return false;
			}	

//	}

	


    
    if(document.getElementById("acceptanceCHK").checked == false){
        $('#container-11').triggerTab(4);
        alert("Please accept the Terms and Conditions.");
		return false;
    }


	
return true;
}



function view(id) {
    document.getElementById('choose_dd').style.display = "none";
    document.getElementById('choose_netbank').style.display = "none";
    document.getElementById('choose_challan').style.display = "none";
    ge = document.getElementById('choose_' + id.value);

	if(id.value == "dd"){
		document.getElementById("payment_mode").value = "Demand Draft/Pay Order";
	}
    
    document.getElementById("payment_status").value = "Pending";
	//alert(id);
	//alert(document.getElementById("payment_mode").value);
	if(id.value == "dd"){
      document.getElementById("dd_Amount").value = document.getElementById("txt_Amount").value
    }

    if(id.value == "netbank"){
	  document.getElementById("onlineAmount").value = document.getElementById("txt_Amount").value;	
	  document.getElementById("billing_cust_name").value = document.getElementById("txtAppName").value;
	  
	  var address_1 = document.getElementById("txtAddress1").value;
	  var address_2 = document.getElementById("txtAddress2").value;
        var address_3 = "";
        var address = "";
	  if(document.getElementById("txtAddress3").value != ''){
          address_3 = document.getElementById("txtAddress3").value;
	    address = address_1 + "," + address_2 + ","+address_3;	
	  }else{
	    address = address_1 + "," + address_2;	
	  }
	  
	  
	  
	  
	    document.getElementById("isRedirect").value = "N";
	  	document.getElementById("billing_cust_address").value = address
		document.getElementById("billing_cust_city").value = document.getElementById("txtCity").value;
		document.getElementById("billing_cust_state").value = ""			
		document.getElementById("billing_zip_code").value = document.getElementById("txtPincode").value;	
		document.getElementById("billing_cust_country").value = "";
		document.getElementById("billing_cust_tel").value = document.getElementById("txtMobile").value;
		document.getElementById("billing_cust_email").value = document.getElementById("txtEmail").value;
		
		
		
		document.getElementById("delivery_cust_name").value = document.getElementById("txtAppName").value;			
		document.getElementById("delivery_cust_address").value = address
		document.getElementById("delivery_cust_city").value = document.getElementById("txtCity").value;
		document.getElementById("delivery_cust_state").value = ""
		document.getElementById("delivery_zip_code").value = document.getElementById("txtPincode").value;
		document.getElementById("delivery_cust_country").value =""			
		document.getElementById("delivery_cust_tel").value = document.getElementById("txtMobile").value;
		document.getElementById("delivery_cust_notes").value = "SUB-MERCHANT TEST";
		  
	  
    }

    ge.style.display = "block";
}




function doCourseSelectionTasks(checkboxList) {
    
    tablecheckboxid = $(checkboxList).attr('id');
    
    if (typeof prevCheckboxList != 'undefined' && prevCheckboxList != checkboxList) {
        $(prevCheckboxList).find('input').each(function () {
            $(this).attr('checked', false);
        });
    }
    prevCheckboxList = checkboxList;
}





function arraycontains(str, arrayelement) {
    for (var i = 0; i < str.length; i++) {
        if (str[i] == arrayelement) {
            return '1';
        }
    }
    return '0';

}

/*

function getrowdata(groupcode, n) {
    //alert(n);
    var groupcodeattr;
    var coursecodeattr;
    var dobattr;
    var amountattr;

    var count = 1;

    $("#table" + groupcode + " #" + groupcode + "_r" + n).find('td').each(function () {

        var x = $(this).html();

        if (count == 1) {
            groupcodeattr = x;
			//alert(x);
        }
        if (count == 3) {
            coursecodeattr = x
        }
        if (count == 4) {
            categorycode = x
        }
        if (count == 6) {

            testcenterattr = x

        }
        if (count == 8) {
            dobattr = x
        }
        if (count == 9) {
            amountattr = x
        }

        count++;
    });
    validate(groupcodeattr, coursecodeattr, testcenterattr, dobattr, amountattr, categorycode)
}


function bin2dec(init) {
    var power = init.length;
    var output = 0;
    for (i = 0; i <= power; i++) {
        if (init.charAt(i) == 0) {
            var preout = 0;
        } else {
            var xty = power - i - 1;
            var preout = Math.pow(2, xty);
        }
        var output = output + preout;
    }
    return output;
}

*/


var testcenterarray_UG = new Array("Delhi","Kota","Jaipur","Chandigarh","Kanpur","Varanasi","Allahabad","Lucknow","Kolkata","Jamshedpur","Bhubaneshwar","Sikkim_Majitar","Ranchi","Patna","Guwahati","Hyderabad","Vijaywada","Bangalore","Ernakulam","Manipal","Coimbatore","Chennai","Mangalore","Bhopal","Mumbai","Ahmedabad","Pune","Faridabad","Meerut","Agra","Rohtak","Ludhiana","Kolkata_Shakespeare (KK)","Delhi_Janakpuri (D2)");
var testcenterarrau_PG = new Array("Bangalore (BL)","Chennai (CH)","Mumbai (MM)","Pune (PN)","Kolkata_Shakespeare (KK)","Delhi_Janakpuri (D2)","Hyderabad (H2)","Manipal (MN)","Mangalore (MG)","Ahmedabad (AH)","Bhopal (BH)","Chandigarh (CD)","Ernakulam (ER)","Jaipur (JP)","Lucknow (LK)","Coimbatore (CO)","Kota","Faridabad","Meerut","Agra","Rohtak","Ludhiana","Allahabad");
var category_array = new Array("General","Foreign","NRI");
function validate(groupcodeattr, coursecodeattr, testcenterattr, dobattr, amountattr, categorycode,courseType) {

    var selecttestempty1 = "";
    selecttestempty1 += " <select style=\"width: 150px;\"  class=\" Country_field\" name=\"txtTC1\" id=\"txtTC1\">";
    selecttestempty1 += "	<option value=\"0\" selected=\"selected\">First Preference<\/option>";
    selecttestempty1 += "";
    selecttestempty1 += "";
    selecttestempty1 += "<\/select>";

    var selecttestempty2 = "";
    selecttestempty2 += " <select style=\"width: 150px;\"  class=\" Country_field\" name=\"txtTC2\" id=\"txtTC2\">";
    selecttestempty2 += "	<option value=\"0\" selected=\"selected\">Second Preference<\/option>";
    selecttestempty2 += "	";
    selecttestempty2 += "";
    selecttestempty2 += "<\/select> ";
    
    var selecttestempty3 = "";
    selecttestempty3 += " <select style=\"width: 150px;\"  class=\" Country_field\" name=\"txtTC3\" id=\"txtTC3\">";
    selecttestempty3 += "	<option value=\"0\" selected=\"selected\">Third Preference<\/option>";
    selecttestempty3 += "	";
    selecttestempty3 += "";
    selecttestempty3 += "<\/select> ";

    var categoryselectstr = "";
    categoryselectstr += "<select id=\"txtCategory\" name=\"txtCategory\" class=\" Country_field\"  onchange='changetotalamount(this.value)'>";
    categoryselectstr += "       ";
    categoryselectstr += "          <option value=\"0\">-----Select-----<\/option>";
    categoryselectstr += "       ";
    categoryselectstr += "         <\/select>";

    document.getElementById('categoryselecttd').innerHTML = categoryselectstr;
    document.getElementById('testcenterchoicetd1').innerHTML = selecttestempty1;
    document.getElementById('testcenterchoicetd2').innerHTML = selecttestempty2;
    document.getElementById('testcenterchoicetd3').innerHTML = selecttestempty3;

    document.getElementById('txtCourseGroup').value = groupcodeattr;
    document.getElementById('txtCourses').value = coursecodeattr;
    document.getElementById('txt_Amount').value = amountattr;
    document.getElementById('dob_check').value = dobattr;
    document.getElementById('txtCourseType').value = courseType;

	document.getElementById("dd_Amount").value = document.getElementById("txt_Amount").value;
	document.getElementById("onlineAmount").value = document.getElementById("txt_Amount").value;	
    

    var testcenterattr_array = testcenterattr.split(",");
    //alert("array length = "+testcenterattr_array.length);
	//alert(testcenterattr);
	if(testcenterattr=="")
	{
		document.getElementById('testcenterchoicetd2').style.display = 'none';
		document.getElementById('testcenterchoicetd3').style.display = 'none';
	                document.getElementById('testcentertr').style.display = 'none';
	}else{
    	if (testcenterattr_array.length == 1) {

        	for (var i = 0; i < testcenterattr_array.length; ++i) {
            	var tempvalue = parseInt(testcenterattr_array[i]) - 1;
            	// var x = testcenterarray[tempvalue];
            	var x;
	            if(courseType == '1'){
	            	x = testcenterarray_UG[tempvalue];
	            }else if(courseType == '2'){
	            	x = testcenterarrau_PG[tempvalue];
	            }
	            if (x) {
	                addOption(document.getElementById('txtTC1'), x, i + 1);
	                document.getElementById('testcenterchoicetd2').style.display = 'none';
	                document.getElementById('testcenterchoicetd3').style.display = 'none';
	                document.getElementById('testcentertr').style.display = '';
	            }
        	}
    	}else {

        	for (var i = 0; i < testcenterattr_array.length; ++i) {
            	var tempvalue = parseInt(testcenterattr_array[i]) - 1;
            	// var x = testcenterarray[tempvalue];
            	var x;
	            if(courseType == '1'){
	            	x = testcenterarray_UG[tempvalue];
	            }else if(courseType == '2'){
	            	x = testcenterarrau_PG[tempvalue];
	            }
	            if (x) {
	                addOption(document.getElementById('txtTC1'), x, i + 1);
	                addOption(document.getElementById('txtTC2'), x, i + 1);
	                addOption(document.getElementById('txtTC3'), x, i + 1);
	                document.getElementById('testcentertr').style.display = '';
	                document.getElementById('testcenterchoicetd2').style.display = '';
	                document.getElementById('testcenterchoicetd3').style.display = '';
	            } else {
	                document.getElementById('testcentertr').style.display = 'none';
	                document.getElementById('testcenterchoicetd2').style.display = 'none';
					document.getElementById('testcenterchoicetd3').style.display = 'none';
	            }
        	}
    	}
	}
    var categorycode_array = categorycode.split(",");

    for (var i = 0; i < categorycode_array.length; ++i) {
        var tempvaluec = parseInt(categorycode_array[i]) - 1;
       // var xc = categoryarray[tempvaluec];
       var xc = category_array[tempvaluec];

        addOption(document.getElementById('txtCategory'), xc, i + 1);
    }

   // CompareDates("dob_check", "appDob");
   
/*   var currentTime = new Date()
   var month = currentTime.getMonth() + 1
   var day = currentTime.getDate()
   var year = currentTime.getFullYear()
   var todayDate = month+'/'+day+'/'+year;
   CompareDates("todayDate", "appDob");
   */
}


function CompareDates(dobattr, appdob) {
    var str1 = document.getElementById(appdob).value;
    var str2 = document.getElementById(dobattr).value;
    var mon1 = parseInt(str1.substring(0, 2), 10);
    var dt1 = parseInt(str1.substring(3, 5), 10);
    var yr1 = parseInt(str1.substring(6, 10), 10);
    var dt2 = parseInt(str2.substring(0, 2), 10);
    var mon2 = parseInt(str2.substring(3, 5), 10);
    var yr2 = parseInt(str2.substring(6, 10), 10);
    var date1 = new Date(yr1, mon1, dt1);
    var date2 = new Date(yr2, mon2, dt2);


    if (date2 > date1) {
        alert("Applicant's Date of Birth cannot be greater than " + str2);
        return false;
    }

}


function CompareDates_1(dobattr, appdob) {
    var str1 = document.getElementById(appdob).value;
    var str2 = dobattr;
   
    var mon1 = parseInt(str1.substring(0, 2), 10);
    var dt1 = parseInt(str1.substring(3, 5), 10);
    var yr1 = parseInt(str1.substring(6, 10), 10);
  
    var mon2 = parseInt(str2.substring(0, 2), 10);
    var dt2 = parseInt(str2.substring(3, 5), 10);
    var yr2 = parseInt(str2.substring(6, 10), 10);
    
    var date1 = new Date(yr1, mon1, dt1);
    var date2 = new Date(yr2, mon2, dt2);
     
    if (date2 < date1) {
        $('#container-11').triggerTab(1);
        alert("Applicant's Date of Birth cannot be greater than " + str2);
        return false;
    }

}





function onlyAlpha_forName(key,e)
{

if (navigator.appName =="Microsoft Internet Explorer"){
	var oKey = event.keyCode;
	
	

	
	if((oKey > 64 && oKey < 91) || (oKey > 96 && oKey < 123) || (oKey == 32) || (oKey == 46) || (oKey == 39))
	{
		return true;
	}
	else
	{
		//alert ('Only Alphanumeric in this field.');
	}
}else{

	var oKey = e.charCode;
	
	
	if((oKey > 64 && oKey < 91) || (oKey > 96 && oKey < 123) || (oKey == 0) || (oKey == 32) || (oKey == 46) || (oKey == 39))
	{
		return true;
	}
	else
	{
		
	}
}
	
	return false;
}

function isNumber(key,event) {
 	var keyCode;
	var isIE;

	if(navigator.appName == "Microsoft Internet Explorer" || navigator.appName == "Netscape"){  
		keyCode = event.keyCode;
		
		isIE = 1;
		if(navigator.appName == "Netscape"){
		    keyCode = event.charCode;		   
			isIE = 0;
		}
	}else{
		keyCode = event.charCode;
		isIE = 0;
	}
		  
			if(isIE == 1 ){
			if(!((keyCode >= 48 && keyCode <= 57) ))
			{
			event.returnValue = false;
				}
			}
			else{
			if(!((keyCode >= 48 && keyCode <= 57) || keyCode == 0))
			{
			
				event.preventDefault();								
			}
						
	  }
}


function isfloatNumber(key,event) {
 	var keyCode;
	var isIE;

	if(navigator.appName == "Microsoft Internet Explorer" || navigator.appName == "Netscape"){  
		keyCode = event.keyCode;
		
		isIE = 1;
		if(navigator.appName == "Netscape"){
		    keyCode = event.charCode;		   
			isIE = 0;
		}
	}else{
		keyCode = event.charCode;
		isIE = 0;
	}
		  
			if(isIE == 1 ){
			if(!((keyCode >= 48 && keyCode <= 57) || keyCode==46))
			{
			event.returnValue = false;
				}
			}
			else{
			if(!((keyCode >= 48 && keyCode <= 57) || keyCode == 0 || keyCode==46))
			{
			
				event.preventDefault();								
			}
						
	  }
}





function onlyAlphaNumeric(key,e)
{

if (navigator.appName =="Microsoft Internet Explorer"){
	var oKey = event.keyCode;
	
	

	
	if((oKey > 64 && oKey < 91) || (oKey > 96 && oKey < 123) || (oKey == 32) || (oKey == 46) || (oKey == 39) || (oKey >= 48 && oKey <= 57))
	{
		return true;
	}
	else
	{
		return false;
		
	}
}else{

	var oKey = e.charCode;
	
	
	if((oKey > 64 && oKey < 91) || (oKey > 96 && oKey < 123) || (oKey == 0) || (oKey == 32) || (oKey == 46) || (oKey == 39) || (oKey >= 48 && oKey <= 57))
	{
		return true;
	}
	else
	{
		return false;
		
	}
}
	
}




function onlyAlphaNumWithSChar(key,e)
{

if (navigator.appName =="Microsoft Internet Explorer"){
	var oKey = event.keyCode;
	
	

	if((oKey > 64 && oKey < 91) || (oKey > 96 && oKey < 123) || (oKey == 32)  || (oKey >= 44 && oKey <= 57))
	{
		return true;
	}
	else
	{
		return false;
	}
}else{

	var oKey = e.charCode;
	
	
	if((oKey > 64 && oKey < 91) || (oKey > 96 && oKey < 123) || (oKey == 0) || (oKey == 32)  || (oKey >= 44 && oKey <= 57))
	{
		return true;
	}
	else
	{
		return false;		
	}
}	
}














function onlyEmail(key,e)
{
	if (navigator.appName =="Microsoft Internet Explorer"){
	var oKey = event.keyCode;
	

	
	
	if(oKey == 46 || oKey == 95 || (oKey > 47 && oKey <58) || (oKey >= 64 && oKey < 91) || (oKey > 96 && oKey < 123))
	{
		return true;
	}
	else
	{
		
	}}else{
	
	var oKey = e.charCode;

	
	if(oKey == 46 || oKey == 95 || (oKey > 47 && oKey <58) || (oKey >= 64 && oKey < 91) || (oKey > 96 && oKey < 123 || oKey==0))
	{
		return true;
	}
	else
	{
		//alert ('Only Alphanumeric in this field.');
	}
	
	
	
	
	}
	
	return false;
}

function validateEmail(addr,db) {

if (addr == '') return true;
var invalidChars = '\/\'\\ ";:?!()[]\{\}^|<>#$!~`^';
for (i=0; i<invalidChars.length; i++) {
   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
      if (db) alert('email address contains invalid characters');
      return false;
   }
}
for (i=0; i<addr.length; i++) {
   if (addr.charCodeAt(i)>127) {
      if (db) alert("email address contains non ascii characters.");
      return false;
   }
}

var atPos = addr.indexOf('@',0);
if (atPos == -1) {
   if (db) alert('email address must contain an @');
   return false;
}
if (atPos == 0) {
   if (db) alert('email address must not start with @');
   return false;
}
if (addr.indexOf('@', atPos + 1) > - 1) {
   if (db) alert('email address must contain only one @');
   return false;
}
if (addr.indexOf('.', atPos) == -1) {
   if (db) alert('email address must contain a period in the domain name');
   return false;
}
if (addr.indexOf('@.',0) != -1) {
   if (db) alert('period must not immediately follow @ in email address');
   return false;
}
if (addr.indexOf('.@',0) != -1){
   if (db) alert('period must not immediately precede @ in email address');
   return false;
}
if (addr.indexOf('..',0) != -1) {
   if (db) alert('two periods must not be adjacent in email address');
   return false;
}
var suffix = addr.substring(addr.lastIndexOf('.')+1);
if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
   if (db) alert('invalid primary domain in email address');
   return false;
}
return true;
}
/*validation ends here*/


function fnShowQualDetails(id){
document.getElementById('ug_pg_options').value = id.value;
document.getElementById('table_ug').style.display="none";
document.getElementById('table_pg').style.display="none";
document.getElementById('ug_mark_sheet_div').style.display="none";
document.getElementById('ugmarks_notice_div').style.display="none";



if(id.value=='UG'){
document.getElementById('table_ug').style.display="block";
document.getElementById('appFor1').checked="checked";
document.getElementById('appFor2').checked=false;
eval(resetElementsInDiv('table_pg'));
}else{
document.getElementById('appFor1').checked=false;
document.getElementById('appFor2').checked="checked";
document.getElementById('table_pg').style.display="block";
eval(resetElementsInDiv('table_ug'));
}

}

function fnShow12MarkSheet(id){

document.getElementById('exam_statusOptions').value = id.value;
document.getElementById('ug_mark_sheet_div').style.display="none";
document.getElementById('ugmarks_notice_div').style.display="none";

if(id.value=='Passed'){
document.getElementById('ug_mark_sheet_div').style.display="block";
document.getElementById("status1").checked="checked";
document.getElementById("status2").checked=false;
}else{
eval(resetElementsInDiv('ug_mark_sheet_div'));
document.getElementById('ugmarks_notice_div').style.display="block";
document.getElementById("status2").checked="checked";
document.getElementById("status1").checked=false;
}

}

function fnAssignStatus(id){
document.getElementById('exam_pgStatusOptions').value = id.value;
document.getElementById('div_Passed_UG_Markssheet').style.display="none";
document.getElementById('div_hide_UG_appearing').style.display="none";

if(id.value=="Passed"){
document.getElementById('div_Passed_UG_Markssheet').style.display="block";
}else{
eval(resetElementsInDiv('div_Passed_UG_Markssheet'));
document.getElementById('div_hide_UG_appearing').style.display="block";
}

}



function selectCourses(){
	univSelectVal = '1';
	//alert("univSelectValin select courses: "+univSelectVal);
	var q = '';

    $("#ctl00_PlaceHolderMain_gvUniversities").find('input').each(function () {
        if ($(this).attr('checked') == true) {
            p = $(this).val();
            q = q + p + ',';
           }
    });


 	if(q == ''){
      alert("Please select University before proceeding");
	  return false;     
    }else{
    	 
         q = q.slice(0,q.length-1); 
         document.getElementById("txtCourseUniversity").value = q;
         displaycourses();
    }
}


function displaycourses(){	

	var http_request = false;	   
	if (window.XMLHttpRequest)
		{ // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType)
			{
				http_request.overrideMimeType('text/xml');
			}
		} 
	else if (window.ActiveXObject)
		{ // IE		           
			try {
				 http_request = new ActiveXObject("Msxml2.XMLHTTP");
		 		} catch (e)
					{
			   			 try {
			     		  http_request = new ActiveXObject("Microsoft.XMLHTTP");
				  			 } catch (e) {}
			    	}
		 }
		
	 if (!http_request)
	  {
	         return false;
       }
	
	
	
	//var orgId = document.getElementById("OID").value;
 	//var formId = document.getElementById("FID").value;
 	
 	//var orgId = document.onlineAppForm.orgId.value;
 	//var formId = document.onlineAppForm.formId.value;
 	
 	var orgId = document.getElementById("orgId").value;
 	var formId = document.getElementById("formId").value; 	
 	 	 
 	var txtuniversityList = document.getElementById("txtCourseUniversity").value;
    
 	var vClassName = document.getElementById("vClassName");
    var pValidationServlet = document.onlineAppForm.preSubmitValidation.value;
    
    var parameters = "calltype=CourseSelect&orgId="+orgId+"&formId="+formId+"&txtCourseUniversity="+txtuniversityList;
        
    http_request.open('POST',pValidationServlet+parameters,true);       
	http_request.onreadystatechange = function() { fillCourseDetails(http_request); }; 	 	                    
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");               
	http_request.send(null); //Posting txtname to Servlet
}


function fillCourseDetails(http_request){
	if (http_request.readyState == 4) { 
          if (http_request.status == 200) {
          
               if(http_request.responseText != null)
                {  
                	var outerdiv = document.getElementById("courseDetails");
                	
                	children = outerdiv.childNodes.length;
					for(var count=0;count<children;count++)
					{
						outerdiv.removeChild(outerdiv.childNodes[0]);
					}
                     
                     outerdiv.style.display="block";
                 
                	 var group = new Array();
                	 var courseCode = new Array();
                	 var courseName = new Array();
                	 var testcenter = new Array();
                	 var courseType = new Array();
                	 var cat = new Array();
                	 var universities = new Array();
                	 var appfee = new Array();
                	 var maxDob = new Array();
                	 
     			   	 var responseDoc= http_request.responseXML;	 
					 var docs = responseDoc.getElementsByTagName("DOCUMENT");
					 var noOfDocuments = docs.length;
					 var previousGroup = '';
					 var currentGroup = '';
					 var checkBoxString = '';

					 if(noOfDocuments > 0){
					 
						for(count=0;count<noOfDocuments;count++)		//loop document
			 	    	{	
			 		  		fields = docs[count].getElementsByTagName("FIELD");
			 	      	 	      	
				 	    	for(fieldCount=0;fieldCount<fields.length;fieldCount++)  //loop field
							{	
								var fieldName = fields[fieldCount].getAttribute("name");
								/*var groupCode = '';
								var courseCode = '';
								var courseName = '';
								var testcenters = '';*/							
							
								if(fieldName == "GROUP"){
									group[count] = fields[fieldCount].firstChild.nodeValue;
									group[count] = replace(group[count]);							
								}
							
								if(fieldName == "COURSECODE"){
									courseCode[count] = fields[fieldCount].firstChild.nodeValue;
									courseCode[count] = replace(courseCode[count]);							
								}	
						    	
						    	if(fieldName == "COURSENAME"){
									courseName[count] = fields[fieldCount].firstChild.nodeValue;
									courseName[count] = replace(courseName[count]);							
								}
								
								if(fieldName == "TESTCENTER"){
									testcenter[count] = fields[fieldCount].firstChild.nodeValue;
									testcenter[count] = replace(testcenter[count]);							
								}
								
								if(fieldName == "COURSETYPE"){
									courseType[count] = fields[fieldCount].firstChild.nodeValue;
									courseType[count] = replace(courseType[count]);							
								}
								
								if(fieldName == "CATEGORY"){
									cat[count] = fields[fieldCount].firstChild.nodeValue;
									cat[count] = replace(cat[count]);							
								}
								
								if(fieldName == "UNIVERSITIES"){
									universities[count] = fields[fieldCount].firstChild.nodeValue;
									universities[count] = replace(universities[count]);							
								}
								
								if(fieldName == "APPLICATIONFEE"){
									appfee[count] = fields[fieldCount].firstChild.nodeValue;
									appfee[count] = replace(appfee[count]);							
								}	
								
								if(fieldName == "APPLICATIONDOB"){
									maxDob[count] = fields[fieldCount].firstChild.nodeValue;
									maxDob[count] = replace(maxDob[count]);							
								}							
				   			}
				   		}
				   		
				   		var tab = document.createElement("TABLE");
					    tab = document.createElement("TABLE");
					    tab.setAttribute("id","ctl00_PlaceHolderMain_gvCourses");
					    tab.setAttribute("width","100%");
					    tab.setAttribute("border","0");
					    tab.setAttribute("cellspacing","0");
					    tab.setAttribute("cellpadding","0");					 
					    tab.className="tablelist";					 
					    
					    
					    var thead = document.createElement("THEAD");
					 
					    var row = document.createElement("TR");
					 
					    var head1 = document.createElement("TH");
					    head1.setAttribute("width","10%");
					 
					    var headText1 = document.createTextNode("GROUP");
					    head1.appendChild(headText1);
					 
					    var head2 = document.createElement("TH");
					    head2.setAttribute("width","90%");
					    head2.setAttribute("scope","col");
					 
					    var headText2 = document.createTextNode("COURSES");
					    head2.appendChild(headText2);
					 
					    var span = document.createElement("SPAN");	
					    span.className="mandatory";					 
					    var mandateText = document.createTextNode("*");
					    span.appendChild(mandateText);
					    head2.appendChild(span);
					 
					    row.appendChild(head1);
					    row.appendChild(head2);
					 
					 	thead.appendChild(row);
					 	
					 	var tbody = document.createElement("TBODY");
					    // tbody.appendChild(row);	
					 
					    var tr = '';
					    var td1 = '';
					    var td2 = '';			
					    var span = '';
					    var spanidval = '';		
					    var text = '';					    
					    var innerTable = '';	
					    var innertbody = '';
					    var innertr = '';
						var innertd = '';
						var chkbox = '';
						var lbl = '';
						var courseNameText = '';				 
				   	
				   		for(i=0;i<group.length;i++)
				   		{
				   			currentGroup = group[i]; 
				   			if(i == 0){	
						    	tr = document.createElement("TR");							
								td1 = document.createElement("TD");
								span = document.createElement("SPAN");
								spanidval = "txtCourseGroup_"+currentGroup;
								span.setAttribute("id",spanidval);
								
								text = document.createTextNode("Group "+currentGroup);
								span.appendChild(text);
								td1.appendChild(span);
								
								td2 = document.createElement("TD");
															
																
								innerTable = document.createElement("TABLE");								
								innerTable.setAttribute("id",currentGroup);
								innerTable.setAttribute("border","0");								
							    innerTable.onclick = function(){							    					 
    												 tablecheckboxid = $(this).attr('id');
    
    												 if (typeof prevCheckboxList != 'undefined' && prevCheckboxList != this) {
        												$(prevCheckboxList).find('input').each(function () {$(this).attr('checked', false);	});
    												 }
    												 prevCheckboxList = this;
    												 resetTC();
    												}
													
								innertbody = document.createElement("TBODY");
								
								var innertr = document.createElement("TR");
								var innertd = document.createElement("TD");
								
								var chkbox = document.createElement("INPUT");
								chkbox.type = "checkbox";
								chkbox.name = "txtCourses_chk";
								chkbox.value = courseCode[i];
								//chkbox.id = "txtCourses_chk_0";
								chkbox.id = "txtCourses_chk_"+courseCode[i];
								
								var lbl = document.createElement("LABEL");
								
								var courseNameText = document.createTextNode(courseName[i]);
								lbl.appendChild(courseNameText);								
								innertd.appendChild(chkbox);
								innertd.appendChild(lbl);								
								innertr.appendChild(innertd);
								innertbody.appendChild(innertr);
								
								var testhidden = document.createElement("INPUT");
								testhidden.type = "hidden"
								testhidden.name = "testcenter_"+currentGroup;
								testhidden.id = "testcenter_"+currentGroup;
								testhidden.value = testcenter[i];
								
								var cathidden = document.createElement("INPUT");
								cathidden.type = "hidden"
								cathidden.name = "category_"+currentGroup;
								cathidden.id = "category_"+currentGroup;
								cathidden.value = cat[i];
								
								var univhidden = document.createElement("INPUT");
								univhidden.type = "hidden"
								univhidden.name = "univ_"+currentGroup;
								univhidden.id = "univ_"+currentGroup;
								univhidden.value = universities[i];
								
								var feehidden = document.createElement("INPUT");
								feehidden.type = "hidden"
								feehidden.name = "fee_"+currentGroup;
								feehidden.id = "fee_"+currentGroup;
								feehidden.value = appfee[i];
								
								var dobhidden = document.createElement("INPUT");
								dobhidden.type = "hidden"
								dobhidden.name = "dob_"+currentGroup;
								dobhidden.id = "dob_"+currentGroup;
								dobhidden.value = maxDob[i];
								
								var courseTypehidden = document.createElement("INPUT");
								courseTypehidden.type = "hidden"
								courseTypehidden.name = "type_"+currentGroup;
								courseTypehidden.id = "type_"+currentGroup;
								courseTypehidden.value = courseType[i];
														
								
								innertbody.appendChild(testhidden);
								innertbody.appendChild(cathidden);
								innertbody.appendChild(univhidden);
								innertbody.appendChild(feehidden);
								innertbody.appendChild(dobhidden);
								innertbody.appendChild(courseTypehidden);
								
								
						    }else if (previousGroup == currentGroup){
						    	
						    	innertr = document.createElement("TR");								
								innertd = document.createElement("TD");
								
								var chkbox = document.createElement("INPUT");
								chkbox.type = "checkbox";
								chkbox.name = "txtCourses_chk";
								chkbox.value = courseCode[i];
								//chkbox.id = "txtCourses_chk_0";
								chkbox.id = "txtCourses_chk_"+courseCode[i];
								
								lbl = document.createElement("LABEL");
								
								courseNameText = document.createTextNode(courseName[i]);
								lbl.appendChild(courseNameText);
								innertd.appendChild(chkbox);
								innertd.appendChild(lbl);								
								innertr.appendChild(innertd);
								innertbody.appendChild(innertr);
																
						    }else if((previousGroup != currentGroup)){					    
						    	
						    	innerTable.appendChild(innertbody);
								td2.appendChild(innerTable)								
								tr.appendChild(td1);
								tr.appendChild(td2);		
								tbody.appendChild(tr);
								
								tr = document.createElement("TR");
								
								td1 = document.createElement("TD");
								span = document.createElement("SPAN");
								spanidval = "txtCourseGroup_"+currentGroup;
								span.setAttribute("id",spanidval);
								
								text = document.createTextNode("Group "+currentGroup);
								span.appendChild(text);
								td1.appendChild(span);
								
								td2 = document.createElement("TD");								
								innerTable = document.createElement("TABLE");
								innerTable.setAttribute("id",currentGroup);
								innerTable.setAttribute("border","0");

								innerTable.onclick = function(){							    					 
    												 tablecheckboxid = $(this).attr('id');
    
    												 if (typeof prevCheckboxList != 'undefined' && prevCheckboxList != this) {
        												$(prevCheckboxList).find('input').each(function () {$(this).attr('checked', false);	});
    												 }
    												 prevCheckboxList = this;
    												 resetTC();
    												}
								
								innertbody = document.createElement("TBODY");								
								
								
								innertr = document.createElement("TR");
								innertd = document.createElement("TD");
								
								var chkbox = document.createElement("INPUT");
								chkbox.type = "checkbox";
								chkbox.name = "txtCourses_chk";
								chkbox.value = courseCode[i];
								//chkbox.id = "txtCourses_chk_0";
								chkbox.id = "txtCourses_chk_"+courseCode[i];
								
								lbl = document.createElement("LABEL");
								
								courseNameText = document.createTextNode(courseName[i]);
								lbl.appendChild(courseNameText);
								
								innertd.appendChild(chkbox);
								innertd.appendChild(lbl);								
								innertr.appendChild(innertd);
								innertbody.appendChild(innertr);
								
								var testhidden = document.createElement("INPUT");
								testhidden.type = "hidden"
								testhidden.name = "testcenter_"+currentGroup;
								testhidden.id = "testcenter_"+currentGroup;
								testhidden.value = testcenter[i];
								
								var cathidden = document.createElement("INPUT");
								cathidden.type = "hidden"
								cathidden.name = "category_"+currentGroup;
								cathidden.id = "category_"+currentGroup;
								cathidden.value = cat[i];
								
								var univhidden = document.createElement("INPUT");
								univhidden.type = "hidden"
								univhidden.name = "univ_"+currentGroup;
								univhidden.id = "univ_"+currentGroup;
								univhidden.value = universities[i];
								
								var feehidden = document.createElement("INPUT");
								feehidden.type = "hidden"
								feehidden.name = "fee_"+currentGroup;
								feehidden.id = "fee_"+currentGroup;
								feehidden.value = appfee[i];
								
								var dobhidden = document.createElement("INPUT");
								dobhidden.type = "hidden"
								dobhidden.name = "dob_"+currentGroup;
								dobhidden.id = "dob_"+currentGroup;
								dobhidden.value = maxDob[i];
								
								var courseTypehidden = document.createElement("INPUT");
								courseTypehidden.type = "hidden"
								courseTypehidden.name = "type_"+currentGroup;
								courseTypehidden.id = "type_"+currentGroup;
								courseTypehidden.value = courseType[i];
								
								innertbody.appendChild(testhidden);
								innertbody.appendChild(cathidden);
								innertbody.appendChild(univhidden);
								innertbody.appendChild(feehidden);
								innertbody.appendChild(dobhidden);
								innertbody.appendChild(courseTypehidden);
						    }						    
				   			previousGroup = currentGroup;
				   		}
				   	
					   	// alert(innerTable.value);
						innerTable.appendChild(innertbody);
						td2.appendChild(innerTable);							
						tr.appendChild(td1);
						tr.appendChild(td2);				   	
					   	tbody.appendChild(tr);
					   	tab.appendChild(thead);
					   	tab.appendChild(tbody);
					   	
				   		
				   		
				   		
				   		outerdiv.appendChild(tab);
				   		
				   		outerdiv.style.display="block";
				   		
				   	}else{
				   		
				   	}	
					  
					 
					 
				}
			}
	}				 



}


function resetElementsInDiv(div) {
	var elms = document.getElementById(div).getElementsByTagName('*');
	var maxI = elms.length;

	for(var i = 0; i < maxI; i++) {    
	        var elm = elms[i];          
	        if("input" == elm.tagName.toLowerCase()){
	            if (elm.type=="text"||elm.type=="password"||elm.type=="hidden") {    
	                elm.value=elm.defaultValue;        
	            } else if (elm.type=="radio"||elm.type=="checkbox") {
	                elm.checked=elm.defaultChecked;        
	            }       
	        }else if("select" == elm.tagName.toLowerCase() && elm.disabled == false){
	            for (var j=0; j<elm.options.length;j++) {  
	                elm.options[j].selected=elm.options[j].defaultSelected;
	            }                   
	        }else if("textarea" == elm.tagName.toLowerCase()){
	            elm.value=elm.defaultValue;    
	        }
	    } 

}

function resetTC(){
	var selecttestempty1 = "";
    selecttestempty1 += " <select style=\"width: 150px;\"  class=\" Country_field\" name=\"txtTC1\" id=\"txtTC1\">";
    selecttestempty1 += "	<option value=\"0\" selected=\"selected\">First Preference<\/option>";
    selecttestempty1 += "";
    selecttestempty1 += "";
    selecttestempty1 += "<\/select>";

    var selecttestempty2 = "";
    selecttestempty2 += " <select style=\"width: 150px;\"  class=\" Country_field\" name=\"txtTC2\" id=\"txtTC2\">";
    selecttestempty2 += "	<option value=\"0\" selected=\"selected\">Second Preference<\/option>";
    selecttestempty2 += "	";
    selecttestempty2 += "";
    selecttestempty2 += "<\/select> ";
    
    var selecttestempty3 = "";
    selecttestempty3 += " <select style=\"width: 150px;\"  class=\" Country_field\" name=\"txtTC3\" id=\"txtTC3\">";
    selecttestempty3 += "	<option value=\"0\" selected=\"selected\">Third Preference<\/option>";
    selecttestempty3 += "	";
    selecttestempty3 += "";
    selecttestempty3 += "<\/select> ";

    var categoryselectstr = "";
    categoryselectstr += "<select id=\"txtCategory\" name=\"txtCategory\" class=\" Country_field\"  onchange='changetotalamount(this.value)'>";
    categoryselectstr += "       ";
    categoryselectstr += "          <option value=\"0\">-----Select-----<\/option>";
    categoryselectstr += "       ";
    categoryselectstr += "         <\/select>";

    document.getElementById('categoryselecttd').innerHTML = categoryselectstr;
    document.getElementById('testcenterchoicetd1').innerHTML = selecttestempty1;
    document.getElementById('testcenterchoicetd2').innerHTML = selecttestempty2;
    document.getElementById('testcenterchoicetd3').innerHTML = selecttestempty3;

}

function resetUnivSelection(){
	univSelectVal = '0';
	//alert("univSelectVal in resetUnivSelection: "+univSelectVal);
}

function fnCloseImage(){
var closeimage = document.getElementById('savedimage').style.display="none";    
}


function getState(){ 
	var countryId = "";
	var stateId = "";
	var stateName = "";
	var statelist = document.getElementById('txtStateCode');
	
	statelist.options[0] = new Option('----Select-----','0');
	
	for(i=1;i<=stateArray.length;i++){
		var stArray = stateArray[i-1].split('!!');
		countryId = stArray[0];
		stateId = stArray[1];
		stateName = stArray[2];	   
	    statelist.options[i] = new Option(stateName,stateName);		
	}
}


function getNationality(){	
	var nationalityId = "";
	var nationalityName = "";
	var nationalitylist = document.getElementById('txtAppNationality');
	
	nationalitylist.options[0] = new Option('----Select-----','0');
	
	for(i=1;i<=nationalityArray.length;i++){	
		var stArray = nationalityArray[i-1].split('!!');	
		nationalityId = stArray[0];
		nationalityName = stArray[1];	   
	    nationalitylist.options[i] = new Option(nationalityName,nationalityId);		
	}
}

function openEditMode(){

	document.getElementById("photoDiv").style.visibility = "hidden";
	
	document.getElementById("entity_Id").value = applicationData[0];
	document.getElementById("appSeqNo").value = applicationData[1];
	//alert("appName: "+applicationData[2]);
	document.getElementById("txtAppName").value = applicationData[2];
	
	var appDobY=applicationData[3].substring(0,4);
    var appDobM=applicationData[3].substring(5,7);
    var appDobD=applicationData[3].substring(8,10);
	
	document.getElementById("appDob").value = appDobM + "/" + appDobD + "/" + appDobY;
	
	//alert("Date: "+applicationData[3]);
	    
    
    
   // alert("y:"+y+" m:"+m+" d:"+d);
	
	
	document.getElementById("txtAppSex").value = applicationData[4];
	
	document.getElementById("txtAppNationality").value = applicationData[5];
	document.getElementById("txtParentName").value = applicationData[6];
	document.getElementById("txtAddress1").value = applicationData[7];
	document.getElementById("txtAddress2").value = applicationData[8];
	document.getElementById("txtAddress3").value = applicationData[9];		
	document.getElementById("txtCity").value = applicationData[10];
	document.getElementById("txtStateCode").value = applicationData[11];
	document.getElementById("txtPincode").value = applicationData[12];
	document.getElementById("txtSTDCode").value = applicationData[13];
	document.getElementById("txtPhone").value = applicationData[14];
	document.getElementById("txtMobile").value = applicationData[15];
	document.getElementById("txtEmail").value = applicationData[16];
	document.getElementById("txtConfirmEmail").value = applicationData[16];
	document.getElementById("txtAltEmail").value = applicationData[17];
	document.getElementById("ug_pg_options").value = applicationData[18];
	
	
	if(applicationData[18] == "UG"){
		document.getElementById("appFor1").value=applicationData[18];
		document.getElementById("appFor1").checked="checked";
		fnShowQualDetails(document.getElementById("appFor1"));		
	}else if(applicationData[18] == "PG"){
	    document.getElementById("appFor2").value=applicationData[18];
		document.getElementById("appFor2").checked="checked";
		fnShowQualDetails(document.getElementById("appFor2"));		
	}	
	
	
	
	document.getElementById("txt_InstPresentStudying").value = applicationData[19];
	document.getElementById("txtQualifyingExam").value = applicationData[20];		
	document.getElementById("txtBoard_University").value = applicationData[21];
	document.getElementById("exam_statusOptions").value = applicationData[22];	
	
		
	if(applicationData[22] == "Passed"){
		document.getElementById("status1").value = applicationData[22];
		document.getElementById("status1").checked = "checked";
		fnShow12MarkSheet(document.getElementById("status1"));		
	}else if(applicationData[22] == "Appearing"){
		document.getElementById("status2").value = applicationData[22];
		document.getElementById("status2").checked = "checked";
		fnShow12MarkSheet(document.getElementById("status2"));		
	}	
	
	
	document.getElementById("txt_YearPassing").value = applicationData[23];
	document.getElementById("txt12thSubject1").value = applicationData[24];
	document.getElementById("txt12thSubject2").value = applicationData[25];
	document.getElementById("txt12thSubject3").value = applicationData[26];
	document.getElementById("txt12thSubject4").value = applicationData[27];
	document.getElementById("txt12thSubject5").value = applicationData[28];
	document.getElementById("txt12thSubject6").value = applicationData[29];
	document.getElementById("txt12thSubject7").value = applicationData[30];		
	document.getElementById("txt12thSubject8").value = applicationData[31];
	document.getElementById("txt12thSubject9").value = applicationData[32];
	document.getElementById("txt12thSubject10").value = applicationData[33];
	document.getElementById("txt12thMarksObt1").value = applicationData[34];
	document.getElementById("txt12thMarksObt2").value = applicationData[35];
	document.getElementById("txt12thMarksObt3").value = applicationData[36];
	document.getElementById("txt12thMarksObt4").value = applicationData[37];
	document.getElementById("txt12thMarksObt5").value = applicationData[38];
	document.getElementById("txt12thMarksObt6").value = applicationData[39];
	document.getElementById("txt12thMarksObt7").value = applicationData[40];	
	document.getElementById("txt12thMarksObt8").value = applicationData[41];
	document.getElementById("txt12thMarksObt9").value = applicationData[42];
	document.getElementById("txt12thMarksObt10").value = applicationData[43];
	document.getElementById("txt12thMaxMarks1").value = applicationData[44];
	document.getElementById("txt12thMaxMarks2").value = applicationData[45];
	document.getElementById("txt12thMaxMarks3").value = applicationData[46];	
	document.getElementById("txt12thMaxMarks4").value = applicationData[47];
	document.getElementById("txt12thMaxMarks5").value = applicationData[48];
	document.getElementById("txt12thMaxMarks6").value = applicationData[49];
	document.getElementById("txt12thMaxMarks7").value = applicationData[50];
	document.getElementById("txt12thMaxMarks8").value = applicationData[51];
	document.getElementById("txt12thMaxMarks9").value = applicationData[52];	
	document.getElementById("txt12thMaxMarks10").value = applicationData[53];
	document.getElementById("txt12thPercent1").value = applicationData[54];
	document.getElementById("txt12thPercent2").value = applicationData[55];
	document.getElementById("txt12thPercent3").value = applicationData[56];
	document.getElementById("txt12thPercent4").value = applicationData[57];
	document.getElementById("txt12thPercent5").value = applicationData[58];	
	document.getElementById("txt12thPercent6").value = applicationData[59];
	document.getElementById("txt12thPercent7").value = applicationData[60];
	document.getElementById("txt12thPercent8").value = applicationData[61];
	document.getElementById("txt12thPercent9").value = applicationData[62];
	document.getElementById("txt12thPercent10").value = applicationData[63];
	document.getElementById("txt12thMarksObtTot").value = applicationData[64];	
	document.getElementById("txt12thMaxMarksTot").value = applicationData[65];
	document.getElementById("txt12thPercentTot").value = applicationData[66];
	document.getElementById("txt_UgInstPresentStudying").value = applicationData[67];
	document.getElementById("txtUgBoard_University").value = applicationData[68];
	document.getElementById("txtPGQualifyingExam").value = applicationData[69];
	document.getElementById("exam_pgStatusOptions").value = applicationData[70];
	document.getElementById("txtUGMarksObt1").value = applicationData[71];
	document.getElementById("txtUGMarksObt2").value = applicationData[72];
	document.getElementById("txtUGMarksObt3").value = applicationData[73];
	document.getElementById("txtUGMarksObt4").value = applicationData[74];
	document.getElementById("txtUGMarksObt5").value = applicationData[75];
	document.getElementById("txtUGMarksObt6").value = applicationData[76];
	document.getElementById("txtUGMarksObt7").value = applicationData[77];
	document.getElementById("txtUGMarksObt8").value = applicationData[78];
	document.getElementById("txtUgMaxMarks1").value = applicationData[79];
	document.getElementById("txtUgMaxMarks2").value = applicationData[80];
	document.getElementById("txtUgMaxMarks3").value = applicationData[81];
	document.getElementById("txtUgMaxMarks4").value = applicationData[82];
	document.getElementById("txtUgMaxMarks5").value = applicationData[83];
	document.getElementById("txtUgMaxMarks6").value = applicationData[84];
	document.getElementById("txtUgMaxMarks7").value = applicationData[85];
	document.getElementById("txtUgMaxMarks8").value = applicationData[86];
	document.getElementById("txtUgPercent1").value = applicationData[87];
	document.getElementById("txtUgPercent2").value = applicationData[88];
	document.getElementById("txtUgPercent3").value = applicationData[89];
	document.getElementById("txtUgPercent4").value = applicationData[90];
	document.getElementById("txtUgPercent5").value = applicationData[91];
	document.getElementById("txtUgPercent6").value = applicationData[92];
	document.getElementById("txtUgPercent7").value = applicationData[93];
	document.getElementById("txtUgPercent8").value = applicationData[94];
	document.getElementById("txtUgMonthYr1").value = applicationData[95];
	document.getElementById("txtUgMonthYr2").value = applicationData[96];
	document.getElementById("txtUgMonthYr3").value = applicationData[97];
	document.getElementById("txtUgMonthYr4").value = applicationData[98];
	document.getElementById("txtUgMonthYr5").value = applicationData[99];
	document.getElementById("txtUgMonthYr6").value = applicationData[100];
	document.getElementById("txtUgMonthYr7").value = applicationData[101];
	document.getElementById("txtUgMonthYr8").value = applicationData[102];
	document.getElementById("txtUgMarksObtTot").value = applicationData[103];
	document.getElementById("txtUgMaxMarksTot").value = applicationData[104];
	document.getElementById("txtUgPercentTot").value = applicationData[105];
	document.getElementById("txtCourseUniversity").value = applicationData[106];
	
	if(applicationData[106] != ''){
		var univDetails = applicationData[106].split(",");
		
		for(var i=0;i<univDetails.length;i++){
			var universityValue = univDetails[i];
			document.getElementById("txtUniversity_chk_"+universityValue).checked = "checked"; 
		}
		
		selectCourses();		
	}
	
	setTimeout("fillothers()",1000);
	/*
	document.getElementById("txtCourseGroup").value = applicationData[107];
	tablecheckboxid=applicationData[107];	
	document.getElementById("txtCourses").value = applicationData[108];
	
	if(applicationData[108] != ''){
		var selectedCourses = applicationData[108].split(",");
		
		for(var j=0;j<selectedCourses.length;j++){
			var courseValue = selectedCourses[j];
			var course = "txtCourses_chk_"+courseValue;			
			document.getElementById(course).checked = "checked"; 
		}		
		acceptcourse();		
	}
		
	document.getElementById("txtCategory").value = applicationData[109];
	document.getElementById("txtTC1").value = applicationData[110];
	document.getElementById("txtTC2").value = applicationData[111];
	document.getElementById("txtTC3").value = applicationData[112];	
	document.getElementById("payment_mode").value = applicationData[113];
	document.getElementById("txt_Amount").value = applicationData[114];
	document.getElementById("dd_Amount").value = applicationData[114];
	document.getElementById("txt_DD_NO").value = applicationData[115];
	document.getElementById("dt_DD").value = applicationData[116];
	document.getElementById("txt_DD_Drawn_Branch").value = applicationData[117];
	document.getElementById("txt_DD_Issue_Branch").value = applicationData[118];
	document.getElementById("txt_DD_Code").value = applicationData[119];
	document.getElementById("payment_status").value = applicationData[120];
	document.getElementById("txt_CreditCardName").value = applicationData[121];
	document.getElementById("txtCourseType").value = applicationData[122];	
	document.getElementById("subAction").value = 'saveFormData';
	
	*/
}

function fillothers(){
	document.getElementById("txtCourseGroup").value = applicationData[107];
	tablecheckboxid=applicationData[107];	
	document.getElementById("txtCourses").value = applicationData[108];
	
	if(applicationData[108] != ''){
		var selectedCourses = applicationData[108].split(",");
		
		for(var j=0;j<selectedCourses.length;j++){
			var courseValue = selectedCourses[j];
			var course = "txtCourses_chk_"+courseValue;			
			document.getElementById(course).checked = "checked"; 
		}		
		acceptcourse();		
	}
		
	document.getElementById("txtCategory").value = applicationData[109];
	document.getElementById("txtTC1").value = applicationData[110];
	document.getElementById("txtTC2").value = applicationData[111];
	document.getElementById("txtTC3").value = applicationData[112];	
	document.getElementById("payment_mode").value = applicationData[113];
	document.getElementById("txt_Amount").value = applicationData[114];
	document.getElementById("dd_Amount").value = applicationData[114];
	document.getElementById("txt_DD_NO").value = applicationData[115];
	
	var ddY=applicationData[116].substring(0,4);
    var ddM=applicationData[116].substring(5,7);
    var ddD=applicationData[116].substring(8,10);
	
	document.getElementById("dt_DD").value = ddM+"/"+ddD+"/"+ddY;
	document.getElementById("txt_DD_Drawn_Branch").value = applicationData[117];
	document.getElementById("txt_DD_Issue_Branch").value = applicationData[118];
	document.getElementById("txt_DD_Code").value = applicationData[119];
	document.getElementById("payment_status").value = applicationData[120];
	document.getElementById("txt_CreditCardName").value = applicationData[121];
	document.getElementById("txtCourseType").value = applicationData[122];	
	document.getElementById("subAction").value = 'saveFormData';


}

