//***********************************************************

var childwin=null;
var childwin1 = null;
var childwin_m = null;

//*********************************************

function openGlossWin(url) {
url = '/html/'+url;

if(childwin && childwin.closed==false)
childwin.close();
var childwin = window.open(url,'gloss','top=100,left=100,height=600,width=800toolbar=no,scrollbars=yes,resizable=yes,menubar=no,screenX=0,screenY=0"');

}

//===================================================

function ask(msg, target)
{
	if (confirm(msg) == true)
	location.replace(target);		
}

//===================================================

function formtooltip(el,flag)
{
    	elem = document.getElementById(el);
    	
    	if (flag) 
    	{ 
      		elem.parentNode.parentNode.style.zIndex=1000;
      		elem.parentNode.parentNode.style.borderRight='0px solid #000';
      		// ugly , yes .. but necessary to avoid a small but very annoying bug in IE6
      		elem.style.visibility='visible';
    	}
    	else 
    	{
      		elem.parentNode.parentNode.style.zIndex=1;
      		elem.parentNode.parentNode.style.border='none';
      		elem.style.visibility='hidden' 
      	};
}

//===================================================

function open_fullwindow(link, title)
{
	if(childwin && childwin.closed==false)
	childwin.close(); //width=800, height=600,
	childwin = window.open(link, title, "toolbar=no,scrollbars=yes,resizable=yes,menubar=yes,screenX=0,screenY=0");
}
//===================================================

function open_smallwindow(link, title)
{
	if(childwin1 && childwin1.closed==false)
	childwin1.close(); //width=800, height=600,
	childwin1 = window.open(link, title, "width=600, height=400,toolbar=no,scrollbars=yes,resizable=yes,menubar=no,screenX=0,screenY=0");
}
//===================================================

function open_capwindow(link, title)
{
	if(childwin1 && childwin1.closed==false)
	childwin1.close(); //width=800, height=600,
	childwin1 = window.open(link, title, "width=850, height=600,toolbar=no,scrollbars=yes,resizable=yes,menubar=no,screenX=0,screenY=0");
}

//===================================================

function open_fullwindow1(link, title)
{
	if(childwin && childwin.closed==false)
	childwin.close();
	childwin = window.open(link, title, "width=800, height=600,toolbar=no,scrollbars=yes,resizable=yes,menubar=no,screenX=0,screenY=0");
}
//***********************************************************

function open_multiwindow(link, title)
{
	childwin_m = window.open(link, title, "toolbar=no,scrollbars=yes,resizable=yes,menubar=no,screenX=0,screenY=0");
}

//***********************************************************

function CheckSum(flag)
{
	var msg;
	var total;
	var a;
	var b;
	var fld;
	var tag;

	var tag1 = document.all ?  document.all.t_XI_Prog_app_status_ftpt // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_Prog_app_status_ftpt') // NN6
    		   : null; 

	var tag2 = document.all ?  document.all.t_ftpt_total // IE4+
    		   : document.getElementById ? document.getElementById('t_ftpt_total') // NN6
    		   : null; 
    		   	
	if(flag == 1)
	{	
		total = document.forms[0].XI_Prog_app_ftpt_total.value;
		a = document.forms[0].XI_Prog_app_status_ft.value;
		b = document.forms[0].XI_Prog_app_status_pt.value;
		fld = 'XI_Prog_app_ftpt_total';
		
		msg = 'The total number of applicants must equal the sum  of all full-time and all part-time applicants.';

		tag = document.all ?  document.all.t_XI_Prog_app_status // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_Prog_app_status') // NN6
    				   : null; 		
    				   		
	}	
	else if(flag == 2)
	{	
		total = document.forms[0].XI_Prog_acc_ftpt_total.value;
		a = document.forms[0].XI_Prog_acc_status_ft.value;
		b = document.forms[0].XI_Prog_acc_status_pt.value;
		fld = 'XI_Prog_acc_ftpt_total';
		msg = 'The total number of accepted students must equal the sum  of all full-time and all part-time accepted students.';		

		tag = document.all ?  document.all.t_XI_Prog_acc_status // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_Prog_acc_status') // NN6
    				   : null; 				
	}	
	else if(flag == 3)
	{	
		total = document.forms[0].XI_Prog_enr_ftpt_total.value;
		a = document.forms[0].XI_Prog_enr_status_ft.value;
		b = document.forms[0].XI_Prog_enr_status_pt.value;
		fld = 'XI_Prog_enr_ftpt_total';
		msg = 'The total number of enrolled students must equal the sum  of all full-time and all part-time enrolled students.';		
		
		tag = document.all ?  document.all.t_XI_Prog_enr_status // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_Prog_enr_status') // NN6
    				   : null; 		
	}		
	


	var ftotal= parseInt(a) + parseInt(b);
	
	if(!isNaN(total) && !isNaN(total))
	{
		if(ftotal != total)
		{
    			tag.className = 'tfvHighlight';
    			tag1.className = 'tfvHighlight';
			tag2.className = 'tfvHighlight';
			
			alert(msg);
			eval('document.forms[0].'+fld+'.focus()');
			
			return false;
		}
    		tag.className = 'tfvNormal';
    		tag1.className = 'tfvNormal';
		tag2.className = 'tfvNormal';		
		
		return true;
	}	
	return false;	
}	

//***********************************************************

function CheckGPAValue()
{
	var GPAArray = new Array();
	var GREArray = new Array();
	var GPATagArray = new Array();
	var GRETagArray = new Array();
	
	GPAArray[0] = 'XI_Prog_app_avg_gpa';
	GPAArray[1] = 'XI_Prog_acc_avg_gpa';
	GPAArray[2] = 'XI_Prog_app_highest_gpa';
	GPAArray[3] = 'XI_Prog_acc_highest_gpa';
	GPAArray[4] = 'XI_Prog_app_lowest_gpa';
	GPAArray[5] = 'XI_Prog_acc_lowest_gpa';
	
	GPATagArray[0] = 't_XI_Prog_avg_gpa';
	GPATagArray[1] = 't_XI_Prog_avg_gpa';
	GPATagArray[2] = 't_XI_Prog_highest_gpa';
	GPATagArray[3] = 't_XI_Prog_highest_gpa';
	GPATagArray[4] = 't_XI_Prog_lowest_gpa';
	GPATagArray[5] = 't_XI_Prog_lowest_gpa';	
	
	GREArray[0] = 'XI_Prog_app_gre_writing_avp';
	GREArray[1] = 'XI_Prog_acc_gre_writing_avp';
	GREArray[2] = 'XI_Prog_app_gre_quant_avp';
	GREArray[3] = 'XI_Prog_acc_gre_quant_avp';
	GREArray[4] = 'XI_Prog_app_gre_verb_avp';
	GREArray[5] = 'XI_Prog_acc_gre_verb_avp';
	
	var i;
	
    				   	
	for (i =0;i<6;i = i+1)
	{
		var gpa = eval('document.forms[0].'+GPAArray[i]+'.value');
		//var ie_tag_id = eval('document.all.'+GPATagArray[i]);
		//var ns_tag_id = eval('document.getElementById('+GPATagArray[i]+')');
		//var tag = document.all ?  ie_tag_id : document.getElementById ?  ns_tag_id  : null; 		
		
		//alert(tag);
		
		var tag = document.all ?  document.all.t_XI_Prog_app_gpa // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_Prog_app_gpa') // NN6
    				   : null; 		
		
		
		if(gpa > 4 || gpa == '')
		{
			alert("GPA value should be between 0 and 4.00");
			tag.className = 'tfvHighlight';
			
			eval('document.forms[0].'+GPAArray[i]+'.focus()');
			return false;
		}	
		tag.className = 'tfvNormal';
	}	
	return true;
}	

//***********************************************************

function CheckStuGPAValue()
{

	var gpa = eval('document.forms[0].XI_enr_gpa.value');
		
	var tag = document.all ?  document.all.t_XI_enr_gpa // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_enr_gpa') // NN6
    				   : null; 		
		
	if(gpa > 4 || gpa == '')
	{
		alert("GPA value should be between 0 and 4.00");
		tag.className = 'tfvHighlight';
		eval('document.forms[0].XI_enr_gpa.focus()');
		return false;
	}	
	
	tag.className = 'tfvNormal';
	return true;
}	

//***********************************************************

function CheckGREApplicationValue(flag)
{
	var gre = parseFloat(eval('document.forms[0].PL_Prog_admisreq_gre_analytic_val.value'));
		
	var tag = document.all ?  document.all.t_PL_Prog_admisreq_gre_analytic_val // IE4+
   				   : document.getElementById ? document.getElementById('t_PL_Prog_admisreq_gre_analytic_val') // NN6
   				   : null; 		
	
	if(gre != false && (gre > 6 || gre < 0))
	{
		alert("Analytical Writing GRE Score should be between 0 and 6");
		tag.className = 'tfvHighlight';
		eval('document.forms[0].PL_Prog_admisreq_gre_analytic_val.focus()');
		return false;
	}	
	
	if(flag == 2)
	{
		gre = parseInt(eval('document.forms[0].PL_Prog_admisreq_gre_verb_val.value'));
		
		tag = document.all ?  document.all.t_PL_Prog_admisreq_gre_verb_val // IE4+
   				   : document.getElementById ? document.getElementById('t_PL_Prog_admisreq_gre_verb_val') // NN6
   				   : null; 		
		
		if(gre != false && (gre > 800 || gre < 200))
		{
			alert("Verbal GRE Score value should be between 200 and 800");
			tag.className = 'tfvHighlight';
			eval('document.forms[0].PL_Prog_admisreq_gre_verb_val.focus()');
			return false;
		}			
	}	
	
	if(flag == 3)
	{
		gre = parseInt(eval('document.forms[0].PL_Prog_admisreq_gre_quant_val.value'));
		
		tag = document.all ?  document.all.t_PL_Prog_admisreq_gre_quant_val // IE4+
   				   : document.getElementById ? document.getElementById('t_PL_Prog_admisreq_gre_quant_val') // NN6
   				   : null; 		
		
		if(gre != false && (gre > 800 || gre < 200))
		{
			alert("Quantitative GRE Score should be between 200 and 800");
			tag.className = 'tfvHighlight';
			eval('document.forms[0].PL_Prog_admisreq_gre_quant_val.focus()');
			return false;
		}			
	}		
	
	tag.className = 'tfvNormal';
	return true;
}	

//***********************************************************

function CheckGPAApplicationValue(flag)
{
	var gpa = parseFloat(eval('document.forms[0].PL_Prog_admisreq_ovelall_gpa_val.value'));
	var tag = document.all ?  document.all.t_PL_Prog_admisreq_criteria // IE4+
   				   : document.getElementById ? document.getElementById('t_PL_Prog_admisreq_criteria') // NN6
   				   : null; 		
   				   
	var tag1= document.all ?  document.all.t_PL_Prog_admisreq_ovelall_gpa_val // IE4+
   				   : document.getElementById ? document.getElementById('t_PL_Prog_admisreq_ovelall_gpa_val') // NN6
   				   : null; 		
   				      				   
	var f_tag = 'PL_Prog_admisreq_ovelall_gpa_val';
	
	msg =  "Overall GPA value should be between 0 and 4";			   	

	if(flag == 2)
	{
		gpa = parseFloat(eval('document.forms[0].PL_Prog_admisreq_gpa_major_val.value'));
		
		tag = document.all ?  document.all.t_PL_Prog_admisreq_gpa_major_val // IE4+
   				   : document.getElementById ? document.getElementById('t_PL_Prog_admisreq_gpa_major_val') // NN6
   				   : null; 	
		f_tag = 'PL_Prog_admisreq_gpa_major_val';  
		msg =  "GPA major value should be between 0 and 4";
	}		
	
	if(gpa != false && (gpa > 4 || gpa < 0))
	{
		alert(msg);
		tag.className = 'tfvHighlight';
		tag1.className = 'tfvHighlight';
		eval('document.forms[0].'+f_tag+'.focus()');
		return false;
	}	
	
	tag.className = 'tfvNormal';
	tag1.className = 'tfvNormal';
	return true;
}	

//***********************************************************

function CheckGREAnalyticValue()
{
	var GREArray = new Array();
	var GRETagArray = new Array();
		       
	GREArray[0] = 'XI_Prog_app_gre_writing_avp';
	GREArray[1] = 'XI_Prog_acc_gre_writing_avp';
	
	var tag = document.all ?  document.all.t_XI_Prog_app_gre_percentile // IE4+
    			   : document.getElementById ? document.getElementById('t_XI_Prog_app_gre_percentile') // NN6
    			   : null; 		
    	
    	tag1 = document.all ?  document.all.t_XI_Prog_gre_writing_avp // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_Prog_gre_writing_avp') // NN6
    				   : null; 		
    	
	for (var i =0;i<2;i = i+1)
	{
		var gre = parseInt(eval('document.forms[0].'+GREArray[i]+'.value'));
	
		if(gre > 6 || gre < 0)
		{
			alert("Analytical Writing: GRE Score should be between 0 and 6");
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			
			eval('document.forms[0].'+GREArray[i]+'.focus()');
			return false;
		}	
	}	
	tag.className = 'tfvNormal';
	tag1.className = 'tfvNormal';	
	return true;	
}	

//***********************************************************

function CheckGREValue(flag)
{
	var GREArray = new Array();
	var GRETagArray = new Array();
	

	var tag = document.all ?  document.all.t_XI_Prog_app_gre_percentile // IE4+
    			   : document.getElementById ? document.getElementById('t_XI_Prog_app_gre_percentile') // NN6
    			   : null; 		
    	
    	var msg;
    				   	
	if (flag == 2)	
	{
		GREArray[0] = 'XI_Prog_app_gre_quant_avp';
		GREArray[1] = 'XI_Prog_acc_gre_quant_avp';
		
		tag1 = document.all ?  document.all.t_XI_Prog_gre_quant_avp // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_Prog_gre_quant_avp') // NN6
    				   : null; 				
    		msg = "Quantitative Reasoning: GRE Score should be between 200 and 800";		   
	}	
	else if (flag == 3)	
	{
		GREArray[0] = 'XI_Prog_app_gre_verb_avp';
		GREArray[1] = 'XI_Prog_acc_gre_verb_avp';

		tag1 = document.all ?  document.all.t_XI_Prog_gre_verb_avp // IE4+
    				   : document.getElementById ? document.getElementById('t_XI_Prog_gre_verb_avp') // NN6
    				   : null; 						
    		msg = "Verbal Reasoning: GRE Score should be between 200 and 800";		   		   
	}	
	
	for (var i =0;i<2;i = i+1)
	{
		var gre = parseInt(eval('document.forms[0].'+GREArray[i]+'.value'));
	
		if(gre > 800 || (gre < 200 && gre != 0))
		{
			alert(msg);
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			
			eval('document.forms[0].'+GREArray[i]+'.focus()');
			return false;
		}	
	}	
	
	tag.className = 'tfvNormal';
	tag1.className = 'tfvNormal';	
	return true;
}	

//***********************************************************

