/*  TAP Estimator for the 2010-11 Fiscal Year. */  /*  This JavaScript file calls functions in the shared-functions.js file.  */     var txtMessage="";  function EstimateTap(bFullTap, NTB, Tuition, Schedule, UpperCut, SchoolType, StudentsMaritalStatus, StudentsFamilySize)    {      // Validate the NTB, Tuition, and Schedule before calling this function !            var Award = 0;      var MinAward = 0;      var MaxAward = 1.00 * Tuition; // Increased from 95% for 2001-2002      var MaxAwardThreshold= 0;      var Reduction = 0;      var bIndependentMarriedNoKids = false;            if (DebugFlag)	        {          txtMessage   = "EstimateTap()\n";          txtMessage += "\ndocument.lastModified = "+document.lastModified;          txtMessage += "\ndocument.title = "+document.title;          txtMessage += "\nbFullTap = "+bFullTap;          txtMessage += "\nNTB = "+NTB;          txtMessage += "\nTuition = "+Tuition;          txtMessage += "\nSchedule = "+Schedule;          txtMessage += "\nSchoolType = "+SchoolType;          txtMessage += "\nStudentsMaritalStatus = "+StudentsMaritalStatus;          txtMessage += "\nStudentsFamilySize = "+StudentsFamilySize;          if (bFullTap) txtMessage += "\nStudentIsIndependant = "+StudentIsIndependant;          txtMessage += "\n\nPreset Values:";          txtMessage += "\nAward = "+Award;          txtMessage += "\nMinAward = "+MinAward;          txtMessage += "\nMaxAward = 1.00 * Tuition = "+MaxAward;          txtMessage += "\nMaxAwardThreshold = "+MaxAwardThreshold;          txtMessage += "\nReduction = "+Reduction;          alert(txtMessage);          txtMessage="";		// Reset it for next time.        }       if (bFullTap)      	{            if ( (StudentIsIndependant==1)&(StudentsMaritalStatus==0)&(StudentsFamilySize==2) ) bIndependentMarriedNoKids = true;		  }      if (Schedule=="-") return false;      if (Schedule=="A") // schedule A          {            MaxAwardThreshold = 3575;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold;            //New for 2000-2001, Calculate the MinAward Based on NTB            if (NTB<=80000) MinAward = 500;		//Per 2002-03 budget MinAward=500 if NTB <= 80000            //else if (NTB<=70000) MinAward = 325;	//no longer applies as of 2002-03 budget            //else if (NTB<=80000) MinAward = 275;	//no longer applies as of 2002-03 budget            //Calculate the Reduction            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=18000) Reduction = 280+0.10*(NTB-11000);			else if (NTB<=80000) Reduction = 980+0.12*(NTB-18000); // Increased for 2000-2001			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="B") // schedule B - No longer used for 2000-2001          {            MaxAwardThreshold = 3575;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 100;            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=18000) Reduction = 280+0.10*(NTB-11000);			else if (NTB<=42500) Reduction = 980+0.12*(NTB-18000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="C") // schedule C          {            MaxAwardThreshold = 3025;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold;//            MinAward = 100;            MinAward = 500;		// 2010-11 budget (or before).            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=18000) Reduction = 280+0.10*(NTB-11000);			else if (NTB<=40000) Reduction = 980+0.12*(NTB-18000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }	      if (DebugFlag)	        {	          txtMessage   = "EstimateTap()\nSchedule C\n";	          txtMessage += "\nNTB = "+NTB;	          txtMessage += "\nMaxAward = "+MaxAward;	          txtMessage += "\nMaxAwardThreshold = "+MaxAwardThreshold;	          txtMessage += "\nMinAward = "+MinAward;	          txtMessage += "\nReduction= "+Reduction;	          alert(txtMessage);	          txtMessage="";		// Reset it for next time.	      }		  }      if (Schedule=="D") // schedule D          {            MaxAwardThreshold = 4125;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            //New for 2000-2001, Calculate the MinAward Based on NTB            if (NTB<=80000) MinAward = 500;		//Per 2002-03 budget MinAward=500 if NTB <= 80000            //Calculate the Reduction            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=18000) Reduction = 280+0.10*(NTB-11000);			else if (NTB<=80000) Reduction = 980+0.12*(NTB-18000); // Increased from 50500 for 2000-2001			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }	  if (Schedule=="E") // schedule E, New for 2000-2001           {            MaxAwardThreshold = 5000;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            //Calculate the MinAward Based on NTB            if (NTB<=80000) MinAward = 500;		//Per 2002-03 budget MinAward=500 if NTB <= 80000            //Calculate the Reduction            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=18000) Reduction = 280+0.10*(NTB-11000);			else if (NTB<=80000) Reduction = 980+0.12*(NTB-18000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="F") // schedule F          {            MaxAwardThreshold = 800;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 100;            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=34250) Reduction = 280+0.10*(NTB-11000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="G") // schedule G          {            MaxAwardThreshold = 800;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 100;            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=42500) Reduction = 280+0.10*(NTB-11000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="H") // schedule H          {            MaxAwardThreshold = 800;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 100;            if (NTB<=7000) Reduction = 0;			else if (NTB<=11000) Reduction = 0.07*(NTB-7000);			else if (NTB<=50500) Reduction = 280+0.10*(NTB-11000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="K") // schedule K          {            MaxAwardThreshold = 2450;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 500;  // Increased from 425 in 2001-02 budget            if (NTB<=3000) Reduction = 0;			else if (NTB<=10000) Reduction = 0.31*(NTB-3000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="L") // schedule L          {            MaxAwardThreshold = 2575;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 500; // Increased from 425 in 2001-02 budget            if (NTB<=3000) Reduction = 0;			else if (NTB<=10000) Reduction = 0.31*(NTB-3000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="M") // schedule M          {            MaxAwardThreshold = 3025;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 500; // Increased from 425 in 2001-02 budget            if (NTB<=3000) Reduction = 0;			else if (NTB<=10000) Reduction = 0.31*(NTB-3000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }	      if (DebugFlag)	        {	          txtMessage   = "EstimateTap()\nSchedule M\n";	          txtMessage += "\nNTB = "+NTB;	          txtMessage += "\nMaxAward = "+MaxAward;	          txtMessage += "\nMaxAwardThreshold = "+MaxAwardThreshold;	          txtMessage += "\nMinAward = "+MinAward;	          txtMessage += "\nReduction= "+Reduction;	          alert(txtMessage);	          txtMessage="";		// Reset it for next time.	      }		  }      if (Schedule=="P") // schedule P          {            MaxAwardThreshold = 640;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 100;            if (NTB<=3000) Reduction = 0;			else if (NTB<=10000) Reduction = 0.31*(NTB-3000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="U") // schedule U          {            MaxAwardThreshold = 550;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 75;            if (NTB<=2000) Reduction = 0;			else if (NTB<=20000) Reduction = 0.077*(NTB-2000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      if (Schedule=="V") // schedule V          {            MaxAwardThreshold = 550;            if (MaxAward > MaxAwardThreshold) MaxAward=MaxAwardThreshold            MinAward = 75;            if (NTB<=1000) Reduction = 0;			else if (NTB<=5666) Reduction = 0.26*(NTB-1000);			else // No Award			  {			    Reduction = MaxAward;			    MinAward = 0;			  }		  }      txtMessage="EstimateTap()\n";		// Reset message.      if (UpperCut==1 && (Schedule!="U" || Schedule!="V")) Reduction = Reduction + 100;  //Only applies to UnderGrads & was Reduced from 150 for 2001-2002      Award=MaxAward-Reduction;      if (Award < MinAward) Award=MinAward;      if ((SchoolType==1)&!(bIndependentMarriedNoKids)) // 2 year Degree        {            if (DebugFlag & ((Schedule=="D") | (Schedule=="E"))) txtMessage += "\nMaxAward before 2 year degree adjustment= "+MaxAward;            if ((Schedule=="D") | (Schedule=="E")) MaxAward = 4000;         }      if (Award > MaxAward) Award=MaxAward;      if (DebugFlag) txtMessage += "\nAnnual Award Before Rounding = "+Award;      Award = Math.ceil(Award); // Round Annual Award up to nearest Dollar Amount per Brian Matthews      if (DebugFlag)  txtMessage += "\nAnnual Award before $75 adjustment = "+Award;      Award = Award - 75;	// Per 2010-11 Budget, subtract $75 from all annual awards.      if (Award < 0) Award=0;  // No negative awards.      if (DebugFlag)        {          txtMessage += "\nMinAward = "+MinAward;          txtMessage += "\nMaxAward = "+MaxAward;          txtMessage += "\nAward = "+Award;          alert(txtMessage);          txtMessage="";		// Reset it for next time.        }      document.TapAward.Annual.value = "$" + FormatCurrency(Award);      document.TapAward.Semester.value = "$" + FormatCurrency(Award/2);      document.TapAward.Trimester.value = "$" + FormatCurrency(Award/3);      window.location = "#award";      return true;    }      function QuickValidateAndEstimate()    {      if (IsNonNegative(document.QuickTAP.NetTaxableBalance.value))        {  	      if (IsPositive(document.QuickTAP.AnnualTuition.value))	        {	          EstimateTap(false, parseInt(document.QuickTAP.NetTaxableBalance.value), parseInt(document.QuickTAP.AnnualTuition.value), document.QuickTAP.TapSchedule.value, 0, document.QuickTAP.SchoolType.selectedIndex, 0, 0);	        }	      else	        {         		txtMessage = "You must enter a positive dollar amount for Question #4.";	          alert(txtMessage);	          SetFocus(document.QuickTAP.AnnualTuition);	        }	    }	  else	    {	      txtMessage = "You must enter a non-negative dollar amount for Question #1.";	      alert(txtMessage);	      SetFocus(document.QuickTAP.NetTaxableBalance);	    }	  return true;    }  function ResetAward()    {      document.TapAward.Annual.value = "TBD";      document.TapAward.Semester.value = "TBD";      document.TapAward.Trimester.value = "TBD";      }    function FullTapSchedule(SchoolType,FinancialStatus,FirstReceived, StudentsMaritalStatus, StudentsFamilySize)    {      var Schedule = "";      var bDegree = false;      var bIndependentMarriedNoKids = false;            if (DebugFlag)	        {          txtMessage="FullTapSchedule\n";		// Reset message.          txtMessage += "\nSchoolType = " + SchoolType;          txtMessage += "\nFinancialStatus = " + FinancialStatus;          txtMessage += "\nFirstReceived = " + FirstReceived;          txtMessage += "\nStudentsMaritalStatus = " + StudentsMaritalStatus;          txtMessage += "\nStudentsFamilySize = " + StudentsFamilySize;          txtMessage += "\nStudentIsIndependant = "+StudentIsIndependant;          alert(txtMessage);        }       if ( (SchoolType==0)|(SchoolType==1)|(SchoolType==2) ) bDegree = true;	// Degree      if ( (FinancialStatus==1)&(StudentsMaritalStatus==0)&(StudentsFamilySize==2) ) bIndependentMarriedNoKids = true;      if (DebugFlag)	        {          txtMessage="FullTapSchedule\n";		// Reset message.          txtMessage += "\nbDegree = " + bDegree;          txtMessage += "\nbIndependentMarriedNoKids = " + bIndependentMarriedNoKids;          alert(txtMessage);          txtMessage="";		// Reset it for next time.        }       if (bDegree) // Degree            {              if (bIndependentMarriedNoKids) // Independent, married w/ no dependents                    {                       Schedule = "C";                     }               else if ( (FinancialStatus==1)&!(StudentsMaritalStatus==0)&(StudentsFamilySize==1) ) // Independent, unmarried w/ no dependents                    {                           if(FirstReceived==0) Schedule = "M"; //2000-2001to present year                          if(FirstReceived==1) Schedule = "M"; //1994-1995 to 1999-2000                          if(FirstReceived==2) Schedule = "L"; //1992-1993 or 1993-1994                          if(FirstReceived==3) Schedule = "K"; //1990-1991 or 1991-1992                          if(FirstReceived==4) Schedule = "K"; //1989-1990                          if(FirstReceived==5) Schedule = "K"; //1988-1989 or Prior                     }              else  // Dependent or Independent w/ dependents                    {                          if(FirstReceived==0) Schedule = "E"; //2000-2001to present year                          if(FirstReceived==1) Schedule = "D"; //1994-1995 to 1999-2000                          if(FirstReceived==2) Schedule = "A"; //1992-1993 or 1993-1994                          if(FirstReceived==3) Schedule = "A"; //1990-1991 or 1991-1992                          if(FirstReceived==4) Schedule = "A"; //1989-1990                          if(FirstReceived==5) Schedule = "A"; //1988-1989 or Prior                    }            }      else // Non-Degree            {               if ( (FinancialStatus==1)&!(StudentsMaritalStatus==0)&(StudentsFamilySize==1) )  // Independent, unmarried w/ no dependents                    {                      Schedule = "P";                     }              else  // Dependent, Independent w/ dependents, or Independent, married w/ no dependents                    {                          if (FirstReceived==0) Schedule = "H"; //2000-2001to present year                          if (FirstReceived==1) Schedule = "H"; //1994-1995 to 1999-2000                          if (FirstReceived==2) Schedule = "G"; //1992-1993 or 1993-1994                          if (FirstReceived==3) Schedule = "H"; //1990-1991 or 1991-1992                          if (FirstReceived==4) Schedule = "G"; //1989-1990                          if (FirstReceived==5) Schedule = "F"; //1988-1989 or Prior                     }            }      if (DebugFlag) alert("FullTapSchedule()\n\nSchedule = "+Schedule);        return Schedule    }  function NYSExemption(MaritalStatus, FamilySize)    {      var temp1=1;      if (MaritalStatus==0) temp1=2; //Married      var temp2 = FamilySize - temp1      var NYSE = 1000* Math.max(temp2,0)      if (DebugFlag) alert("NYSExemption()\n\nNYSE = "+NYSE);      return NYSE;    }    function NYSDeduction(MaritalStatus, FinancialStatus, FamilySize)    {      var NYSD = 0;      if (MaritalStatus==0)//Married            {              NYSD=15000            }          else //Not married            {              if (FinancialStatus==0) //Dependent                    {                      NYSD=3000                    }                  else //Independent                    {                      if (parseInt(FamilySize)-1>0) NYSD=10500;                      else NYSD=7500;                     }            }      if (DebugFlag) alert("NYSDeduction()\n\nNYSD = "+NYSD);      return NYSD;    }  function KnowSNTIBlur()    {      if(document.FullTap.KnowStudentsNTI.selectedIndex==0)            {              StudentNTIFlag = false;              txtMessage = "Since you answered 'No', the NTI will be estimated based on your answers to the next few questions.";              alert(txtMessage);              document.FullTap.StudentsNTI.readOnly = true;              document.FullTap.StudentsAGI.readOnly = false;              SetFocus(document.FullTap.StudentsAGI);            }          else            {              StudentNTIFlag = true;              txtMessage = "Since you answered 'Yes', we'll skip the next question and enter the NTI.";              alert(txtMessage);              document.FullTap.StudentsNTI.readOnly = false;              document.FullTap.StudentsAGI.readOnly = true;              SetFocus(document.FullTap.StudentsNTI);            }    }  function KnowPNTIBlur()    {      if(document.FullTap.KnowParentsNTI.selectedIndex==0)            {              ParentNTIFlag = false;              txtMessage = "Since you answered 'No', the NTI will be estimated based on your answers to the next few questions.";              alert(txtMessage);              document.FullTap.ParentsNTI.readOnly = true;              document.FullTap.ParentsAGI.readOnly=false;              SetFocus(document.FullTap.ParentsAGI);            }          else            {              ParentNTIFlag = true;              txtMessage = "Since you answered 'Yes', we'll skip the next question and enter the NTI.";              alert(txtMessage);              document.FullTap.ParentsNTI.readOnly = false;              document.FullTap.ParentsAGI.readOnly=true;              SetFocus(document.FullTap.ParentsNTI);            }    }   function EstimateStudentsNTI(SAGI, MaritalStatus, FamilySize, FinancialStatus)    {      var SNTI = SAGI-NYSDeduction(MaritalStatus, FinancialStatus, FamilySize);      if (FinancialStatus==1) SNTI = SNTI - NYSExemption(MaritalStatus, FamilySize);      if (SNTI<0) SNTI=0;      if (DebugFlag) alert("EstimateStudentsNTI()\n\nSNTI = "+SNTI);      return SNTI;    }      function EstimateParentsNTI(PAGI, MaritalStatus, FamilySize)    {      var PNTI = PAGI - NYSDeduction(MaritalStatus,1,2) - NYSExemption(MaritalStatus, FamilySize);      if (PNTI<0) PNTI=0;      if (DebugFlag) alert("EstimateParentsNTI()\n\nPNTI = "+PNTI);      return PNTI;    }    function CalculateNTB(Grad, PNTI, SNTI, FinancialStatus, FullTimers, ChildSupport)    {      var NTB = SNTI;      if (FinancialStatus==0) NTB=NTB+PNTI  //Include Parents income for Dependent Students      if(Grad==0)  //Undergrad            {              if (FullTimers>0) NTB = NTB - (2000 * FullTimers + 1000);            }          else  //Graduate            {              NTB=NTB/(FullTimers+1);            }      if (FinancialStatus==0) NTB=NTB+ChildSupport      if (DebugFlag) alert("CalculateNTB()\n\nNTB = "+NTB);      return NTB;    }    function ResetFields()    {      StudentNTIFlag = false;       ParentNTIFlag = false;      document.FullTap.ParentsNTI.readOnly=true;      document.FullTap.StudentsNTI.readOnly=true;       document.FullTap.StudentsAGI.readOnly = false;      document.FullTap.StudentsMaritalStatus.disabled = false;      document.FullTap.StudentsFamilySize.readOnly = false;      document.FullTap.ParentsAGI.readOnly=false;      document.FullTap.ParentsMaritalStatus.disabled=false;      document.FullTap.ParentsFamilySize.readOnly=false;    }     function FullValidateAndEstimate()    {       if (FullValidate()) return FullEstimate();       return false;    }      function FullValidate()    {      StudentIsIndependant = IsStudentIndependent(false);      if (!IsNonNegative(document.FullTap.NumInCollege.value))        {          txtMessage = "Please enter a non-negative number for the Number in College.";          alert(txtMessage);          SetFocus(document.FullTap.NumInCollege);          return false;        }      if (!IsNonNegative(document.FullTap.ChildSupport.value))        {          txtMessage = "Please enter a non-negative number for the Child Support.";          alert(txtMessage);          SetFocus(document.FullTap.ChildSupport);          return false;        }      if (!IsPositive(document.FullTap.Tuition.value))        {          txtMessage = "Please enter a positive number for the Tuition.";          alert(txtMessage);          SetFocus(document.FullTap.Tuition);          return false;        }      if (StudentNTIFlag)        {            if(!IsNonNegative(document.FullTap.StudentsNTI.value))             {              txtMessage = "Please enter a non-negative number for the Student's NTI.";              alert(txtMessage);              SetFocus(document.FullTap.StudentsNTI);              return false;            }          }      else        {          if(!IsNonNegative(document.FullTap.StudentsAGI.value))            {              txtMessage = "Please enter a non-negative number for the Student's AGI.";              alert(txtMessage);              SetFocus(document.FullTap.StudentsAGI);              return false;            }          if(!IsNonNegative(document.FullTap.StudentsFamilySize.value))            {              txtMessage = "Please enter a non-negative number for the Student's Family Size.";              alert(txtMessage);              SetFocus(document.FullTap.StudentsFamilySize);              return false;            }           }      if (ParentNTIFlag)        {            if(!IsNonNegative(document.FullTap.ParentsNTI.value))             {              txtMessage = "Please enter a non-negative number for the Parent's NTI.";              alert(txtMessage);              SetFocus(document.FullTap.ParentsNTI);              return false;            }          }      else        {          if(!IsNonNegative(document.FullTap.ParentsAGI.value))            {              txtMessage = "Please enter a non-negative number for the Parent's AGI.";              alert(txtMessage);              SetFocus(document.FullTap.ParentsAGI);              return false;            }          if(!IsNonNegative(document.FullTap.ParentsFamilySize.value))            {              txtMessage = "Please enter a non-negative number for the Parent's Family Size.";              alert(txtMessage);              SetFocus(document.FullTap.ParentsFamilySize);              return false;            }           }      return true;  //If it got this far it's all good    }      function FullEstimate()    {      //Validate all the inputs to these functions first !      var iSchoolType = document.FullTap.SchoolType.selectedIndex;      var iStudentsMaritalStatus = document.FullTap.StudentsMaritalStatus.selectedIndex;      var iStudentsFamilySize = parseInt(document.FullTap.StudentsFamilySize.value);      if (DebugFlag)	        {          txtMessage   = "FullEstimate()\n";          txtMessage += "\niSchoolType = "+iSchoolType;          txtMessage += "\niStudentsMaritalStatus = "+iStudentsMaritalStatus;          txtMessage += "\niStudentsFamilySize = "+iStudentsFamilySize;          txtMessage += "\nParentNTIFlag = "+ParentNTIFlag;          txtMessage += "\nStudentNTIFlag = "+StudentNTIFlag;          txtMessage += "\nStudentIsIndependant = "+StudentIsIndependant;          alert(txtMessage);          txtMessage="";		// Reset it for next time.        }       if (ParentNTIFlag) var PNTI=parseInt(document.FullTap.ParentsNTI.value);      else        {          var PNTI = EstimateParentsNTI(parseInt(document.FullTap.ParentsAGI.value), document.FullTap.ParentsMaritalStatus.selectedIndex, parseInt(document.FullTap.ParentsFamilySize.value));          document.FullTap.ParentsNTI.value = FormatCurrency(PNTI);        }      //Validate all the inputs to these functions first !      if (StudentNTIFlag) var SNTI=parseInt(document.FullTap.StudentsNTI.value);      else        {           var SNTI = EstimateStudentsNTI(parseInt(document.FullTap.StudentsAGI.value), iStudentsMaritalStatus, iStudentsFamilySize, StudentIsIndependant);          document.FullTap.StudentsNTI.value = FormatCurrency(SNTI);        }      var NTB = CalculateNTB(0, PNTI, SNTI, StudentIsIndependant, parseInt(document.FullTap.NumInCollege.value), parseInt(document.FullTap.ChildSupport.value));      var Schedule = FullTapSchedule(iSchoolType, StudentIsIndependant,document.FullTap.FirstReceived.selectedIndex, iStudentsMaritalStatus, iStudentsFamilySize);      EstimateTap(true, NTB, parseInt(document.FullTap.Tuition.value), Schedule, document.FullTap.UpperCut.selectedIndex, iSchoolType, iStudentsMaritalStatus, iStudentsFamilySize)    }  function IsStudentIndependent( fromIndepCalc )	{		//This function replaces the question as taken from Able-2		//to minimize the impact on the existing code the following are returned 		//1 if the student is determined to be Independent 		//0 if the student is determined to be dependent		if (fromIndepCalc) {		if (ValidateDate(document.FullTap.StudentDOB))		  { 		    if (CalculateAge(document.FullTap.StudentDOB.value)>=35) return 1;		  }		if (DebugFlag==true) alert("IsStudentIndependent\n\nGot Past 35 years of age test !");		if (document.FullTap.Veteran.selectedIndex==1 && document.FullTap.ClaimedByParents.selectedIndex==0) return 1;		if (DebugFlag==true) alert("IsStudentIndependent\n\nGot Past Veteran test !");		if (document.FullTap.LiveWithParents.selectedIndex==0 && document.FullTap.ClaimedByParents.selectedIndex==0 && document.FullTap.SupportFromParents.selectedIndex==0) return 1;		if (DebugFlag==true) alert("IsStudentIndependent\n\nGot Past other 3 tests !");		return 0 }		else {		return 0 }	}	  function GoToTapPage( c ) {              if (DebugFlag==true) alert("GoToTapPage\n\nc = " + c);          window.location = (c==0) ? "TAP_Award_Estimator_for_Financially_Dependent_Students" : "TAP_Award_Estimator_for_Independent_Students";          // window.location = (c==0) ? "EBEA7258A36915EB852571F00066D58E" : "BB01F098ECF2AE5E852571F000669C3A"          // window.location = (c==0) ? "DC19434D7C548C6985256DAD0056F13B" : "AACF27BADE50D5D885256DAD005DFAF4"      } function RedirectDependentStudents()    {      // returns true if page will be redirected      StudentIsIndependant = IsStudentIndependent(true);      if (DebugFlag) alert("RedirectDependentStudents\n\nStudentIsIndependant=" + StudentIsIndependant);      if (StudentIsIndependant==0)         {          txtMessage = "Your answers indicate that the student is financially dependant so we'll take you to the Dependent Student version of the TAP Estimator.";          alert(txtMessage);          // Should the above message be updated to reflect the current TAP year?          GoToTapPage( 0 );          return true;        }      return false;    }          function SkipIt1(AgeObj)    {      if (ValidateDate(AgeObj))         {          if (CalculateAge(AgeObj.value)>=35)             {              txtMessage = "We have enough information to determine that the student is financially independent so we'll skip to question #6.";              alert(txtMessage);              SetFocus(document.FullTap.FirstReceived);              return true;            }        }      else return false;    }      function SkipIt2()    {      if (document.FullTap.Veteran.selectedIndex==1)         {          txtMessage = "Since the Student is a Veteran, we'll skip to question #5.";          alert(txtMessage);          SetFocus(document.FullTap.ClaimedByParents);        }    }       function FullEstimate2()    {      if (FullValidate2())      {      //Validate all the inputs to these functions first !      var iSchoolType = document.FullTap.SchoolType.selectedIndex;      var iStudentsMaritalStatus = document.FullTap.StudentsMaritalStatus.selectedIndex;      var iStudentsFamilySize = parseInt(document.FullTap.StudentsFamilySize.value);      if (DebugFlag)	        {          txtMessage   = "FullEstimate2()\n";          txtMessage += "\niSchoolType = "+iSchoolType;          txtMessage += "\niStudentsMaritalStatus = "+iStudentsMaritalStatus;          txtMessage += "\niStudentsFamilySize = "+iStudentsFamilySize;          txtMessage += "\nParentNTIFlag = "+ParentNTIFlag;          txtMessage += "\nStudentNTIFlag = "+StudentNTIFlag;          txtMessage += "\nStudentIsIndependant = "+StudentIsIndependant;          alert(txtMessage);          txtMessage="";		// Reset it for next time.        }       if (StudentNTIFlag) var SNTI=parseInt(document.FullTap.StudentsNTI.value);      else        {           var SNTI = EstimateStudentsNTI(parseInt(document.FullTap.StudentsAGI.value), iStudentsMaritalStatus, iStudentsFamilySize, StudentIsIndependant);          document.FullTap.StudentsNTI.value = FormatCurrency(SNTI);        }      var NTB = CalculateNTB(0, 0, SNTI, StudentIsIndependant, parseInt(document.FullTap.NumInCollege.value), 0);      //Put Independent w/dependents on Dependent Schedules      if (DebugFlag) txtMessage = "FullEstimate2()\n";      if (( iStudentsMaritalStatus==0) && (iStudentsFamilySize > 2))        {          //Married w/Dependents          StudentIsIndependant = 0;          if (DebugFlag) txtMessage+="\nMarried w/Dependents";        }      else if ( !(iStudentsMaritalStatus==0) && (iStudentsFamilySize > 1))        {          //Single w/Dependents          StudentIsIndependant = 0;          if (DebugFlag) txtMessage+="\nSingle w/Dependents";        }      else        {          if (DebugFlag) txtMessage+="\nNo Dependents";        }      if (DebugFlag)	        {          txtMessage += "\niStudentsMaritalStatus = "+iStudentsMaritalStatus;          txtMessage += "\niStudentsFamilySize = "+iStudentsFamilySize;          txtMessage += "\nStudentIsIndependant = "+StudentIsIndependant;          alert(txtMessage);          txtMessage="";		// Reset it for next time.        }       var Schedule = FullTapSchedule(iSchoolType, StudentIsIndependant,document.FullTap.FirstReceived.selectedIndex, iStudentsMaritalStatus, iStudentsFamilySize);      EstimateTap(true, NTB, parseInt(document.FullTap.Tuition.value), Schedule, document.FullTap.UpperCut.selectedIndex, iSchoolType, iStudentsMaritalStatus, iStudentsFamilySize)      }    }      function FullValidate2()    {      if (!ValidateDate(document.FullTap.StudentDOB))        {          return false;        }      StudentIsIndependant = IsStudentIndependent(true);            if (!IsNonNegative(document.FullTap.NumInCollege.value))        {          txtMessage = "Please enter a non-negative number for the Number in College.";          alert(txtMessage);          SetFocus(document.FullTap.NumInCollege);          return false;        }      if (!IsPositive(document.FullTap.Tuition.value))        {          txtMessage = "Please enter a positive number for the Tuition.";          alert(txtMessage);          SetFocus(document.FullTap.Tuition);          return false;        }      if (StudentNTIFlag)        {            if(!IsNonNegative(document.FullTap.StudentsNTI.value))             {              txtMessage = "Please enter a non-negative number for the Student's NTI.";              alert(txtMessage);              SetFocus(document.FullTap.StudentsNTI);              return false;            }          }      else        {          if(!IsNonNegative(document.FullTap.StudentsAGI.value))            {              txtMessage = "Please enter a non-negative number for the Student's AGI.";              alert(txtMessage);              SetFocus(document.FullTap.StudentsAGI);              return false;            }          if(!IsNonNegative(document.FullTap.StudentsFamilySize.value))            {              txtMessage = "Please enter a non-negative number for the Student's Family Size.";              alert(txtMessage);              SetFocus(document.FullTap.StudentsFamilySize);              return false;            }           }            return true;  //If it got this far it's all good    }      function ResetFields2()    {      StudentNTIFlag = false;       document.FullTap.StudentsNTI.readOnly=true;       document.FullTap.StudentsAGI.readOnly = false;      document.FullTap.StudentsMaritalStatus.disabled = false;      document.FullTap.StudentsFamilySize.readOnly = false;    }