function CheckStuGREValue(flag)
{
	var tag = document.all ?  document.all.t_gre // IE4+
   				   : document.getElementById ? document.getElementById('t_gre') // NN6
    				   : null; 			
    	
	var tag1;
	var ftag;
    	var str;
    	var msg;
    				   	
	if(flag == 1)
	{
		ftag = 'XI_enr_gre_writing';
		tag1 = document.all ?  document.all.t_XI_enr_gre_writing // IE4+
   				   : document.getElementById ? document.getElementById('t_XI_enr_gre_writing') // NN6
    				   : null; 				    				   
    		str  = 'Analytical Writing';
    		msg  = "0 and 6";
    		
	}	
	else if(flag == 2)
	{
		ftag = 'XI_enr_gre_quant';
		tag1 = document.all ?  document.all.t_XI_enr_gre_quant // IE4+
   				   : document.getElementById ? document.getElementById('t_XI_enr_gre_quant') // NN6
    				   : null; 				 		
		str  = 'Quantitative Reasoning';
		msg  = "200 and 800";
	}	
	else if(flag == 3)
	{
		ftag = 'XI_enr_gre_verb';
		tag1 = document.all ?  document.all.t_XI_enr_gre_verb // IE4+
   				   : document.getElementById ? document.getElementById('t_XI_enr_gre_verb') // NN6
    				   : null; 	
    		str  = 'Verbal Reasoning';		   			 		
    		msg  = "200 and 800";
	}		
	
	var gre = eval('document.forms[0].'+ftag+'.value');	
	
	if(flag == 1)
	{
		gre = parseFloat(gre);
		
		if(gre > 6 && gre != false)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert('Only scores between 0 and 6.0 are allowed in this field. Please leave the field blank if the only score available for this student is between 200 and 800.');		
			eval('document.forms[0].'+ftag+'.focus()');
			return false;
		}	
	}	
	else
	{	
		gre = parseInt(gre);
		if(gre > 800 || gre == '' || (gre < 200 && gre != 0))
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert('GRE Score for '+str+' should be between '+msg);		
			eval('document.forms[0].'+ftag+'.focus()');
			return false;
		}
	}	
	tag.className = 'tfvNormal';
	tag1.className = 'tfvNormal';
	return true;
}
	
//***********************************************************

function CheckLocationTotal()
{
	var a = eval('document.forms[0].XR_Clinical_Loc_OnSIte.value');
	var b = eval('document.forms[0].XR_Clinical_Loc_OffSite.value');
	var c = eval('document.forms[0].XR_Clinical_Loc_Indep_OffSIte.value');
	var d = eval('document.forms[0].XR_Clinical_Loc_ClinicLab.value');
	
	a = parseInt(a)? parseInt(a) : 0;
	b = parseInt(b)? parseInt(b) : 0;
	c = parseInt(c)? parseInt(c) : 0;
	d = parseInt(d)? parseInt(d) : 0;
	
	var ftotal= a + b + c + d;

	tag = document.all ?  document.all.t_XR_Clinical_Location // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Clinical_Location') // NN6
    		   	: null; 
    	
    	var f_tag = eval('document.forms[0].XR_Clinical_Loc_OnSIte');
    	
    	var total = 100;
    	
	if(!isNaN(ftotal))
	{
		if(ftotal != 100)
		{
			tag.className = 'tfvHighlight';
			alert('The total should add up to 100%');
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		return true;
	}	
	return false;		
}	

//***********************************************************

function CheckETPercent()
{
	var tag = document.all ?  document.all.t_XR_ET_Literate_Staff // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_ET_Literate_Staff') // NN6
    		   	: null; 	
    		   		
	if(!CheckValue('XR_ET_Literate_Staff',0,100,'Percentage value should be between 0 and 100.'))
	{

    		tag.className = 'tfvHighlight';   	
    		return false;	
	}	
	tag.className = 'tfvNormal';   		
	return true;
}	

//***********************************************************

function CheckValue(obj, val1, val2, msg)
{
	var a 	= eval('document.forms[0].'+obj+'.value');
	    		   		
	if(!isNaN(a) && (a < parseInt(val1) || a > parseInt(val2)))
	{ 
		alert(msg);
		eval('document.forms[0].'+obj+'.focus()');
		return false;
	}	
	return true;
}

//***********************************************************

function ValidateFTE(obj,flag)
{
	var a 	= eval('document.forms[0].'+obj+'.value');
	
	var val1 = '0.00';
	var val2 = '1.00';
	var tag;
	var msg;
	 
	if(flag == 1)
	{
		tag = document.all ?  document.all.t_XI_fac_fte_assigned // IE4+
    		   	: document.getElementById ? document.getElementById('t_XI_fac_fte_assigned') // NN6
    		   	: null; 
    		
    	}
	else
	{	   	
		tag = document.all ?  document.all.t_XI_fac_fte_inception // IE4+
    		   	: document.getElementById ? document.getElementById('t_XI_fac_fte_inception') // NN6
    		   	: null; 
    		   	
    	}	   	
    		   		
	
	if(!isNaN(parseFloat(a)) && (parseFloat(a) < parseFloat(val1) || parseFloat(a) > parseFloat(val2)))
	{ 
		tag.className = 'tfvHighlight';
		alert('FTEs should contain two decimal positions and should be between 0.00 and 1.00');
    		eval('document.forms[0].'+obj+'.focus()');
		return false;
	}	
		
	tag.className = 'tfvNormal';
	return true;
}

//***********************************************************


function ValidateStaffFTE(obj,flag)
{
	var a 	= eval('document.forms[0].'+obj+'.value');
	
	var val1 = '00.00';
	var val2 = '99.99';
	var tag;
	var msg;
	 
	if(flag == 1)
	{
		tag = document.all ?  document.all.t_XR_Staff_Clerical_ft // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Clerical_ft') // NN6
    		   	: null; 
    		
    	}
	else if(flag == 2)
	{	   	
		tag = document.all ?  document.all.t_XR_Staff_Clerical_pt // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Clerical_pt') // NN6
    		   	: null; 
    		   	
    	}	   	
    	
	else if(flag == 3)
	{	   	
		tag = document.all ?  document.all.t_XR_Staff_Administrative_ft // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Administrative_ft') // NN6
    		   	: null; 
    		   	
    	}	   	
    	
	else if(flag == 4)
	{	   	
		tag = document.all ?  document.all.t_XR_Staff_Administrative_pt // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Administrative_pt') // NN6
    		   	: null; 
    		   	
    	}	   	
    	
	else if(flag == 5)
	{	   	
		tag = document.all ?  document.all.t_XR_Staff_Technical_ft // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Technical_ft') // NN6
    		   	: null; 
    		   	
    	}	   	
    	
	else if(flag == 6)
	{	   	
		tag = document.all ?  document.all.t_XR_Staff_Technical_pt // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Technical_pt') // NN6
    		   	: null; 
    		   	
    	}	   	

	else if(flag == 7)
	{	   	
		tag = document.all ?  document.all.t_XR_Staff_Computer_ft // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Computer_ft') // NN6
    		   	: null; 
    		   	
    	}	   	
    	
	else if(flag == 8)
	{	   	
		tag = document.all ?  document.all.t_XR_Staff_Computer_pt // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_Staff_Computer_pt') // NN6
    		   	: null; 
    		   	
    	}	   	    	    	    	    	    	    	
    		   		
	if(!isNaN(parseFloat(a)) && (parseFloat(a) < parseFloat(val1) || parseFloat(a) > parseFloat(val2)))
	{ 
		tag.className = 'tfvHighlight';
		alert('FTEs should contain two decimal positions and should be between 0.00 and 100.00');
    		eval('document.forms[0].'+obj+'.focus()');
		return false;
	}	
		
	tag.className = 'tfvNormal';
	return true;
}

//***********************************************************

function CheckBudgetTotal(flag)
{
	var a = document.forms[0].XR_Budget_Total_Budget.value;
	
	var b = document.forms[0].XR_Budget_FacSalary_ft_Budget.value;
	var c = document.forms[0].XR_Budget_FacBenefits_ft_Budget.value;
	var d = document.forms[0].XR_Budget_FacSalary_pt_Budget.value;
	var e = document.forms[0].XR_Budget_FacBenefit_pt_Budget.value;
	var f = document.forms[0].XR_Budget_StaffSalary_Budget.value;
	var g = document.forms[0].XR_Budget_StaffBenefit_Budget.value;
	var h = document.forms[0].XR_Budget_FacEducation_Budget.value;
	var i = document.forms[0].XR_Budget_ClericalSupply_Budget.value;
	var j = document.forms[0].XR_Budget_ClassroomSupply_Budget.value;
	var k = document.forms[0].XR_Budget_ClinicalSupply_Budget.value;
	var l = document.forms[0].XR_Budget_EquipmentPurchase_Budget.value;				
	var m = document.forms[0].XR_Budget_PrecpSalary_Budget.value;
	var n = document.forms[0].XR_Budget_Other_Budget.value;	


	var msg  = 'The total budgeted amount must equal the sum of all budgeted amount for all categories.';

	var tag = document.all ?  document.all.t_XR_Budget // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_Budget') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.t_Budgeted // IE4+
    		   : document.getElementById ? document.getElementById('t_Budgeted') // NN6
    		   : null; 
    		       				   	
	var f_tag = document.forms[0].XR_Budget_Total_Budget;
	
	if(flag == 2)
	{	
		a = document.forms[0].XR_Budget_Total_Expense.value;
		
		b = document.forms[0].XR_Budget_FacSalary_ft_Expense.value;
		c = document.forms[0].XR_Budget_FacBenefits_ft_Expense.value;
		d = document.forms[0].XR_Budget_FacSalary_pt_Expense.value;
		e = document.forms[0].XR_Budget_FacBenefit_pt_Expense.value;
		f = document.forms[0].XR_Budget_StaffSalary_Expense.value;
		g = document.forms[0].XR_Budget_StaffBenefit_Expense.value;
		h = document.forms[0].XR_Budget_FacEducation_Expense.value;
		i = document.forms[0].XR_Budget_ClericalSupply_Expense.value;
		j = document.forms[0].XR_Budget_ClassroomSupply_Expense.value;
		k = document.forms[0].XR_Budget_ClinicalSupply_Expense.value;
		l = document.forms[0].XR_Budget_EquipmentPurchase_Expense.value;				
		m = document.forms[0].XR_Budget_PrecpSalary_Expense.value;
		n = document.forms[0].XR_Budget_Other_Expense.value;	

		msg  = 'The total expenditure amount must equal the sum of all expenditures for all categories.';
		
		tag1 = document.all ?  document.all.t_Expended // IE4+
    		   : document.getElementById ? document.getElementById('t_Expended') // NN6
    		   : null; 
    		   
    		f_tag = document.forms[0].XR_Budget_Total_Expense;
	}	
	
	a = parseInt(a) ? parseInt(a) : 0;
	b = parseInt(b) ? parseInt(b) : 0;
	c = parseInt(c) ? parseInt(c) : 0;
	d = parseInt(d) ? parseInt(d) : 0;
	e = parseInt(e) ? parseInt(e) : 0;
	f = parseInt(f) ? parseInt(f) : 0;
	g = parseInt(g) ? parseInt(g) : 0;
	h = parseInt(h) ? parseInt(h) : 0;
	i = parseInt(i) ? parseInt(i) : 0;
	j = parseInt(j) ? parseInt(j) : 0;
	k = parseInt(k) ? parseInt(k) : 0;
	l = parseInt(l) ? parseInt(l) : 0;
	m = parseInt(m) ? parseInt(m) : 0;
	n = parseInt(n) ? parseInt(n) : 0;
	
	var total= parseInt(b) + parseInt(c) + parseInt(d) + parseInt(e) + parseInt(f) + parseInt(g) + parseInt(h) + parseInt(i) + parseInt(j) + parseInt(k) + parseInt(l) + parseInt(m) + parseInt(n);
	
	if(!isNaN(a) && !isNaN(total))
	{
		if(a != total)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;
	}	
	return false;	
}		

//***********************************************************

function CheckCapBudgetTotal(flag)
{
	var a = document.forms[0].XR_Cap_Budget_Total_Budget.value;
	
	var b = document.forms[0].XR_Cap_Budget_Equipment_Budget.value;
	var c = document.forms[0].XR_Cap_Budget_Renovation_Budget.value;
	var d = document.forms[0].XR_Cap_Budget_Other_Budget.value;
	

	var msg  = 'The total budgeted amount must equal the sum of all budgeted amount for all categories.';

	var tag = document.all ?  document.all.t_XR_Cap_Budget // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_Cap_Budget') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.t_cap_Budget // IE4+
    		   : document.getElementById ? document.getElementById('t_cap_Budget') // NN6
    		   : null; 
    		       				   	
	var f_tag = document.forms[0].XR_Cap_Budget_Total_Budget;
	
	if(flag == 2)
	{	
		a = document.forms[0].XR_Cap_Budget_Total_Expense.value;
		
		b = document.forms[0].XR_Cap_Budget_Equipment_Expense.value;
		c = document.forms[0].XR_Cap_Budget_Renovation_Expense.value;
		d = document.forms[0].XR_Cap_Budget_Other_Expense.value;
		
		msg  = 'The total expenditure amount must equal the sum of all expenditures for all categories.';
		
		tag1 = document.all ?  document.all.t_cap_Expense // IE4+
    		   : document.getElementById ? document.getElementById('t_cap_Expense') // NN6
    		   : null; 
    		   
    		f_tag = document.forms[0].XR_Cap_Budget_Total_Expense;
	}	

	a = parseInt(a) ? parseInt(a) : 0;
	b = parseInt(b) ? parseInt(b) : 0;
	c = parseInt(c) ? parseInt(c) : 0;
	d = parseInt(d) ? parseInt(d) : 0;
		
	var total= parseInt(b) + parseInt(c) + parseInt(d);
	
	if(!isNaN(a) && !isNaN(total))
	{
		if(a != total)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;
	}	
	return false;	
}

//***********************************************************

function CheckTuitionFee(ftype, flag)
{
	var a;
	var b;
	var c;		
	
	
	var msg;
	var tag;
	var tag1;
	var tag2;	
	
	var f_tag;
	

	tag = document.all ?  document.all.t_XR_Stu_Fee // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_Stu_Fee') // NN6
    		   : null; 

	tag1 = document.all ?  document.all.t_XR_Stu_Fee_Total_InState // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_Stu_Fee_Total_InState') // NN6
    		   : null; 
    	
    	
    	msg = "Total sum of in-state tuition and fees must match with the In-State Total specified";
    		   		
	if(ftype == 2)
	{
		tag = document.all ?  document.all.t_XR_Stu_Fee_OutState // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_Stu_Fee_OutState') // NN6
    		   : null; 

		tag1 = document.all ?  document.all.t_XR_Stu_Fee_Total_OutState // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_Stu_Fee_Total_OutState') // NN6
    		   : null; 
    	
	    	f_tag = document.forms[0].t_XR_Stu_Fee_Total_OutState_Year1;		
	    	
	    	msg = "Total sum of  Out-of-State tuition and fees must match with the Out-State Total specified";
	}	

	
	if(flag == 1)
	{
		a = document.forms[0].XR_Stu_Fee_Total_InState_Year1.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_InState_Year1.value;
		c = document.forms[0].XR_Stu_Fee_Fee_InState_Year1.value;
			
		tag2 = document.all ?  document.all.t_in_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_in_year1') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_InState_Year1;   
    		
    		msg = "Total sum of Year1: In-State tuition and fees must match with the Year 1: In-State Total specified";
		
	}
	else if(flag == 2)
	{	
		a = document.forms[0].XR_Stu_Fee_Total_InState_Year2.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_InState_Year2.value;
		c = document.forms[0].XR_Stu_Fee_Fee_InState_Year2.value;

		tag2 = document.all ?  document.all.t_in_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_in_year2') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_InState_Year2;      
    		msg = "Total sum of Year2: In-State tuition and fees must match with the Year 2: In-State Total specified";
	}	
	
	else if(flag == 3)
	{	
		a = document.forms[0].XR_Stu_Fee_Total_InState_Year3.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_InState_Year3.value;
		c = document.forms[0].XR_Stu_Fee_Fee_InState_Year3.value;

		tag2 = document.all ?  document.all.t_in_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_in_year3') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_InState_Year3;      
    		msg = "Total sum of Year3: In-State tuition and fees must match with the Year 3: In-State Total specified";
	}		


	else if(flag == 4)
	{	
		a = document.forms[0].XR_Stu_Fee_Total_InState_Year4.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_InState_Year4.value;
		c = document.forms[0].XR_Stu_Fee_Fee_InState_Year4.value;

		tag2 = document.all ?  document.all.t_in_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_in_year4') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_InState_Year4;      
    		msg = "Total sum of Year4: In-State tuition and fees must match with the Year 4: In-State Total specified";
	}		
	
	else if(flag == 5)
	{	
		a = document.forms[0].XR_Stu_Fee_Total_OutState_Year1.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_OutState_Year1.value;
		c = document.forms[0].XR_Stu_Fee_Fee_OutState_Year1.value;

		tag2 = document.all ?  document.all.t_out_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_out_year1') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_OutState_Year1;      
    		msg = "Total sum of Year1:  Out-of-State tuition and fees must match with the Year 1: Out-of-State Total specified";
	}			
	
	else if(flag == 6)
	{	
		a = document.forms[0].XR_Stu_Fee_Total_OutState_Year2.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_OutState_Year2.value;
		c = document.forms[0].XR_Stu_Fee_Fee_OutState_Year2.value;

		tag2 = document.all ?  document.all.t_out_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_out_year2') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_OutState_Year2;      
    		msg = "Total sum of Year2:  Out-of-State tuition and fees must match with the Year 2: Out-of-State Total specified";
	}			
	
	else if(flag == 7)
	{	
		a = document.forms[0].XR_Stu_Fee_Total_OutState_Year3.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_OutState_Year3.value;
		c = document.forms[0].XR_Stu_Fee_Fee_OutState_Year3.value;

		tag2 = document.all ?  document.all.t_out_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_out_year3') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_OutState_Year3;      
    		msg = "Total sum of Year3:  Out-of-State tuition and fees must match with the Year 3: Out-of-State Total specified";
	}			
	
	else if(flag == 8)
	{	
		a = document.forms[0].XR_Stu_Fee_Total_OutState_Year4.value;
	
		b = document.forms[0].XR_Stu_Fee_Tution_OutState_Year4.value;
		c = document.forms[0].XR_Stu_Fee_Fee_OutState_Year4.value;

		tag2 = document.all ?  document.all.t_out_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_out_year4') // NN6
    		   : null; 
    		
    		f_tag = document.forms[0].XR_Stu_Fee_Total_OutState_Year4;      
    		msg = "Total sum of Year4:  Out-of-State tuition and fees must match with the Year 4: Out-of-State Total specified";
	}			

	a = parseInt(a) ? parseInt(a) : 0;
	b = parseInt(b) ? parseInt(b) : 0;
	c = parseInt(c) ? parseInt(c) : 0;
	
	
	var total= parseInt(b) + parseInt(c);
	
	if(!isNaN(a) && !isNaN(total))
	{
		if(a != total)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			tag2.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		tag2.className = 'tfvNormal';
		return true;
	}	
	return false;	
}

//***********************************************************

function MatchAgeValue(flag)
{
	var a = document.forms[0].XI_Prog_app_ftpt_total.value;
	
	var b = document.forms[0].XI_Prog_app_age_lessthan_20.value;
	var c = document.forms[0].XI_Prog_app_age_20_24.value;
	var d = document.forms[0].XI_Prog_app_age_25_29.value;
	var e = document.forms[0].XI_Prog_app_age_30_34.value;
	var f = document.forms[0].XI_Prog_app_age_35_39.value;
	var g = document.forms[0].XI_Prog_app_age_morethan_39.value;
	var h = document.forms[0].XI_Prog_app_age_unknown.value;


	var msg  = 'The total number of applicants of all the age groups must equal the sum  of all full-time and all part-time applicants.';

	var tag = document.all ?  document.all.t_XI_Prog_age_groups // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_Prog_age_groups') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.t_age_app_total // IE4+
    		   : document.getElementById ? document.getElementById('t_age_app_total') // NN6
    		   : null; 
    		       				   	
	var f_tag = document.forms[0].XI_Prog_app_age_lessthan_20;
	
	if(flag == 2)
	{
		a = document.forms[0].XI_Prog_acc_ftpt_total.value;

		b = document.forms[0].XI_Prog_acc_age_lessthan_20.value;
		c = document.forms[0].XI_Prog_acc_age_20_24.value;
		d = document.forms[0].XI_Prog_acc_age_25_29.value;
		e = document.forms[0].XI_Prog_acc_age_30_34.value;
		f = document.forms[0].XI_Prog_acc_age_35_39.value;
		g = document.forms[0].XI_Prog_acc_age_morethan_39.value;
		h = document.forms[0].XI_Prog_acc_age_unknown.value;		
		msg = 'The total number of accepted students of all the age groups must equal the sum  of all full-time and all part-time accepted students.';		
		
		tag1 = document.all ?  document.all.t_age_acc_total // IE4+
    		   : document.getElementById ? document.getElementById('t_age_acc_total') // NN6
    		   : null; 
    		   
    		f_tag = document.forms[0].XI_Prog_acc_age_lessthan_20;   		
	}	

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;
	e	= parseInt(e) ? parseInt(e) : 0;
	f	= parseInt(f) ? parseInt(f) : 0;
	g	= parseInt(g) ? parseInt(g) : 0;
	h	= parseInt(h) ? parseInt(h) : 0;
		
	var total= parseInt(b) + parseInt(c) + parseInt(d) + parseInt(e) + parseInt(f) + parseInt(g) + parseInt(h);
	
	if(!isNaN(a) && !isNaN(total))
	{
		if(a != total)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;
	}	
	return false;	
}	

//***********************************************************

function MatchGenderValue(obj, obj1, obj2, obj3, msg)
{
	var total = parseInt(eval('document.forms[0].'+obj+'.value'));
	var 	a = parseInt(eval('document.forms[0].'+obj1+'.value'));
	var 	b = parseInt(eval('document.forms[0].'+obj2+'.value'));
	var 	c = parseInt(eval('document.forms[0].'+obj3+'.value'));

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	
	var ftotal= a + b + c;
	
	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			alert('Total # of males + females + unknown must equal total # '+msg+', above.');
			return false;
		}
	}	
	return true;	
}	

//***********************************************************

function MatchEthnicGenderValue(flag)
{
	var total = parseInt(document.forms[0].XI_Prog_app_ftpt_total.value);
	
	var 	a = parseInt(document.forms[0].XI_Prog_app_race_m_ca.value);
	var 	b = parseInt(document.forms[0].XI_Prog_app_race_f_ca.value);
	var 	c = parseInt(document.forms[0].XI_Prog_app_race_uk_ca.value);

	var 	d = parseInt(document.forms[0].XI_Prog_app_race_m_aa.value);
	var 	e = parseInt(document.forms[0].XI_Prog_app_race_f_aa.value);
	var 	f = parseInt(document.forms[0].XI_Prog_app_race_uk_aa.value);
	
	var 	g = parseInt(document.forms[0].XI_Prog_app_race_m_hi.value);
	var 	h = parseInt(document.forms[0].XI_Prog_app_race_f_hi.value);
	var 	i = parseInt(document.forms[0].XI_Prog_app_race_uk_hi.value);	
	
	var 	j = parseInt(document.forms[0].XI_Prog_app_race_m_ap.value);
	var 	k = parseInt(document.forms[0].XI_Prog_app_race_f_ap.value);
	var 	l = parseInt(document.forms[0].XI_Prog_app_race_uk_ap.value);		
	
	var 	m = parseInt(document.forms[0].XI_Prog_app_race_m_aena.value);
	var 	n = parseInt(document.forms[0].XI_Prog_app_race_f_aena.value);
	var 	o = parseInt(document.forms[0].XI_Prog_app_race_uk_aena.value);	
	
	var 	p = parseInt(document.forms[0].XI_Prog_app_race_m_other.value);
	var 	q = parseInt(document.forms[0].XI_Prog_app_race_f_other.value);
	var 	r = parseInt(document.forms[0].XI_Prog_app_race_uk_other.value);	
	
	var 	s = parseInt(document.forms[0].XI_Prog_app_race_m_uk.value);
	var 	t = parseInt(document.forms[0].XI_Prog_app_race_f_uk.value);
	var 	u = parseInt(document.forms[0].XI_Prog_app_race_uk_uk.value);		


	var msg  = 'The total number of applicants by race/ethnicity and by gender must equal the sum  of all full-time and all part-time applicants.';
	
	var tag = document.all ?  document.all.t_XI_Prog_race_ethncity // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_Prog_race_ethncity') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.t_race_app_total // IE4+
    		   : document.getElementById ? document.getElementById('t_race_app_total') // NN6
    		   : null; 
    		       				   	
	var f_tag = document.forms[0].XI_Prog_app_race_m_ca;	
	
	if(flag == 2)
	{

		 total = parseInt(document.forms[0].XI_Prog_acc_ftpt_total.value);
		
		 a = parseInt(document.forms[0].XI_Prog_acc_race_m_ca.value);
		 b = parseInt(document.forms[0].XI_Prog_acc_race_f_ca.value);
		 c = parseInt(document.forms[0].XI_Prog_acc_race_uk_ca.value);
        	                                         
		 d = parseInt(document.forms[0].XI_Prog_acc_race_m_aa.value);
		 e = parseInt(document.forms[0].XI_Prog_acc_race_f_aa.value);
		 f = parseInt(document.forms[0].XI_Prog_acc_race_uk_aa.value);
		                                         
		 g = parseInt(document.forms[0].XI_Prog_acc_race_m_hi.value);
		 h = parseInt(document.forms[0].XI_Prog_acc_race_f_hi.value);
		 i = parseInt(document.forms[0].XI_Prog_acc_race_uk_hi.value);	
		                                         
		 j = parseInt(document.forms[0].XI_Prog_acc_race_m_ap.value);
		 k = parseInt(document.forms[0].XI_Prog_acc_race_f_ap.value);
		 l = parseInt(document.forms[0].XI_Prog_acc_race_uk_ap.value);		
		                                         
		 m = parseInt(document.forms[0].XI_Prog_acc_race_m_aena.value);
		 n = parseInt(document.forms[0].XI_Prog_acc_race_f_aena.value);
		 o = parseInt(document.forms[0].XI_Prog_acc_race_uk_aena.value);	
		                                         
		 p = parseInt(document.forms[0].XI_Prog_acc_race_m_other.value);
		 q = parseInt(document.forms[0].XI_Prog_acc_race_f_other.value);
		 r = parseInt(document.forms[0].XI_Prog_acc_race_uk_other.value);	
		                                         
		 s = parseInt(document.forms[0].XI_Prog_acc_race_m_uk.value);
		 t = parseInt(document.forms[0].XI_Prog_acc_race_f_uk.value);
		 u = parseInt(document.forms[0].XI_Prog_acc_race_uk_uk.value);
			
		msg = 'The total number of accepted students by race/ethnicity and by gender must equal the sum  of all full-time and all part-time accepted students.';		
		
		tag1 = document.all ?  document.all.t_race_acc_total // IE4+
    		   : document.getElementById ? document.getElementById('t_race_acc_total') // NN6
    		   : null; 
    		       				   	
		f_tag = document.forms[0].XI_Prog_acc_race_m_ca;		
	}	

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;
	e	= parseInt(e) ? parseInt(e) : 0;
	f	= parseInt(f) ? parseInt(f) : 0;
	g	= parseInt(g) ? parseInt(g) : 0;
	h	= parseInt(h) ? parseInt(h) : 0;
	i	= parseInt(i) ? parseInt(i) : 0;
	j	= parseInt(j) ? parseInt(j) : 0;
	k	= parseInt(k) ? parseInt(k) : 0;
	l	= parseInt(l) ? parseInt(l) : 0;
	m	= parseInt(m) ? parseInt(m) : 0;
	n	= parseInt(n) ? parseInt(n) : 0;
	o	= parseInt(o) ? parseInt(o) : 0;
	p	= parseInt(p) ? parseInt(p) : 0;
	q	= parseInt(q) ? parseInt(q) : 0;
	r	= parseInt(r) ? parseInt(r) : 0;
	s	= parseInt(s) ? parseInt(s) : 0;
	t	= parseInt(t) ? parseInt(t) : 0;	
	u	= parseInt(u) ? parseInt(u) : 0;
		
	var ftotal= a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u;
	
	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;		
	}	
	return false;
}	

//***********************************************************

function MatchStateValue(flag)
{
	var total = parseInt(document.forms[0].XI_Prog_app_ftpt_total.value)
	
	var 	a = parseInt(document.forms[0].XI_Prog_app_residence_progstate.value);
	var 	b = parseInt(document.forms[0].XI_Prog_app_residence_otherstate.value);
	var 	c = parseInt(document.forms[0].XI_Prog_app_residence_canada.value);
	var 	d = parseInt(document.forms[0].XI_Prog_app_residence_other.value);
	

	var tag = document.all ?  document.all.t_XI_Prog_residence // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_Prog_residence') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.t_state_app_total // IE4+
    		   : document.getElementById ? document.getElementById('t_state_app_total') // NN6
    		   : null; 
    		       				   	
	var f_tag = document.forms[0].XI_Prog_app_residence_progstate;	
	
	var msg  = 'The total number of applicants from your program state, other US states, Canada and Other must equal the sum  of all full-time and all part-time applicants.';
	
	if(flag == 2)
	{
		total = parseInt(document.forms[0].XI_Prog_acc_ftpt_total.value)
		a = parseInt(document.forms[0].XI_Prog_acc_residence_progstate.value);
	 	b = parseInt(document.forms[0].XI_Prog_acc_residence_otherstate.value);
	 	c = parseInt(document.forms[0].XI_Prog_acc_residence_canada.value);
	 	d = parseInt(document.forms[0].XI_Prog_acc_residence_other.value);		
		msg = 'The total number of accepted students from your program state, other US states, Canada and Other must equal the sum  of all full-time and all part-time accepted students.';		
		
		var tag1 = document.all ?  document.all.t_state_acc_total // IE4+
    		   : document.getElementById ? document.getElementById('t_state_acc_total') // NN6
    		   : null; 
    		       				   	
		var f_tag = document.forms[0].XI_Prog_acc_residence_progstate;			
	}	

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;		

	var ftotal= a + b + c + d;
	
	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;		
	}	
	return false;
}	

//***********************************************************

function MatchBackGroundValue(flag)
{
	var total = parseInt(document.forms[0].XI_Prog_app_ftpt_total.value);
	var 	a = parseInt(document.forms[0].XI_Prog_app_back_newtoprog.value);
	var 	b = parseInt(document.forms[0].XI_Prog_app_back_prog_rel_ug.value);
	var 	c = parseInt(document.forms[0].XI_Prog_app_back_nonprog_rel_ug.value);
	var 	d = parseInt(document.forms[0].XI_Prog_app_back_progmasters.value);
	var 	e = parseInt(document.forms[0].XI_Prog_app_back_othermasters.value);
	var 	f = parseInt(document.forms[0].XI_Prog_app_back_profdegree.value);
	var 	g = parseInt(document.forms[0].XI_Prog_app_back_other_unknown.value);	


	var tag = document.all ?  document.all.t_XI_Prog_app_back // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_Prog_app_back') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.t_state_app_total // IE4+
    		   : document.getElementById ? document.getElementById('t_back_app_total') // NN6
    		   : null; 
    		       				   	
	var f_tag = document.forms[0].XI_Prog_app_back_newtoprog;	
		
	var msg  = 'The total number of applicants with previous educational backgrounds must equal the sum  of all full-time and all part-time applicants.';
	
	if(flag == 2)
	{
		total = parseInt(document.forms[0].XI_Prog_acc_ftpt_total.value);
		a = parseInt(document.forms[0].XI_Prog_acc_back_newtoprog.value);
		b = parseInt(document.forms[0].XI_Prog_acc_back_prog_rel_ug.value);
		c = parseInt(document.forms[0].XI_Prog_acc_back_nonprog_rel_ug.value);
		d = parseInt(document.forms[0].XI_Prog_acc_back_progmasters.value);
		e = parseInt(document.forms[0].XI_Prog_acc_back_othermasters.value);
		f = parseInt(document.forms[0].XI_Prog_acc_back_profdegree.value);
		g = parseInt(document.forms[0].XI_Prog_acc_back_other_unknown.value);			

		tag1 = document.all ?  document.all.t_state_acc_total // IE4+
    		   : document.getElementById ? document.getElementById('t_back_acc_total') // NN6
    		   : null; 
    		       				   	
		f_tag = document.forms[0].XI_Prog_acc_back_newtoprog;	
			
		msg = 'The total number of accepted students with previous educational backgrounds must equal the sum  of all full-time and all part-time accepted students.';		
	}	

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;
	e	= parseInt(e) ? parseInt(e) : 0;
	f	= parseInt(f) ? parseInt(f) : 0;
	g	= parseInt(g) ? parseInt(g) : 0;
			
	var ftotal= a + b + c + d + e + f + g;
	
	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;		
	}	
	return false;
}	

//***********************************************************


function MatchUGInstitutionValue(obj, obj1, obj2, obj3, obj4, obj5, msg)
{
	var total = parseInt(eval('document.forms[0].'+obj+'.value'));
	var 	a = parseInt(eval('document.forms[0].'+obj1+'.value'));
	var 	b = parseInt(eval('document.forms[0].'+obj2+'.value'));
	var 	c = parseInt(eval('document.forms[0].'+obj3+'.value'));
	var 	d = parseInt(eval('document.forms[0].'+obj4+'.value'));
	var 	e = parseInt(eval('document.forms[0].'+obj5+'.value'));

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;
	e	= parseInt(e) ? parseInt(e) : 0;
		
	var ftotal= a + b + c + d + e;
	
	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total > ftotal)
		{
			alert('Total undergraduates attending own institution must be < or = to total undergraduates in question 10, above, for '+msg);
			return false;
		}
	}	
	return true;	
}	

//***********************************************************

function MatchInstitutionValue(obj, obj1, obj2, obj3, obj4, obj5, msg)
{
	var total = parseInt(eval('document.forms[0].'+obj+'.value'));
	var 	a = parseInt(eval('document.forms[0].'+obj1+'.value'));
	var 	b = parseInt(eval('document.forms[0].'+obj2+'.value'));
	var 	c = parseInt(eval('document.forms[0].'+obj3+'.value'));
	var 	d = parseInt(eval('document.forms[0].'+obj4+'.value'));
	var 	e = parseInt(eval('document.forms[0].'+obj5+'.value'));

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;
	e	= parseInt(e) ? parseInt(e) : 0;
		
	var ftotal= a + b + c + d + e;
	
	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total > ftotal)
		{
			alert('Total '+msg+' with prior audiology degree attending own institution must be < or = to total prior audiologists in question 10, above');
			return false;
		}
	}	
	return true;	
}	

//***********************************************************

function MatchRecruitmentValue(obj, obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, msg)
{
	var total = parseInt(eval('document.forms[0].'+obj+'.value'));
	var 	a = parseInt(eval('document.forms[0].'+obj1+'.value'));
	var 	b = parseInt(eval('document.forms[0].'+obj2+'.value'));
	var 	c = parseInt(eval('document.forms[0].'+obj3+'.value'));
	var 	d = parseInt(eval('document.forms[0].'+obj4+'.value'));
	var 	e = parseInt(eval('document.forms[0].'+obj5+'.value'));
	var 	f = parseInt(eval('document.forms[0].'+obj6+'.value'));
	var 	g = parseInt(eval('document.forms[0].'+obj7+'.value'));
	var 	h = parseInt(eval('document.forms[0].'+obj8+'.value'));

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;
	e	= parseInt(e) ? parseInt(e) : 0;
	f	= parseInt(f) ? parseInt(f) : 0;
	g	= parseInt(g) ? parseInt(g) : 0;
	h	= parseInt(h) ? parseInt(h) : 0;
		
	var ftotal= a + b + c + d + e + f + g + h;
	
	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			alert('Total frequency of '+msg+' prior contact must equal total # '+msg+', above.');
			return false;
		}
	}	
	return true;	
}	

//***********************************************************

function setEnrollmentStatus(flag)
{
	var app_ft;
	var app_pt;
	var acc_ft;
	var acc_pt;
	var enr_ft;
	var enr_pt;
	var app_total;
	var acc_total;

	var total;
	
	if(flag == 1)
	{
		app_ft = document.forms[0].XI_Prog_app_status_ft.value;
		app_pt = document.forms[0].XI_Prog_app_status_pt.value;
		app_total = document.forms[0].XI_Prog_app_ftpt_total.value;
		
		total = parseInt(app_ft) + parseInt(app_pt);
		
		document.forms[0].XI_Prog_app_age_total.value = app_total;
		document.forms[0].app_back_total.value = app_total;
		document.forms[0].app_race_total.value = app_total;
		document.forms[0].app_residence_total.value = app_total;
		document.forms[0].app_back_total.value = app_total;
		
	}
	else if(flag == 2)
	{	
		acc_ft = document.forms[0].XI_Prog_acc_status_ft.value;
		acc_pt = document.forms[0].XI_Prog_acc_status_pt.value;	
		acc_total = document.forms[0].XI_Prog_acc_ftpt_total.value;
		
		document.forms[0].XI_Prog_acc_age_total.value = acc_total;
		document.forms[0].acc_back_total.value = acc_total;
		document.forms[0].acc_race_total.value = acc_total;
		document.forms[0].acc_residence_total.value = acc_total;
		document.forms[0].acc_back_total.value = acc_total;
	}	
}

//***********************************************************



function MatchTeachingHours(flag)
{
	var a = document.forms[0].AO_infac_hrs_teaching.value;
	var b = document.forms[0].AO_infac_hrs_laboratory.value;
	var c = document.forms[0].AO_infac_hrs_seminar.value;
	var d = document.forms[0].AO_infac_hrs_indep_study.value;
	var e = document.forms[0].AO_infac_hrs_direct_study.value;
	var f = document.forms[0].AO_infac_hrs_research.value;
	var g = document.forms[0].AO_infac_hrs_clinical.value;
	var h = document.forms[0].AO_infac_hrs_res_service.value;
	var i = document.forms[0].AO_infac_hrs_administration.value;

	a	= parseInt(a) ? parseInt(a) : 0;
	b	= parseInt(b) ? parseInt(b) : 0;
	c	= parseInt(c) ? parseInt(c) : 0;
	d	= parseInt(d) ? parseInt(d) : 0;
	e	= parseInt(e) ? parseInt(e) : 0;
	f	= parseInt(f) ? parseInt(f) : 0;
	g	= parseInt(g) ? parseInt(g) : 0;
	h	= parseInt(h) ? parseInt(h) : 0;
	i	= parseInt(i) ? parseInt(i) : 0;
	
	//var total= parseInt(a) + parseInt(b) + parseInt(c) + parseInt(d) + parseInt(e) + parseInt(f) + parseInt(g) + parseInt(h) +parseInt(i);
	total= a + b + c + d + e + f + g + h + i;
	
	
	var tag = document.all ?  document.all.t_AO_infac_teaching_hrs // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_infac_teaching_hrs') // NN6
    		   : null; 	
    		   
	var tag1 = document.all ?  document.all.t_AO_infac_hrs_total // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_infac_hrs_total') // NN6
    		   : null; 	
    		       		   
    		   
	
	if(!isNaN(total))
	{
		document.forms[0].AO_infac_hrs_total.value = total;
	
	 	if(flag == true && total != 100)
		{
			tag.className = 'tfvHighlight';			
			tag1.className = 'tfvHighlight';			
			alert('The nine categories of time spent must add to 100%');
			eval('document.forms[0].AO_infac_hrs_total.focus()');
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;	
	}	
	
	return false;
}	

//***********************************************************

function CheckLicenseExpiry(flag)
{
	var LicArray = new Array();

	LicArray[0] = 'XI_fac_pract_lic1';
	LicArray[1] = 'XI_fac_pract_exp1';
	LicArray[2] = 'XI_fac_hearing_aid_lic1';
	LicArray[3] = 'XI_fac_hearing_exp1';
	LicArray[4] = 'XI_fac_pract_lic2';
	LicArray[5] = 'XI_fac_pract_exp2';
	LicArray[6] = 'XI_fac_hearing_aid_lic2';
	LicArray[7] = 'XI_fac_hearing_exp2';
	LicArray[8] = 'XI_fac_pract_lic3';
	LicArray[9] = 'XI_fac_pract_exp3';
	LicArray[10]= 'XI_fac_hearing_aid_lic3';
	LicArray[11]= 'XI_fac_hearing_exp3';
	LicArray[12]= 'XI_fac_pract_lic4';
	LicArray[13]= 'XI_fac_pract_exp4';
	LicArray[14]= 'XI_fac_hearing_aid_lic4';
	LicArray[15]= 'XI_fac_hearing_exp4';
	LicArray[16]= 'XI_fac_pract_lic5';
	LicArray[17]= 'XI_fac_pract_exp5';
	LicArray[18]= 'XI_fac_hearing_aid_lic5';
	LicArray[19]= 'XI_fac_hearing_exp5';	
	
	var tag = document.all ?  document.all.t_XI_fac_practice_states // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_fac_practice_states') // NN6
    		   : null; 	
    		   	
	if(flag)
	{
		LicArray[0] = 'XI_prec_practLic1';
		LicArray[1] = 'XI_prec_practExp1';
		LicArray[2] = 'XI_prec_hearingAidLic1';
		LicArray[3] = 'XI_prec_hearingExp1';
		LicArray[4] = 'XI_prec_practLic2';
		LicArray[5] = 'XI_prec_practExp2';
		LicArray[6] = 'XI_prec_hearingAidLic2';
		LicArray[7] = 'XI_prec_hearingExp2';
		LicArray[8] = 'XI_prec_practLic3';
		LicArray[9] = 'XI_prec_practExp3';
		LicArray[10]= 'XI_prec_hearingAidLic3';
		LicArray[11]= 'XI_prec_hearingExp3';
		LicArray[12]= 'XI_prec_practLic4';
		LicArray[13]= 'XI_prec_practExp4';
		LicArray[14]= 'XI_prec_hearingAidLic4';
		LicArray[15]= 'XI_prec_hearingExp4';
		LicArray[16]= 'XI_prec_practLic5';
		LicArray[17]= 'XI_prec_practExp5';
		LicArray[18]= 'XI_prec_hearingAidLic5';
		LicArray[19]= 'XI_prec_hearingExp5';		

		tag = document.all ?  document.all.t_XI_prec_practice // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_prec_practice') // NN6
    		   : null; 			
	}	
	
	var i;
	
	

    		   	
	for (i =0;i<19;i=i+2)
	{
		var lic = eval('document.forms[0].'+LicArray[i]+'.value');
		var j = i + 1;
		var expiry = eval('document.forms[0].'+LicArray[j]+'.value');
		
		if(validateNotEmpty(lic) && (!validateUSDate(expiry) || !validateNotEmpty(expiry)))
		{
			tag.className = 'tfvHighlight';			
			alert('If a state and license are noted then a valid expiration date must also be noted.');
			eval('document.forms[0].'+LicArray[j]+'.focus()');
			return false;
		}	
		else if(!validateNotEmpty(lic) && (validateUSDate(expiry) || validateNotEmpty(expiry)))
		{
			tag.className = 'tfvHighlight';			
			alert('If a state and an expiration date are noted then a valid license must also be noted.');
			eval('document.forms[0].'+LicArray[j]+'.focus()');
			return false;			
		}	
		tag.className = 'tfvNormal';
	}	
	return true;
}

//***********************************************************

function CheckStateLicenseExpiry(flag)
{
	var LicArray = new Array();

	LicArray[0] = 'XI_fac_pract_state1';
	LicArray[1] = 'XI_fac_pract_lic1';
	LicArray[2] = 'XI_fac_pract_exp1';
	LicArray[3] = 'XI_fac_hearing_aid_lic1';
	LicArray[4] = 'XI_fac_hearing_exp1';
	
	LicArray[5] = 'XI_fac_pract_state2';
	LicArray[6] = 'XI_fac_pract_lic2';
	LicArray[7] = 'XI_fac_pract_exp2';
	LicArray[8] = 'XI_fac_hearing_aid_lic2';
	LicArray[9] = 'XI_fac_hearing_exp2';
	
	LicArray[10]= 'XI_fac_pract_state3';
	LicArray[11]= 'XI_fac_pract_lic3';
	LicArray[12]= 'XI_fac_pract_exp3';
	LicArray[13]= 'XI_fac_hearing_aid_lic3';
	LicArray[14]= 'XI_fac_hearing_exp3';
	
	LicArray[15]= 'XI_fac_pract_state4';
	LicArray[16]= 'XI_fac_pract_lic4';
	LicArray[17]= 'XI_fac_pract_exp4';
	LicArray[18]= 'XI_fac_hearing_aid_lic4';
	LicArray[19]= 'XI_fac_hearing_exp4';
	
	LicArray[20]= 'XI_fac_pract_state5';
	LicArray[21]= 'XI_fac_pract_lic5';
	LicArray[22]= 'XI_fac_pract_exp5';
	LicArray[23]= 'XI_fac_hearing_aid_lic5';
	LicArray[24]= 'XI_fac_hearing_exp5';	
	
	var f_tag =   'XI_fac_pract_state1';		
	
	var tag = document.all ?  document.all.t_XI_fac_practice_states // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_fac_practice_states') // NN6
    		   : null; 	
    		   	
	if(flag)
	{
		
		LicArray[0] = 'XI_prec_practState1';
		LicArray[1] = 'XI_prec_practLic1';
		LicArray[2] = 'XI_prec_practExp1';
		LicArray[3] = 'XI_prec_hearingAidLic1';
		LicArray[4] = 'XI_prec_hearingExp1';
		
		LicArray[5] = 'XI_prec_practState2';
		LicArray[6] = 'XI_prec_practLic2';
		LicArray[7] = 'XI_prec_practExp2';
		LicArray[8] = 'XI_prec_hearingAidLic2';
		LicArray[9] = 'XI_prec_hearingExp2';
		
		LicArray[10] ='XI_prec_practState3';
		LicArray[11] ='XI_prec_practLic3';
		LicArray[12] ='XI_prec_practExp3';
		LicArray[13] ='XI_prec_hearingAidLic3';
		LicArray[14] ='XI_prec_hearingExp3';
		
		LicArray[15] ='XI_prec_practState3';
		LicArray[16]= 'XI_prec_practLic4';
		LicArray[17]= 'XI_prec_practExp4';
		LicArray[18]= 'XI_prec_hearingAidLic4';
		LicArray[19]= 'XI_prec_hearingExp4';
		
		LicArray[20] ='XI_prec_practState3';
		LicArray[21]= 'XI_prec_practLic5';
		LicArray[22]= 'XI_prec_practExp5';
		LicArray[23]= 'XI_prec_hearingAidLic5';
		LicArray[24]= 'XI_prec_hearingExp5';		

		tag = document.all ?  document.all.t_XI_prec_practice // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_prec_practice') // NN6
    		   : null; 	
    		
    		f_tag =    'XI_prec_practState1';		
	}	
	
   		   	
	for (var i =0;i<21;i=i+5)
	{
		var j = i + 1;
		var k = i + 2;
		var l = i + 3;
		var m = i + 4;
		
		var state 	= eval('document.forms[0].'+LicArray[i]+'.value');
		var lic 	= eval('document.forms[0].'+LicArray[j]+'.value');
		var expiry 	= eval('document.forms[0].'+LicArray[k]+'.value');
		var hlic 	= eval('document.forms[0].'+LicArray[l]+'.value');
		var hexpiry 	= eval('document.forms[0].'+LicArray[m]+'.value');		
		
    		if(validateNotEmpty(state) && ((!validateNotEmpty(lic) && !validateUSDate(expiry)) && (!validateNotEmpty(hlic) && !validateUSDate(hexpiry))) )
                {
                        tag.className = 'tfvHighlight';
                        alert('If a state is selected then a valid license and a valid expiration date must also be noted.');
                        //eval('document.forms[0].'+LicArray[j]+'.focus()');
                        eval('document.forms[0].'+f_tag+'.focus()');

                        return false;
                }

                if(state == '' && (validateNotEmpty(lic) || validateUSDate(expiry) || validateNotEmpty(hlic) || validateUSDate(hexpiry)))
                {
                        tag.className = 'tfvHighlight';
                        alert('A state must be selected if you enter a license or an expiration date.');
                        //eval('document.forms[0].'+LicArray[i]+'.focus()');
                        eval('document.forms[0].'+f_tag+'.focus()');
                        return false;
                }

		tag.className = 'tfvNormal';
	}	
	return true;
}

//***********************************************************

function checkCheckBoxValues()
{
	var CheckArray = new Array();
	var ValueArray = new Array();
	var TagArray = new Array();
	
	CheckArray[0] = 'PL_Prog_admisreq_ovelall_gpa';
	CheckArray[1] = 'PL_Prog_admisreq_gpa_major';
	CheckArray[2] = 'PL_Prog_admisreq_gre_verb';
	CheckArray[3] = 'PL_Prog_admisreq_gre_quant';
	CheckArray[4] = 'PL_Prog_admisreq_gre_analytic';
	CheckArray[5] = 'PL_Prog_admisreq_letters_recom';
	CheckArray[6] = 'PL_Prog_admisreq_prev_workexp';
	CheckArray[7] = 'PL_Prog_admisreq_prev_degree';
	CheckArray[8] = 'PL_Prog_admisreq_other1';
	CheckArray[9] = 'PL_Prog_admisreq_other2';
	CheckArray[10]= 'PL_Prog_admisreq_other3';
	
	ValueArray[0] = 'PL_Prog_admisreq_ovelall_gpa_val';
	ValueArray[1] = 'PL_Prog_admisreq_gpa_major_val';
	ValueArray[2] = 'PL_Prog_admisreq_gre_verb_val';
	ValueArray[3] = 'PL_Prog_admisreq_gre_quant_val';
	ValueArray[4] = 'PL_Prog_admisreq_gre_analytic_val';
	ValueArray[5] = 'PL_Prog_admisreq_letters_recom_val';
	ValueArray[6] = 'PL_Prog_admisreq_prev_workexp_val';
	ValueArray[7] = 'PL_Prog_admisreq_prev_degree_val';
	ValueArray[8] = 'PL_Prog_admisreq_other1_val';
	ValueArray[9] = 'PL_Prog_admisreq_other2_val';
	ValueArray[10]= 'PL_Prog_admisreq_other3_val';
	

	TagArray[0] = 't_PL_Prog_admisreq_ovelall_gpa_val';
	TagArray[1] = 't_PL_Prog_admisreq_gpa_major_val';
	TagArray[2] = 't_PL_Prog_admisreq_gre_verb_val';
	TagArray[3] = 't_PL_Prog_admisreq_gre_quant_val';
	TagArray[4] = 't_PL_Prog_admisreq_gre_analytic_val';
	TagArray[5] = 't_PL_Prog_admisreq_letters_recom_val';
	TagArray[6] = 't_PL_Prog_admisreq_prev_workexp_val';
	TagArray[7] = 't_PL_Prog_admisreq_prev_degree_val';
	TagArray[8] = 't_PL_Prog_admisreq_other1_val';
	TagArray[9] = 't_PL_Prog_admisreq_other2_val';
	TagArray[10]= 't_PL_Prog_admisreq_other3_val';
		


	var tag = document.all ?  document.all.t_PL_Prog_admisreq_criteria // IE4+
    		   : document.getElementById ? document.getElementById('t_PL_Prog_admisreq_criteria') // NN6
    		   : null; 
    		   	
	var i;
	
	for (i =0;i<11;i=i+1)
	{
		var ckd = eval('document.forms[0].'+CheckArray[i]+'.checked');	
		var val = eval('document.forms[0].'+ValueArray[i]+'.value');	

		//var tag1 = eval('document.all ?  document.all.'+TagArray[i]+': document.getElementById ? document.getElementById(' +TagArray[i]+ '): null;') 
    		   		
		if((ckd && !val) || (!ckd && val))
		{
			tag.className = 'tfvHighlight';
			//tag1.className = 'tfvHighlight';
			
			//eval('document.forms[0].'+ValueArray[i]+'.focus()');
			alert('if you checked a box there needs to be a value and if there is a value there needs to be a check');
			return false;	
		}
		//tag1.className = 'tfvNormal';
	}	
	tag.className = 'tfvNormal';				
	return true;			
}	

//***********************************************************

function checkCourseManagement()
{
	var ckd = document.forms[0].XR_WebCourseMgmnt[0].checked;

	var found_it = 0;
	
	var tag = document.all ?  document.all.t_XR_WebCourseMgmnt_type // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_WebCourseMgmnt_type') // NN6
    		   : null; 
    	
	if(ckd)
	{
		for (var i=0; i<document.forms[0].XR_WebCourseMgmnt_type.length; i++)  
		{ 
			if (document.forms[0].XR_WebCourseMgmnt_type[i].checked)  
			{
				found_it = document.forms[0].XR_WebCourseMgmnt_type[i].value
			}	
		} 
		
		if(!found_it)
		{
			tag.className = 'tfvHighlight';
			eval('document.forms[0].XR_WebCourseMgmnt[0].focus()');			
			alert('Since you use a mediating internet course management system, please select the type.');
			return false;	
		}	
		else
		{
			var other1 = 	eval('document.forms[0].XR_WebCourseMgmnt_type[3].checked');
			var other2 = 	eval('document.forms[0].XR_WebCourseMgmnt_type[4].checked');
			
			var val1   =    document.forms[0].XR_WebCourseMgmnt_type1.value;
			var val2   =    document.forms[0].XR_WebCourseMgmnt_type2.value;
			
			var tag1 = document.all ?  document.all.t_XR_WebCourseMgmnt_type1 // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_WebCourseMgmnt_type1') // NN6
    		   	: null; 
    		   	
			var tag2 = document.all ?  document.all.t_XR_WebCourseMgmnt_type2 // IE4+
    		   	: document.getElementById ? document.getElementById('t_XR_WebCourseMgmnt_type2') // NN6
    		   	: null;     		   	
    		   			
			
			if((other1 && !val1) || (!other1 && val1))
			{
				tag.className = 'tfvHighlight';
				tag1.className = 'tfvHighlight';
				eval('document.forms[0].XR_WebCourseMgmnt_type[3].focus()');
				alert('if you checked a box there needs to be a value and if there is a value there needs to be a check');
				return false;	
			}		
			
			if((other2 && !val2) || (!other2 && val2))
			{
				tag.className = 'tfvHighlight';
				tag2.className = 'tfvHighlight';
				eval('document.forms[0].XR_WebCourseMgmnt_type[4].focus()');
				alert('if you checked a box there needs to be a value and if there is a value there needs to be a check');
				return false;	
			}		
			tag1.className = 'tfvNormal';
			tag2.className = 'tfvNormal';			
		}		
	}	
	tag.className = 'tfvNormal';	
	return true;
}	

//***********************************************************	

function CheckOnSiteLabOtherValue()
{
	var tag = document.all ?  document.all.t_XR_OnSite_TeachMethod // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_OnSite_TeachMethod') // NN6
    		   : null; 
    		   		
	var other1 = 	eval('document.forms[0].XR_OnSite_TeachMethod[3].checked');
	var val1   =    document.forms[0].XR_OnSite_TeachMethod_otherdetail.value;
			
	var tag1 = document.all ?  document.all.t_XR_OnSite_TeachMethod_otherdetail // IE4+
  		   	: document.getElementById ? document.getElementById('t_XR_OnSite_TeachMethod_otherdetail') // NN6
    		   	: null; 
			
	if((other1 && !val1) || (!other1 && val1))
	{
		tag.className = 'tfvHighlight';
		tag1.className = 'tfvHighlight';
		eval('document.forms[0].XR_OnSite_TeachMethod[3].focus()');
		alert('if you checked a box there needs to be a value and if there is a value there needs to be a check');
		return false;	
	}		
			
	tag1.className = 'tfvNormal';
	tag.className = 'tfvNormal';	
	return true;
}	

//***********************************************************	

function validDateNumbers( strValue ) 
{
	var objRegExp = /^(\-|\/|\d+\s+)$/;

  	if(!objRegExp.test(strValue))
    	return false; 
  	else
  	return true;	
}	

//***********************************************************

function validateNotEmpty( strValue ) 
{
	/************************************************
	DESCRIPTION: Validates that a string is not all
  	blank (whitespace) characters.
    
	PARAMETERS:
   	strValue - String to be tested for validity
   
	RETURNS:
   	True if valid, otherwise false.
	*************************************************/
   	var strTemp = strValue;
   	
   	strTemp = trimAll(strTemp);
   	if(strTemp.length > 0)
   	{
     		return true;
   	}  
   	return false;
}

//***********************************************************

function validateUSDate( strValue ) 
{
	/************************************************
	DESCRIPTION: Validates that a string contains only 
    	valid dates with 2 digit month, 2 digit day, 
    	4 digit year. Date separator can be ., -, or /.
    	Uses combination of regular expressions and 
    	string parsing to validate date.
    	Ex. mm/dd/yyyy or mm-dd-yyyy or mm.dd.yyyy
    
	PARAMETERS:
   	strValue - String to be tested for validity
   
	RETURNS:
   	True if valid, otherwise false.
   
	REMARKS:
   	Avoids some of the limitations of the Date.parse()
   	method such as the date separator character.
	*************************************************/
	
  	var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
 
  	//check to see if in correct format
  	if(!objRegExp.test(strValue))
    	return false; //doesn't match pattern, bad date
  	else{
    	var arrayDate = strValue.split(RegExp.$1); //split date into month, day, year
	var intDay = parseInt(arrayDate[1],10); 
	var intYear = parseInt(arrayDate[2],10);
    	var intMonth = parseInt(arrayDate[0],10);
	
	//check for valid month
	if(intMonth > 12 || intMonth < 1) 
	{
		return false;
	}
	
    	//create a lookup for months not equal to Feb.
    	var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,
                        '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31}
  
    	//check if month value and day value agree
    	if(arrayLookup[arrayDate[0]] != null) {
      	if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0)
        return true; //found in lookup table, good date
    	}
		
    	//check for February
	var booLeapYear = (intYear % 4 == 0 && (intYear % 100 != 0 || intYear % 400 == 0));
    	if( ((booLeapYear && intDay <= 29) || (!booLeapYear && intDay <=28)) && intDay !=0)
      	return true; //Feb. had valid number of days
  	}
  	return false; //any other values, bad date
}

//************************************************

function trimAll( strValue ) 
{
	/************************************************
	DESCRIPTION: Removes leading and trailing spaces.

	PARAMETERS: Source string from which spaces will be removed;

	RETURNS: Source string with whitespaces removed.
	*************************************************/ 
 	var objRegExp = /^(\s*)$/;

    	//check for all spaces
    	if(objRegExp.test(strValue)) {
       	strValue = strValue.replace(objRegExp, '');
       	if( strValue.length == 0)
          	return strValue;
    	}
    
   	//check for leading & trailing spaces
   	objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   	if(objRegExp.test(strValue)) {
       		//remove leading and trailing whitespace characters
       		strValue = strValue.replace(objRegExp, '$2');
    	}
  	return strValue;
}

//***********************************************************

function CheckPercentSum()
{
	var msg= 'Sum of all fields should be same as Total specified and also should not be more than 100%';
	
	if(!CheckTotal('AO_T_Comp_Achieved_F1_end_Year2','AO_T_Comp_Achieved_F1_mid_Year3','AO_T_Comp_Achieved_F1_end_Year3','AO_T_Comp_Achieved_F1_mid_Year4','AO_T_Comp_Achieved_F1_end_Year4','AO_T_Comp_Achieved_F1_after_Year4','AO_T_Comp_Achieved_F1_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F2_end_Year2','AO_T_Comp_Achieved_F2_mid_Year3','AO_T_Comp_Achieved_F2_end_Year3','AO_T_Comp_Achieved_F2_mid_Year4','AO_T_Comp_Achieved_F2_end_Year4','AO_T_Comp_Achieved_F2_after_Year4','AO_T_Comp_Achieved_F2_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F3_end_Year2','AO_T_Comp_Achieved_F3_mid_Year3','AO_T_Comp_Achieved_F3_end_Year3','AO_T_Comp_Achieved_F3_mid_Year4','AO_T_Comp_Achieved_F3_end_Year4','AO_T_Comp_Achieved_F3_after_Year4','AO_T_Comp_Achieved_F3_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F4_end_Year2','AO_T_Comp_Achieved_F4_mid_Year3','AO_T_Comp_Achieved_F4_end_Year3','AO_T_Comp_Achieved_F4_mid_Year4','AO_T_Comp_Achieved_F4_end_Year4','AO_T_Comp_Achieved_F4_after_Year4','AO_T_Comp_Achieved_F4_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F5_end_Year2','AO_T_Comp_Achieved_F5_mid_Year3','AO_T_Comp_Achieved_F5_end_Year3','AO_T_Comp_Achieved_F5_mid_Year4','AO_T_Comp_Achieved_F5_end_Year4','AO_T_Comp_Achieved_F5_after_Year4','AO_T_Comp_Achieved_F5_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F6_end_Year2','AO_T_Comp_Achieved_F6_mid_Year3','AO_T_Comp_Achieved_F6_end_Year3','AO_T_Comp_Achieved_F6_mid_Year4','AO_T_Comp_Achieved_F6_end_Year4','AO_T_Comp_Achieved_F6_after_Year4','AO_T_Comp_Achieved_F6_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F7_end_Year2','AO_T_Comp_Achieved_F7_mid_Year3','AO_T_Comp_Achieved_F7_end_Year3','AO_T_Comp_Achieved_F7_mid_Year4','AO_T_Comp_Achieved_F7_end_Year4','AO_T_Comp_Achieved_F7_after_Year4','AO_T_Comp_Achieved_F7_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F8_end_Year2','AO_T_Comp_Achieved_F8_mid_Year3','AO_T_Comp_Achieved_F8_end_Year3','AO_T_Comp_Achieved_F8_mid_Year4','AO_T_Comp_Achieved_F8_end_Year4','AO_T_Comp_Achieved_F8_after_Year4','AO_T_Comp_Achieved_F8_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F9_end_Year2','AO_T_Comp_Achieved_F9_mid_Year3','AO_T_Comp_Achieved_F9_end_Year3','AO_T_Comp_Achieved_F9_mid_Year4','AO_T_Comp_Achieved_F9_end_Year4','AO_T_Comp_Achieved_F9_after_Year4','AO_T_Comp_Achieved_F9_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_F10_end_Year2','AO_T_Comp_Achieved_F10_mid_Year3','AO_T_Comp_Achieved_F10_end_Year3','AO_T_Comp_Achieved_F10_mid_Year4','AO_T_Comp_Achieved_F10_end_Year4','AO_T_Comp_Achieved_F10_after_Year4','AO_T_Comp_Achieved_F10_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D1_end_Year2','AO_T_Comp_Achieved_D1_mid_Year3','AO_T_Comp_Achieved_D1_end_Year3','AO_T_Comp_Achieved_D1_mid_Year4','AO_T_Comp_Achieved_D1_end_Year4','AO_T_Comp_Achieved_D1_after_Year4','AO_T_Comp_Achieved_D1_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D2_end_Year2','AO_T_Comp_Achieved_D2_mid_Year3','AO_T_Comp_Achieved_D2_end_Year3','AO_T_Comp_Achieved_D2_mid_Year4','AO_T_Comp_Achieved_D2_end_Year4','AO_T_Comp_Achieved_D2_after_Year4','AO_T_Comp_Achieved_D2_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D3_end_Year2','AO_T_Comp_Achieved_D3_mid_Year3','AO_T_Comp_Achieved_D3_end_Year3','AO_T_Comp_Achieved_D3_mid_Year4','AO_T_Comp_Achieved_D3_end_Year4','AO_T_Comp_Achieved_D3_after_Year4','AO_T_Comp_Achieved_D3_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D4_end_Year2','AO_T_Comp_Achieved_D4_mid_Year3','AO_T_Comp_Achieved_D4_end_Year3','AO_T_Comp_Achieved_D4_mid_Year4','AO_T_Comp_Achieved_D4_end_Year4','AO_T_Comp_Achieved_D4_after_Year4','AO_T_Comp_Achieved_D4_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D5_end_Year2','AO_T_Comp_Achieved_D5_mid_Year3','AO_T_Comp_Achieved_D5_end_Year3','AO_T_Comp_Achieved_D5_mid_Year4','AO_T_Comp_Achieved_D5_end_Year4','AO_T_Comp_Achieved_D5_after_Year4','AO_T_Comp_Achieved_D5_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D6_end_Year2','AO_T_Comp_Achieved_D6_mid_Year3','AO_T_Comp_Achieved_D6_end_Year3','AO_T_Comp_Achieved_D6_mid_Year4','AO_T_Comp_Achieved_D6_end_Year4','AO_T_Comp_Achieved_D6_after_Year4','AO_T_Comp_Achieved_D6_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D7_end_Year2','AO_T_Comp_Achieved_D7_mid_Year3','AO_T_Comp_Achieved_D7_end_Year3','AO_T_Comp_Achieved_D7_mid_Year4','AO_T_Comp_Achieved_D7_end_Year4','AO_T_Comp_Achieved_D7_after_Year4','AO_T_Comp_Achieved_D7_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D8_end_Year2','AO_T_Comp_Achieved_D8_mid_Year3','AO_T_Comp_Achieved_D8_end_Year3','AO_T_Comp_Achieved_D8_mid_Year4','AO_T_Comp_Achieved_D8_end_Year4','AO_T_Comp_Achieved_D8_after_Year4','AO_T_Comp_Achieved_D8_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D9_end_Year2','AO_T_Comp_Achieved_D9_mid_Year3','AO_T_Comp_Achieved_D9_end_Year3','AO_T_Comp_Achieved_D9_mid_Year4','AO_T_Comp_Achieved_D9_end_Year4','AO_T_Comp_Achieved_D9_after_Year4','AO_T_Comp_Achieved_D9_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D10_end_Year2','AO_T_Comp_Achieved_D10_mid_Year3','AO_T_Comp_Achieved_D10_end_Year3','AO_T_Comp_Achieved_D10_mid_Year4','AO_T_Comp_Achieved_D10_end_Year4','AO_T_Comp_Achieved_D10_after_Year4','AO_T_Comp_Achieved_D10_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_D11_end_Year2','AO_T_Comp_Achieved_D11_mid_Year3','AO_T_Comp_Achieved_D11_end_Year3','AO_T_Comp_Achieved_D11_mid_Year4','AO_T_Comp_Achieved_D11_end_Year4','AO_T_Comp_Achieved_D11_after_Year4','AO_T_Comp_Achieved_D11_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_C1_end_Year2','AO_T_Comp_Achieved_C1_mid_Year3','AO_T_Comp_Achieved_C1_end_Year3','AO_T_Comp_Achieved_C1_mid_Year4','AO_T_Comp_Achieved_C1_end_Year4','AO_T_Comp_Achieved_C1_after_Year4','AO_T_Comp_Achieved_C1_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_C2_end_Year2','AO_T_Comp_Achieved_C2_mid_Year3','AO_T_Comp_Achieved_C2_end_Year3','AO_T_Comp_Achieved_C2_mid_Year4','AO_T_Comp_Achieved_C2_end_Year4','AO_T_Comp_Achieved_C2_after_Year4','AO_T_Comp_Achieved_C2_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_C3_end_Year2','AO_T_Comp_Achieved_C3_mid_Year3','AO_T_Comp_Achieved_C3_end_Year3','AO_T_Comp_Achieved_C3_mid_Year4','AO_T_Comp_Achieved_C3_end_Year4','AO_T_Comp_Achieved_C3_after_Year4','AO_T_Comp_Achieved_C3_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_C4_end_Year2','AO_T_Comp_Achieved_C4_mid_Year3','AO_T_Comp_Achieved_C4_end_Year3','AO_T_Comp_Achieved_C4_mid_Year4','AO_T_Comp_Achieved_C4_end_Year4','AO_T_Comp_Achieved_C4_after_Year4','AO_T_Comp_Achieved_C4_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P1_end_Year2','AO_T_Comp_Achieved_P1_mid_Year3','AO_T_Comp_Achieved_P1_end_Year3','AO_T_Comp_Achieved_P1_mid_Year4','AO_T_Comp_Achieved_P1_end_Year4','AO_T_Comp_Achieved_P1_after_Year4','AO_T_Comp_Achieved_P1_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P2_end_Year2','AO_T_Comp_Achieved_P2_mid_Year3','AO_T_Comp_Achieved_P2_end_Year3','AO_T_Comp_Achieved_P2_mid_Year4','AO_T_Comp_Achieved_P2_end_Year4','AO_T_Comp_Achieved_P2_after_Year4','AO_T_Comp_Achieved_P2_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P3_end_Year2','AO_T_Comp_Achieved_P3_mid_Year3','AO_T_Comp_Achieved_P3_end_Year3','AO_T_Comp_Achieved_P3_mid_Year4','AO_T_Comp_Achieved_P3_end_Year4','AO_T_Comp_Achieved_P3_after_Year4','AO_T_Comp_Achieved_P3_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P4_end_Year2','AO_T_Comp_Achieved_P4_mid_Year3','AO_T_Comp_Achieved_P4_end_Year3','AO_T_Comp_Achieved_P4_mid_Year4','AO_T_Comp_Achieved_P4_end_Year4','AO_T_Comp_Achieved_P4_after_Year4','AO_T_Comp_Achieved_P4_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P5_end_Year2','AO_T_Comp_Achieved_P5_mid_Year3','AO_T_Comp_Achieved_P5_end_Year3','AO_T_Comp_Achieved_P5_mid_Year4','AO_T_Comp_Achieved_P5_end_Year4','AO_T_Comp_Achieved_P5_after_Year4','AO_T_Comp_Achieved_P5_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P6_end_Year2','AO_T_Comp_Achieved_P6_mid_Year3','AO_T_Comp_Achieved_P6_end_Year3','AO_T_Comp_Achieved_P6_mid_Year4','AO_T_Comp_Achieved_P6_end_Year4','AO_T_Comp_Achieved_P6_after_Year4','AO_T_Comp_Achieved_P6_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P7_end_Year2','AO_T_Comp_Achieved_P7_mid_Year3','AO_T_Comp_Achieved_P7_end_Year3','AO_T_Comp_Achieved_P7_mid_Year4','AO_T_Comp_Achieved_P7_end_Year4','AO_T_Comp_Achieved_P7_after_Year4','AO_T_Comp_Achieved_P7_Total')){alert(msg);return false;}
	if(!CheckTotal('AO_T_Comp_Achieved_P8_end_Year2','AO_T_Comp_Achieved_P8_mid_Year3','AO_T_Comp_Achieved_P8_end_Year3','AO_T_Comp_Achieved_P8_mid_Year4','AO_T_Comp_Achieved_P8_end_Year4','AO_T_Comp_Achieved_P8_after_Year4','AO_T_Comp_Achieved_P8_Total')){alert(msg);return false;}
	return true;	
}

//***********************************************************

function CheckTotal(a,b,c,d,e,f,tot)
{
	var c1 = eval('document.forms[0].'+a+'.value');
	var c2 = eval('document.forms[0].'+b+'.value');
	var c3 = eval('document.forms[0].'+c+'.value');
	var c4 = eval('document.forms[0].'+d+'.value');
	var c5 = eval('document.forms[0].'+e+'.value');
	var c6 = eval('document.forms[0].'+f+'.value');
	var total = eval('document.forms[0].'+tot+'.value');

	var ftag  = eval('document.forms[0].'+tot);
	/*	
	var msg  = 'The total number of applicants of all the age groups must equal the sum  of all full-time and all part-time applicants.';

	var tag = document.all ?  document.all.t_XI_Prog_age_groups // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_Prog_age_groups') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.t_age_app_total // IE4+
    		   : document.getElementById ? document.getElementById('t_age_app_total') // NN6
    		   : null; 
    		       				   	
	var f_tag = document.forms[0].XI_Prog_app_age_lessthan_20;
	*/
	
	var ftotal= parseInt(c1) + parseInt(c2) + parseInt(c3) + parseInt(c4) + parseInt(c5) + parseInt(c6);
	
	if(!isNaN(ftotal) && !isNaN(total))
	{
		if(parseInt(total) > 100 || ftotal > 100 || parseInt(total) != ftotal)
		{
			ftag.focus();
			return false;
		}
		/*tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';*/
		
		return true;
	}	
	else
	{
		alert('Please enter zero if not available.');
		ftag.focus();		
	}		
	return false;	
}	

//***********************************************************

function CheckAudDegree()
{
	var tag = document.all ?  document.all.t_XI_enr_same_prog // IE4+
    		   : document.getElementById ? document.getElementById('t_XI_enr_same_prog') // NN6
    		   : null; 
    		   		
	var grad = 	eval('document.forms[0].XI_enr_same_inst[0].checked');
	var aud_deg_yes = 	eval('document.forms[0].XI_enr_same_prog[0].checked');
	var aud_deg_no = 	eval('document.forms[0].XI_enr_same_prog[1].checked');
	
	if(grad && (aud_deg_yes == '' && aud_deg_no == ''))
	{
		tag.className = 'tfvHighlight';
		eval('document.forms[0].XI_enr_same_prog[0].focus()');
		alert('Since you indicated that this student attended your institution as an undergraduate, this question is required.');
		return false;	
	}		
			
	tag.className = 'tfvNormal';	
	return true;	
}	

//***********************************************************


function CheckScholarship(flag)
{
	var tag;
	var scholarship;
	var amount;
	var f_ftag;
	
	if(flag == 1)
	{
		tag = document.all ?  document.all.t_XR_StudServ_scholarship_amount_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_scholarship_amount_year1') // NN6
    		   : null; 
    		   		
		scholarship 	= eval('document.forms[0].XR_StudServ_scholarship_year1[0].checked');
		amount 		= eval('document.forms[0].XR_StudServ_scholarship_amount_year1.value');
		f_ftag		= "XR_StudServ_scholarship_amount_year1"
	}	
	else if(flag == 2)
	{
		tag = document.all ?  document.all.t_XR_StudServ_scholarship_amount_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_scholarship_amount_year2') // NN6
    		   : null; 
    		   		
		scholarship 	= eval('document.forms[0].XR_StudServ_scholarship_year2[0].checked');
		amount 		= eval('document.forms[0].XR_StudServ_scholarship_amount_year2.value');
		f_ftag		= "XR_StudServ_scholarship_amount_year2"
	}		
	
	else if(flag == 3)
	{
		tag = document.all ?  document.all.t_XR_StudServ_scholarship_amount_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_scholarship_amount_year3') // NN6
    		   : null; 
    		   		
		scholarship 	= eval('document.forms[0].XR_StudServ_scholarship_year3[0].checked');
		amount 		= eval('document.forms[0].XR_StudServ_scholarship_amount_year3.value');
		f_ftag		= "XR_StudServ_scholarship_amount_year3"
	}			
	
	else if(flag == 4)
	{
		tag = document.all ?  document.all.t_XR_StudServ_scholarship_amount_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_scholarship_amount_year4') // NN6
    		   : null; 
    		   		
		scholarship 	= eval('document.forms[0].XR_StudServ_scholarship_year4[0].checked');
		amount 		= eval('document.forms[0].XR_StudServ_scholarship_amount_year4.value');
		f_ftag		= "XR_StudServ_scholarship_amount_year4"
	}			

	else if(flag == 5)
	{
		tag = document.all ?  document.all.t_XR_StudServ_scholarship_amount_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_scholarship_amount_year5') // NN6
    		   : null; 
    		   		
		scholarship 	= eval('document.forms[0].XR_StudServ_scholarship_year5[0].checked');
		amount 		= eval('document.forms[0].XR_StudServ_scholarship_amount_year5.value');
		f_ftag		= "XR_StudServ_scholarship_amount_year5"
	}			
	
	if(scholarship && amount == '')
	{
		tag.className = 'tfvHighlight';
		eval('document.forms[0].'+f_ftag+'.focus()');
		alert('Since you indicated that this student was awarded a scholarship, please specify the amount.');
		return false;	
	}		
			
	tag.className = 'tfvNormal';	
	return true;	
}	

//***********************************************************

function CheckGrant(flag)
{
	var tag;
	var grant;
	var amount;
	var f_ftag;
	
	if(flag == 1)
	{
		tag = document.all ?  document.all.t_XR_StudServ_grant_amount_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_grant_amount_year1') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_grant_year1[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_grant_amount_year1.value');
		f_ftag	= "XR_StudServ_grant_amount_year1"
	}	
	else if(flag == 2)
	{
		tag = document.all ?  document.all.t_XR_StudServ_grant_amount_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_grant_amount_year2') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_grant_year2[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_grant_amount_year2.value');
		f_ftag	= "XR_StudServ_grant_amount_year2"
	}		
	else if(flag == 3)
	{
		tag = document.all ?  document.all.t_XR_StudServ_grant_amount_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_grant_amount_year3') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_grant_year3[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_grant_amount_year3.value');
		f_ftag	= "XR_StudServ_grant_amount_year3"
	}			
	
	else if(flag == 4)
	{
		tag = document.all ?  document.all.t_XR_StudServ_grant_amount_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_grant_amount_year4') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_grant_year4[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_grant_amount_year4.value');
		f_ftag	= "XR_StudServ_grant_amount_year4"
	}			
	
	else if(flag == 5)
	{
		tag = document.all ?  document.all.t_XR_StudServ_grant_amount_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_grant_amount_year5') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_grant_year5[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_grant_amount_year5.value');
		f_ftag	= "XR_StudServ_grant_amount_year5"
	}			
	
	if(grant && amount == '')
	{
		tag.className = 'tfvHighlight';
		eval('document.forms[0].'+f_ftag+'.focus()');
		alert('Since you indicated that this student was awarded a grant, please specify the amount.');
		return false;	
	}		
			
	tag.className = 'tfvNormal';	
	return true;	
}
              
//***********************************************************

function CheckLoan(flag)
{
	var tag;
	var grant;
	var amount;
	var f_ftag;
	
	if(flag == 1)
	{
		tag = document.all ?  document.all.t_XR_StudServ_loan_amount_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_loan_amount_year1') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_loan_year1[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_loan_amount_year1.value');
		f_ftag	= "XR_StudServ_loan_amount_year1"
	}	
	else if(flag == 2)
	{
		tag = document.all ?  document.all.t_XR_StudServ_loan_amount_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_loan_amount_year2') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_loan_year2[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_loan_amount_year2.value');
		f_ftag	= "XR_StudServ_loan_amount_year2"
	}		
	else if(flag == 3)
	{
		tag = document.all ?  document.all.t_XR_StudServ_loan_amount_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_loan_amount_year3') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_loan_year3[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_loan_amount_year3.value');
		f_ftag	= "XR_StudServ_loan_amount_year3"
	}			
	
	else if(flag == 4)
	{
		tag = document.all ?  document.all.t_XR_StudServ_loan_amount_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_loan_amount_year4') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_loan_year4[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_loan_amount_year4.value');
		f_ftag	= "XR_StudServ_loan_amount_year4"
	}			
	
	else if(flag == 5)
	{
		tag = document.all ?  document.all.t_XR_StudServ_loan_amount_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_loan_amount_year5') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_loan_year5[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_loan_amount_year5.value');
		f_ftag	= "XR_StudServ_loan_amount_year5"
	}			
	
	if(grant && amount == '')
	{
		tag.className = 'tfvHighlight';
		eval('document.forms[0].'+f_ftag+'.focus()');
		alert('Since you indicated that this student was awarded a loan, please specify the amount.');
		return false;	
	}		
			
	tag.className = 'tfvNormal';	
	return true;	
}              
           
//***********************************************************                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

function CheckAssistantShip(flag)
{
	var tag;
	var grant;
	var amount;
	var f_ftag;
	
	if(flag == 1)
	{
		tag = document.all ?  document.all.t_XR_StudServ_assistantship_amount_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_assistantship_amount_year1') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_assistantship_year1[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_assistantship_amount_year1.value');
		f_ftag	= "XR_StudServ_assistantship_amount_year1"
	}	
	else if(flag == 2)
	{
		tag = document.all ?  document.all.t_XR_StudServ_assistantship_amount_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_assistantship_amount_year2') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_assistantship_year2[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_assistantship_amount_year2.value');
		f_ftag	= "XR_StudServ_assistantship_amount_year2"
	}		
	
	else if(flag == 3)
	{
		tag = document.all ?  document.all.t_XR_StudServ_assistantship_amount_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_assistantship_amount_year3') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_assistantship_year3[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_assistantship_amount_year3.value');
		f_ftag	= "XR_StudServ_assistantship_amount_year3"
	}			
	
	else if(flag == 4)
	{
		tag = document.all ?  document.all.t_XR_StudServ_assistantship_amount_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_assistantship_amount_year4') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_assistantship_year4[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_assistantship_amount_year4.value');
		f_ftag	= "XR_StudServ_assistantship_amount_year4"
	}			
	
	else if(flag == 5)
	{
		tag = document.all ?  document.all.t_XR_StudServ_assistantship_amount_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_XR_StudServ_assistantship_amount_year5') // NN6
    		   : null; 
    		   		
		grant 	= eval('document.forms[0].XR_StudServ_assistantship_year5[0].checked');
		amount 	= eval('document.forms[0].XR_StudServ_assistantship_amount_year5.value');
		f_ftag	= "XR_StudServ_assistantship_amount_year5"
	}			
	
	if(grant && amount == '')
	{
		tag.className = 'tfvHighlight';
		eval('document.forms[0].'+f_ftag+'.focus()');
		alert('Since you indicated that this student was awarded an assistantship fund, please specify the amount.');
		return false;	
	}		
			
	tag.className = 'tfvNormal';	
	return true;	
}              	

//***********************************************************

function CheckLeaveOtherReasons(flag)
{
	var tag;
	var leave;
	var detail;
	var f_ftag;
	
	if(flag == 1)
	{
		tag = document.all ?  document.all.t_AO_inst_leave_reasonother_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_leave_reasonother_year1') // NN6
    		   : null; 
    		   		
		leave 	= eval('document.forms[0].AO_inst_leave_reason_year1.options[document.forms[0].AO_inst_leave_reason_year1.selectedIndex].value');
		detail 	= eval('document.forms[0].AO_inst_leave_reasonother_year1.value');
		f_ftag	= "AO_inst_leave_reasonother_year1"
	}	
	else if(flag == 2)
	{
		tag = document.all ?  document.all.t_AO_inst_leave_reasonother_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_leave_reasonother_year2') // NN6
    		   : null; 
    		   		
		leave 	= eval('document.forms[0].AO_inst_leave_reason_year2.options[document.forms[0].AO_inst_leave_reason_year2.selectedIndex].value');
		detail 	= eval('document.forms[0].AO_inst_leave_reasonother_year2.value');
		f_ftag	= "AO_inst_leave_reasonother_year2"
	}		
	
	else if(flag == 3)
	{
		tag = document.all ?  document.all.t_AO_inst_leave_reasonother_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_leave_reasonother_year3') // NN6
    		   : null; 
    		   		
		leave 	= eval('document.forms[0].AO_inst_leave_reason_year3.options[document.forms[0].AO_inst_leave_reason_year3.selectedIndex].value');
		detail 	= eval('document.forms[0].AO_inst_leave_reasonother_year3.value');
		f_ftag	= "AO_inst_leave_reasonother_year3"
	}			
	
	else if(flag == 4)
	{
		tag = document.all ?  document.all.t_AO_inst_leave_reasonother_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_leave_reasonother_year4') // NN6
    		   : null; 
    		   		
		leave 	= eval('document.forms[0].AO_inst_leave_reason_year4.options[document.forms[0].AO_inst_leave_reason_year4.selectedIndex].value');
		detail 	= eval('document.forms[0].AO_inst_leave_reasonother_year4.value');
		f_ftag	= "AO_inst_leave_reasonother_year4"
	}			
	
	else if(flag == 5)
	{
		tag = document.all ?  document.all.t_AO_inst_leave_reasonother_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_leave_reasonother_year5') // NN6
    		   : null; 
    		   		
		leave 	= eval('document.forms[0].AO_inst_leave_reason_year5.options[document.forms[0].AO_inst_leave_reason_year5.selectedIndex].value');
		detail 	= eval('document.forms[0].AO_inst_leave_reasonother_year5.value');
		f_ftag	= "AO_inst_leave_reasonother_year5"
	}			
	
	if(leave == 9 && detail == '')
	{
		tag.className = 'tfvHighlight';
		eval('document.forms[0].'+f_ftag+'.focus()');
		alert('Since you indicated that this student was left for Other reason, please specify it.');
		return false;	
	}		
			
	tag.className = 'tfvNormal';	
	return true;	
}        

//***********************************************************                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

function CheckDismissal(flag)
{
	var tag1;
	var tag2;
	var tag3;
	var appeal;
	var f_ftag;
	var found_it1  = '';
	var found_it2  = '';
	
	if(flag == 1)
	{
		tag1 = document.all ?  document.all.t_AO_inst_appeal_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_year1') // NN6
    		   : null; 
    		   
		tag2 = document.all ?  document.all.t_AO_inst_appeal_success_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_success_year1') // NN6
    		   : null; 
    		   
		tag3 = document.all ?  document.all.t_AO_inst_appeal_failed_year1 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_failed_year1') // NN6
    		   : null;     		       		   
    		   		
		appeal 	= eval('document.forms[0].AO_inst_appeal_year1[2].checked');
		
		for (var i=0; i<document.forms[0].AO_inst_appeal_success_year1.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_success_year1[i].checked)  
			{
				found_it1 = document.forms[0].AO_inst_appeal_success_year1[i].value;
			} 
		} 
		
		for (var i=0; i<document.forms[0].AO_inst_appeal_failed_year1.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_failed_year1[i].checked)  
			{
				found_it2 = document.forms[0].AO_inst_appeal_failed_year1[i].value;
			} 
		} 				
		
		f_ftag	= "AO_inst_appeal_year1[2]";
	}	
	else if(flag == 2)
	{
		tag1 = document.all ?  document.all.t_AO_inst_appeal_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_year2') // NN6
    		   : null; 
    		   
		tag2 = document.all ?  document.all.t_AO_inst_appeal_success_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_success_year2') // NN6
    		   : null; 
    		   
		tag3 = document.all ?  document.all.t_AO_inst_appeal_failed_year2 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_failed_year2') // NN6
    		   : null;     		       		   
    		   		
		appeal 	= eval('document.forms[0].AO_inst_appeal_year2[2].checked');
		
		for (var i=0; i<document.forms[0].AO_inst_appeal_success_year2.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_success_year2[i].checked)  
			{
				found_it1 = document.forms[0].AO_inst_appeal_success_year2[i].value;
			} 
		} 
		
		for (var i=0; i<document.forms[0].AO_inst_appeal_failed_year2.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_failed_year2[i].checked)  
			{
				found_it2 = document.forms[0].AO_inst_appeal_failed_year2[i].value;
			} 
		} 		
		
		
		f_ftag	= "AO_inst_appeal_year2[2]";
	}		
	
	else if(flag == 3)
	{
		tag1 = document.all ?  document.all.t_AO_inst_appeal_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_year3') // NN6
    		   : null; 
    		   
		tag2 = document.all ?  document.all.t_AO_inst_appeal_success_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_success_year3') // NN6
    		   : null; 
    		   
		tag3 = document.all ?  document.all.t_AO_inst_appeal_failed_year3 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_failed_year3') // NN6
    		   : null;     		       		   
    		   		
		appeal 	= eval('document.forms[0].AO_inst_appeal_year3[2].checked');

		for (var i=0; i<document.forms[0].AO_inst_appeal_success_year3.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_success_year3[i].checked)  
			{
				found_it1 = document.forms[0].AO_inst_appeal_success_year3[i].value;
			} 
		} 
		
		for (var i=0; i<document.forms[0].AO_inst_appeal_failed_year3.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_failed_year3[i].checked)  
			{
				found_it2 = document.forms[0].AO_inst_appeal_failed_year3[i].value;
			} 
		} 		

		f_ftag	= "AO_inst_appeal_year3[2]";
	}			
	
	else if(flag == 4)
	{
		tag1 = document.all ?  document.all.t_AO_inst_appeal_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_year4') // NN6
    		   : null; 
    		   
		tag2 = document.all ?  document.all.t_AO_inst_appeal_success_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_success_year4') // NN6
    		   : null; 
    		   
		tag3 = document.all ?  document.all.t_AO_inst_appeal_failed_year4 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_failed_year4') // NN6
    		   : null;     		       		   
    		   		
		appeal 	= eval('document.forms[0].AO_inst_appeal_year4[2].checked');

		for (var i=0; i<document.forms[0].AO_inst_appeal_success_year4.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_success_year4[i].checked)  
			{
				found_it1 = document.forms[0].AO_inst_appeal_success_year4[i].value;
			} 
		} 
		
		for (var i=0; i<document.forms[0].AO_inst_appeal_failed_year4.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_failed_year4[i].checked)  
			{
				found_it2 = document.forms[0].AO_inst_appeal_failed_year4[i].value;
			} 
		} 		

		f_ftag	= "AO_inst_appeal_year4[2]";
	}			
	
	else if(flag == 5)
	{
		tag1 = document.all ?  document.all.t_AO_inst_appeal_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_year5') // NN6
    		   : null; 
    		   
		tag2 = document.all ?  document.all.t_AO_inst_appeal_success_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_success_year5') // NN6
    		   : null; 
    		   
		tag3 = document.all ?  document.all.t_AO_inst_appeal_failed_year5 // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_appeal_failed_year5') // NN6
    		   : null;     		       		   
    		   		
		appeal 	= eval('document.forms[0].AO_inst_appeal_year5[2].checked');

		for (var i=0; i<document.forms[0].AO_inst_appeal_success_year5.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_success_year5[i].checked)  
			{
				found_it1 = document.forms[0].AO_inst_appeal_success_year5[i].value;
			} 
		} 
		
		for (var i=0; i<document.forms[0].AO_inst_appeal_failed_year5.length; i++)  
		{ 
			if (document.forms[0].AO_inst_appeal_failed_year5[i].checked)  
			{
				found_it2 = document.forms[0].AO_inst_appeal_failed_year5[i].value;
			} 
		} 		

		f_ftag	= "AO_inst_appeal_year5[2]";
	}			
	
	if(appeal == '' && (found_it1 == '' || found_it2 == ''))
	{
		tag1.className = 'tfvHighlight';
		tag2.className = 'tfvHighlight';
		tag3.className = 'tfvHighlight';
		eval('document.forms[0].'+f_ftag+'.focus()');
		alert('Since you indicated that this student was dismissed, please select the appeal status.');
		return false;	
	}		
			
	tag1.className = 'tfvNormal';	
	tag2.className = 'tfvNormal';	
	tag3.className = 'tfvNormal';	
	return true;	
}         		

//***********************************************************

function MatchComplaintValue()
{
	var a = MatchStuComplaintValue(1); if(!a) return false;
	var b = MatchStuComplaintValue(2); if(!b) return false;
	var c = MatchStuComplaintValue(3); if(!c) return false;
	var d = MatchStuComplaintValue(4); if(!d) return false;
	var e = MatchStuComplaintValue(5); if(!e) return false;	
	
	var f = MatchStuComplaintValue(6); if(!f) return false;
	var g = MatchStuComplaintValue(7); if(!g) return false;
	var h = MatchStuComplaintValue(8); if(!h) return false;
	var i = MatchStuComplaintValue(9); if(!i) return false;
	var j = MatchStuComplaintValue(10); if(!j) return false;	
	var k = MatchStuComplaintValue(11); if(!k) return false;
	var l = MatchStuComplaintValue(12); if(!l) return false;
	var m = MatchStuComplaintValue(13); if(!m) return false;	

	
	return true;
}	

//***********************************************************

function MatchStuComplaintValue(flag)
{
	var total = parseInt(document.forms[0].AO_inst_Stu_compl_grade_formal.value);
	var a = document.forms[0].AO_inst_Stu_compl_grade_stufavor.value;
	var b = document.forms[0].AO_inst_Stu_compl_grade_progfavor.value;
	var c = document.forms[0].AO_inst_Stu_compl_grade_withdrawn.value;
	
	var tag = document.all ?  document.all.t_AO_inst_Stu_Grade_complaints // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Stu_Grade_complaints') // NN6
    		   : null; 
    		   	
	var msg  = 'The total number of Formal Grades Complaints should be equal to sum of Grades Complaints for Student\' Favor, School Favor and Withdrawn.';

	var tag1 = document.all ?  document.all.t_stu_compl_formal // IE4+
    		   : document.getElementById ? document.getElementById('t_stu_compl_formal') // NN6
    		   : null; 

	if(flag >  5)
	{
		tag1 = document.all ?  document.all.t_prog_compl_formal // IE4+
    		   : document.getElementById ? document.getElementById('t_prog_compl_formal') // NN6
    		   : null; 
    	}	   
    	    	
	var f_tag = document.forms[0].AO_inst_Stu_compl_grade_formal;
	
	if(flag == 2)
	{
		total = parseInt(document.forms[0].AO_inst_Stu_compl_course_formal.value);
		a = document.forms[0].AO_inst_Stu_compl_course_stufavor.value;
		b = document.forms[0].AO_inst_Stu_compl_course_progfavor.value;
		c = document.forms[0].AO_inst_Stu_compl_course_withdrawn.value;
	
		msg  = 'The total number of Formal Courses Complaints should be equal to sum of Courses Complaints for Student\' Favor, School Favor and Withdrawn.';

		tag = document.all ?  document.all.t_AO_inst_Stu_Course_complaints // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Stu_Course_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Stu_compl_course_formal;
	}	
	else if(flag == 3)
	{
		total = parseInt(document.forms[0].AO_inst_Stu_compl_instr_gen_formal.value);
		a = document.forms[0].AO_inst_Stu_compl_instr_gen_grade_stufavor.value;
		b = document.forms[0].AO_inst_Stu_compl_instr_gen_progfavor.value;
		c = document.forms[0].AO_inst_Stu_compl_instr_gen_withdrawn.value;
	
		msg  = 'The total number of Formal Instructors \(general issues\) Complaints should be equal to sum of Instructors \(general issues\) Complaints for Student\' Favor, School Favor and Withdrawn.';
		tag = document.all ?  document.all.t_AO_inst_Stu_gen_complaints // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Stu_gen_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Stu_compl_instr_gen_formal;
	}		
	else if(flag == 4)
	{
		total = parseInt(document.forms[0].AO_inst_Stu_compl_Instr_haras_formal.value);
		a = document.forms[0].AO_inst_Stu_compl_Instr_haras_grade_stufavor.value;
		b = document.forms[0].AO_inst_Stu_compl_Instr_haras_progfavor.value;
		c = document.forms[0].AO_inst_Stu_compl_Instr_haras_withdrawn.value;
	
		msg  = 'The total number of Formal Instructors \(harassment issues\) Complaints should be equal to sum of Instructors \(harassment issues\) Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Stu_Instr_haras_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Stu_Instr_haras_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Stu_compl_Instr_haras_formal;
	}			
	else if(flag == 5)
	{
		total = parseInt(document.forms[0].AO_inst_Stu_compl_other_formal.value);
		a = document.forms[0].AO_inst_Stu_compl_other_grade_stufavor.value;
		b = document.forms[0].AO_inst_Stu_compl_other_progfavor.value;
		c = document.forms[0].AO_inst_Stu_compl_other_withdrawn.value;
	
		msg  = 'The total number of Formal Other  Complaints should be equal to sum of Other Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Stu_other_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Stu_other_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Stu_compl_other_formal;
	}			
	
	else if(flag == 6)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_didactic_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_didactic_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_didactic_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_didactic_Withdrawn.value;
	
		msg  = 'The total number of Formal Didactic Courses Complaints should be equal to sum of Formal Didactic Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_Didactic_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_Didactic_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_didactic_formal;
	}			
	
	else if(flag == 7)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_rotation_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_rotation_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_rotation_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_rotation_Withdrawn.value;
	
		msg  = 'The total number of Formal Clinical Rotations Complaints should be equal to sum of Formal  Clinical Rotations Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_rotation_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_rotation_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_rotation_formal;
	}			
	
	else if(flag == 8)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_advise_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_advise_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_advise_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_advise_Withdrawn.value;
	
		msg  = 'The total number of Formal  Student Advising Complaints should be equal to sum of Formal  Student Advising Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_advise_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_advise_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_advise_formal;
	}			
	
	else if(flag == 9)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_policy_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_policy_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_policy_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_policy_Withdrawn.value;
	
		msg  = 'The total number of Formal  Program Policies & Procedures Complaints should be equal to sum of Formal  Program Policies & Procedures Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_policy_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_policy_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_policy_formal;
	}			
	
	else if(flag == 10)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_facility_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_facility_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_facility_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_facility_Withdrawn.value;
	
		msg  = 'The total number of Formal Facilities Complaints should be equal to sum of Formal Facilities Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_facility_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_facility_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_facility_formal;
	}			
	
	else if(flag == 11)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_commu_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_commu_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_commu_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_commu_Withdrawn.value;
	
		msg  = 'The total number of Formal Communication Complaints should be equal to sum of Formal Communication Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_commu_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_commu_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_commu_formal;
	}			
	
	else if(flag == 12)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_standard_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_standard_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_standard_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_standard_Withdrawn.value;
	
		msg  = 'The total number of Formal  Accreditation Standards Complaints should be equal to sum of Formal  Accreditation Standards Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_standard_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_standard_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_standard_formal;
	}			
	
	else if(flag == 13)
	{
		total = parseInt(document.forms[0].AO_inst_Prog_compl_other_formal.value);
		a = document.forms[0].AO_inst_Prog_compl_other_StuFavor.value;
		b = document.forms[0].AO_inst_Prog_compl_other_ProgFavor.value;
		c = document.forms[0].AO_inst_Prog_compl_other_Withdrawn.value;
	
		msg  = 'The total number of Formal Other Complaints should be equal to sum of Formal Other Complaints for Student\' Favor, School Favor and Withdrawn.';
		
		tag = document.all ?  document.all.t_AO_inst_Prog_other_complaints// IE4+
    		   : document.getElementById ? document.getElementById('t_AO_inst_Prog_other_complaints') // NN6
    		   : null; 

		f_tag = document.forms[0].AO_inst_Prog_compl_other_formal;
	}			
	
	a = parseInt(a) ? parseInt(a): 0;
	b = parseInt(b) ? parseInt(b): 0;
	c = parseInt(c) ? parseInt(c): 0;
	
	var ftotal= a + b + c;

	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			f_tag.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;
	}	
	return true;
}	

//***********************************************************

function CheckTotalGraduate()
{
	var total = parseInt(document.forms[0].AO_Total_Graduates.value);
	var a = document.forms[0].AO_Grad_PostBac.value;
	var b = document.forms[0].AO_Grad_PostMasCampus.value;
	var c = document.forms[0].AO_Grad_PostMasDistance.value;
	
	var tag = document.all ?  document.all.t_AO_Total_Graduates // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_Total_Graduates') // NN6
    		   : null; 
    		   	
	var msg  = 'The total number of Formal Grades Complaints should be equal to sum of Grades Complaints for Student\' Favor, School Favor and Withdrawn.';

	var tag1 = document.all ?  document.all.t_AO_Grad_Category // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_Grad_Category') // NN6
    		   : null; 
    	
   	   
	a = parseInt(a) ? parseInt(a): 0;
	b = parseInt(b) ? parseInt(b): 0;
	c = parseInt(c) ? parseInt(c): 0;
	
	var ftotal= a + b + c;

	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			document.forms[0].AO_Total_Graduates.focus();
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;
	}	
}	    	

//***********************************************************	   

function MatchClinicalHours(flag)
{
	var total = parseInt(document.forms[0].AO_Clinical_Hours_Total.value);
	
	var a = document.forms[0].AO_Clinical_Hours_Year1.value;
	var b = document.forms[0].AO_Clinical_Hours_Year2.value;
	var c = document.forms[0].AO_Clinical_Hours_Year3.value;
	var d = document.forms[0].AO_Clinical_Hours_Year4.value;
	
	var tag = document.all ?  document.all.t_AO_Clinical_Hours // IE4+
    		   : document.getElementById ? document.getElementById('t_AO_Clinical_Hours') // NN6
    		   : null; 

	var tag1 = document.all ?  document.all.total_hours // IE4+
    		   : document.getElementById ? document.getElementById('total_hours') // NN6
    		   : null; 
    		    	
    	if(flag == 1)
    	{	   	
		tag1 = document.all ?  document.all.t_total_hours // IE4+
    		   : document.getElementById ? document.getElementById('t_total_hours') // NN6
    		   : null; 
    	}	   

	var msg  = 'The total number of Hours should be equal to sum of clinical hours spent in all 4 years.';
	
	var f_tag= 'AO_Clinical_Hours_Total';
	
	if(flag == 2)
	{
		total = parseInt(document.forms[0].AO_Clinical_Hours_Age2_Total.value);
		
		a = document.forms[0].AO_Clinical_Hours_Age2_Year1.value;
		b = document.forms[0].AO_Clinical_Hours_Age2_Year2.value;
		c = document.forms[0].AO_Clinical_Hours_Age2_Year3.value;
		d = document.forms[0].AO_Clinical_Hours_Age2_Year4.value;
		
		tag = document.all ?  document.all.t_AO_Clinical_Hours_Age2 // IE4+
    		: document.getElementById ? document.getElementById('t_AO_Clinical_Hours_Age2') // NN6
    		: null; 
    			
		msg  = 'The total number of clinical hours spent with Newborns and infants up to the age of 2 should be equal to sum of clinical hours spent in all 4 years for the same category.';
		
		f_tag= 'AO_Clinical_Hours_Age2_Total';
	}	
	else if(flag == 3)
	{
		total = parseInt(document.forms[0].AO_Clinical_Hours_Age3_12_Total.value);
		
		a = document.forms[0].AO_Clinical_Hours_Age3_12_Year1.value;
		b = document.forms[0].AO_Clinical_Hours_Age3_12_Year2.value;
		c = document.forms[0].AO_Clinical_Hours_Age3_12_Year3.value;
		d = document.forms[0].AO_Clinical_Hours_Age3_12_Year4.value;
		
		tag = document.all ?  document.all.t_AO_Clinical_Hours_Age3_12 // IE4+
    		: document.getElementById ? document.getElementById('t_AO_Clinical_Hours_Age3_12') // NN6
    		: null; 
    			
		msg  = 'The total number of clinical hours spent with Children from 3 - 12 should be equal to sum of clinical hours spent in all 4 years for the same category.';
		
		f_tag= 'AO_Clinical_Hours_Age3_12_Total';
	}		
	else if(flag == 4)
	{
		total = parseInt(document.forms[0].AO_Clinical_Hours_Age13_19_Total.value);
		
		a = document.forms[0].AO_Clinical_Hours_Age13_19_Year1.value;
		b = document.forms[0].AO_Clinical_Hours_Age13_19_Year2.value;
		c = document.forms[0].AO_Clinical_Hours_Age13_19_Year3.value;
		d = document.forms[0].AO_Clinical_Hours_Age13_19_Year4.value;
		
		tag = document.all ?  document.all.t_AO_Clinical_Hours_Age13_19 // IE4+
    		: document.getElementById ? document.getElementById('t_AO_Clinical_Hours_Age13_19') // NN6
    		: null; 
    			
		msg  = 'The total number of clinical hours spent with  Adolescents from 13 - 19 should be equal to sum of clinical hours spent in all 4 years for the same category.';
		
		f_tag= 'AO_Clinical_Hours_Age13_19_Total';
	}			
	else if(flag == 5)
	{
		total = parseInt(document.forms[0].AO_Clinical_Hours_Age20_65_Total.value);
		
		a = document.forms[0].AO_Clinical_Hours_Age20_65_Year1.value;
		b = document.forms[0].AO_Clinical_Hours_Age20_65_Year2.value;
		c = document.forms[0].AO_Clinical_Hours_Age20_65_Year3.value;
		d = document.forms[0].AO_Clinical_Hours_Age20_65_Year4.value;
		
		tag = document.all ?  document.all.t_AO_Clinical_Hours_Age20_65 // IE4+
    		: document.getElementById ? document.getElementById('t_AO_Clinical_Hours_Age20_65') // NN6
    		: null; 
    			
		msg  = 'The total number of clinical hours spent with Adults from 20 - 65 should be equal to sum of clinical hours spent in all 4 years for the same category.';
		
		f_tag= 'AO_Clinical_Hours_Age20_65_Total';
	}			
	
	else if(flag == 6)
	{
		total = parseInt(document.forms[0].AO_Clinical_Hours_Age_over65_Total.value);
		
		a = document.forms[0].AO_Clinical_Hours_Age_over65_Year1.value;
		b = document.forms[0].AO_Clinical_Hours_Age_over65_Year2.value;
		c = document.forms[0].AO_Clinical_Hours_Age_over65_Year3.value;
		d = document.forms[0].AO_Clinical_Hours_Age_over65_Year4.value;
		
		tag = document.all ?  document.all.t_AO_Clinical_Hours_Age_over65 // IE4+
    		: document.getElementById ? document.getElementById('t_AO_Clinical_Hours_Age_over65') // NN6
    		: null; 
    			
		msg  = 'The total number of clinical hours spent with  Older Adults over the age of 65 should be equal to sum of clinical hours spent in all 4 years for the same category.';
		
		f_tag= 'AO_Clinical_Hours_Age_over65_Total';
	}			
	
	a = parseInt(a) ? parseInt(a): 0;
	b = parseInt(b) ? parseInt(b): 0;
	c = parseInt(c) ? parseInt(c): 0;
	d = parseInt(d) ? parseInt(d): 0;	
	
	var ftotal= a + b + c + d;

	if(!isNaN(total) && !isNaN(ftotal))
	{
		if(total != ftotal)
		{
			tag.className = 'tfvHighlight';
			tag1.className = 'tfvHighlight';
			alert(msg);
			eval('document.forms[0].'+f_tag+'.focus()');
			return false;
		}
		tag.className = 'tfvNormal';
		tag1.className = 'tfvNormal';
		return true;
	}	
	return true;			
}	

// support for checkbox as radio button feature
    function reset_checkbox(set_value, field_name) {

        var elements = document.getElementsByName(field_name);

        for (i=0; i < elements.length; i++)
        {
            if (elements[i].value != set_value && elements[i].type == 'checkbox') {
                elements[i].checked = false;
            }
        }
        return true;
    }

// total rows for tuition survey
function total_elements (target_name, source1_name, source2_name) {
    // Get form elements
    var target      = document.getElementById(target_name);
    var source1     = document.getElementById(source1_name);

    // Setup regular expressions...
    var semester_re    = new RegExp('_semester_cost');
    var quarter_re     = new RegExp('_quarter_cost');
    var credit_cost_re = new RegExp('_credit_hour_cost');
    var credit_year_re = new RegExp('_credits_per_year');

    //return value that will be displayed at target
    var sum;

    if (semester_re.test(source1.id) && source1.value) {
        sum = parseInt(source1.value, 10) * 2;
    }

    if (quarter_re.test(source1.id) && source1.value) {
        sum = parseInt(source1.value, 10) * 3;
    }

    if (credit_cost_re.test(source1.id) ||
        credit_year_re.test(source1.id)) {

        var source2     = document.getElementById(source2_name);
        // Do not calculate unless all of column B has been filled in
        if (!source2) return false;
        sum = parseInt(source1.value, 10) * parseInt(source2.value, 10);
    }
    if (isNaN(sum)) sum = '';
    
    target.value = sum;
    return true;
}

// rewrote above function with the following enhancements
// - only requires a namespace arg instead of multiple args as before
// - will sum up everything, old function just did calculations for most recent change [usually confusing users]
// - could add validation so only one type of total is allowed [with appropriate communication with user]
//   but this has not been requested, so it has not been added
function tuition_total_row( namespace ) {

  if ( ( ! namespace ) || ( namespace.length < 1 ) ) {
    return false;
  }

  //var addend_suffixes = [ '_semester_cost', '_quarter_cost', '_credit_hour_cost', '_credits_per_year' ];
  var addend_suffixes = [ '_semester_cost', '_quarter_cost' ];
  
  
  var total = 0;
  var credit_hours = 0;
  var i;
  for( i = 0; i < addend_suffixes.length; i++ ) {
    var tmp_id = namespace + addend_suffixes[i];
    var tmp_elem = document.getElementById( tmp_id );

    if ( ( ! tmp_elem ) || ( ! tmp_elem.value ) ) { continue; }

    var tmp_value = parseInt( tmp_elem.value );

    if ( isNaN( tmp_value ) ) { continue; }
 
    if( addend_suffixes[i] == '_semester_cost' ) {
      tmp_value *= 2;
    }
    else if ( addend_suffixes[i] == '_quarter_cost' ) {
      tmp_value *= 3;
    }
    // just grab the hours here- don't add to total
    else if ( addend_suffixes[i] == '_credit_hour_cost' ) {
      credit_hours = tmp_value;
      continue;
    }
    else if ( ( addend_suffixes[i] == '_credits_per_year' ) && ( credit_hours ) && ( tmp_value ) ) {
      tmp_value *= credit_hours;
      // reset
      credit_hours = 0;
    }
    total += tmp_value;
  }

  var total_id = namespace + '_total';
  var total_elem = document.getElementById( total_id );

  if ( ! total_elem ) { return false; }

  total_elem.value = total;
  return true;
}


// do not allow submittal if none is checked with other items
function pharm_organizations_none_check() {

  // Pharm_Organizations Checkbox Group
  var po_cg = document.forms[0].elements['pharm_organizations'];
  var none_checked = false;
  var check_count = 0;

  for ( var i = 0; i < po_cg.length; i++ ) {

    if ( po_cg[i].checked ) {
      
      if ( po_cg[i].value == '11' ) {
        none_checked = true;
      }
      
      check_count += 1;
    }
  }

  // error condition
  if ( ( none_checked ) && ( check_count > 1 ) ) {
    var msg = 'If you check "None" for question 10, you cannot check any other boxes.' + "\n";
    msg += 'Please correct and resubmit.';
    
    alert( msg );
    return false;
  }
  
  return true;

}
