﻿// JScript File

   function confirmNew()
   {
        alert("System will clear all the data when you start a new guideline.");
        if(confirm("Are you sure you want to start a new guideline?"))
            return true;
        else
            return false;    
   }
       
   function displayGuideline(flag)
   {
        document.getElementById("tblButtons").style.display = flag;
        document.getElementById("tblProgress").style.display =flag;
        document.getElementById("tblSize").style.display =flag;
        
        if(document.getElementById("mGIImg") != null)
            document.getElementById("mGIImg").style.display =flag;
            
        if(document.getElementById("fGIImg") != null)
            document.getElementById("fGIImg").style.display =flag;
            
        document.getElementById("noChildImg").style.display =flag;
        document.getElementById("demoImg").style.display =flag;
        
        if(document.getElementById("mfAEImg") != null)
             document.getElementById("mfAEImg").style.display =flag;
   }
    function displayGuideline2(flag)
   {
        
        if(document.getElementById("mGIImg") != null)
            document.getElementById("mGIImg").style.display =flag;
            
        if(document.getElementById("fGIImg") != null)
            document.getElementById("fGIImg").style.display =flag;
            
        document.getElementById("noChildImg").style.display =flag;
        document.getElementById("demoImg").style.display =flag;
        
        if(document.getElementById("mfAEImg") != null)
             document.getElementById("mfAEImg").style.display =flag;
   }
   
    function submitForm_Calc003()
    {
        if(document.forms[0].CHIA1_C.value != '' && Number(document.forms[0].CHIA1_C.value)<0)
        {
            alert("please input the valid annual cost to add children in this case to health insurance ");
            document.forms[0].CHIA1_C.focus();
            return(false);
        }
        else if(document.forms[0].CME1_C.value != '' && Number(document.forms[0].CME1_C.value)<0)
        {
            alert("please input the valid annual extraordinary medical expenses ");
            document.forms[0].CME1_C.focus();
            return(false);
        }
        else if(document.forms[0].CCC1_C.value != '' && Number(document.forms[0].CCC1_C.value)<0)
        {
            alert("please input the valid annual reasonable childcare costs ");
            document.forms[0].CCC1_C.focus();
            return(false);
        }
        else if(document.forms[0].CHIA2_C.value != '' && Number(document.forms[0].CHIA2_C.value)<0)
        {
            alert("please input the valid annual cost to add children in this case to health insurance ");
            document.forms[0].CHIA2_C.focus();
            return(false);
        }
        else if(document.forms[0].CME2_C.value != '' && Number(document.forms[0].CME2_C.value)<0)
        {
            alert("please input the valid annual extraordinary medical expenses ");
            document.forms[0].CME2_C.focus();
            return(false);
        }
        else if(document.forms[0].CCC2_C.value != '' && Number(document.forms[0].CCC2_C.value)<0)
        {
            alert("please input the valid annual reasonable childcare costs ");
            document.forms[0].CCC2_C.focus();
            return(false);
        }
    }
    
    function submitForm_Calc002()
    {
    
        if(document.forms[0].fGI_C.value != '' && Number(document.forms[0].fGI_C.value)<0)
        {
            alert("please input the valid gross income");
            document.forms[0].fGI_C.focus();
            return(false);
        }
        else if(document.forms[0].fSE_C_0.checked && document.forms[0].fSSTax_C.value == '')
        {
            alert("please input the social security tax due and payable on current income");
            document.forms[0].fSSTax_C.focus();
            return(false);
        }
        else if(document.forms[0].fSE_C_0.checked && document.forms[0].fSSTax_C.value != '' && Number(document.forms[0].fSSTax_C.value)<0)
        {
            alert("please input the valid social security tax due and payable on current income");
            document.forms[0].fSSTax_C.focus();
            return(false);
        }
        else if(document.forms[0].fSE_C_0.checked && document.forms[0].fMTax_C.value == '')
        {
             alert("please input the medicare tax due and payable on current income");
            document.forms[0].fMTax_C.focus();
            return(false);
        }
        else if(document.forms[0].fSE_C_0.checked && document.forms[0].fMTax_C.value != '' && Number(document.forms[0].fMTax_C.value)<0)
        {
             alert("please input the valid medicare tax due and payable on current income");
            document.forms[0].fMTax_C.focus();
            return(false);
        }
        else if(document.forms[0].fPayA_C_0.checked && document.forms[0].fPayAA_C.value == '')
        {
            alert("please input the total yearly amount of alimony that the Father actually paid to the Mother.");
            document.forms[0].fPayAA_C.focus();
            return(false);
        }
        else if(document.forms[0].fPayA_C_0.checked && document.forms[0].fPayAA_C.value != '' && Number(document.forms[0].fPayAA_C.value)<0)
        {
            alert("please input the valid total yearly amount of alimony that the Father actually paid to the Mother.");
            document.forms[0].fPayAA_C.focus();
            return(false);
        }
        else if(document.forms[0].fRecA_C_0.checked && document.forms[0].fRecAA_C.value == '')
        {
            alert("please input the total yearly amount of alimony that the Father actually received from any person.");
            document.forms[0].fRecAA_C.focus();
            return(false);
        }
         else if(document.forms[0].fRecA_C_0.checked && document.forms[0].fRecAA_C.value != '' && Number(document.forms[0].fRecAA_C.value)<0)
        {
            alert("please input the total yearly amount of alimony that the Father actually received from any person.");
            document.forms[0].fRecAA_C.focus();
            return(false);
        }
        else if(document.forms[0].fPayorCSO_C_0.checked && document.forms[0].fPayorCSOA_C.value == '')
        {
            alert("please input the total yearly amount of child support actually paid by the Father.");
            document.forms[0].fPayorCSOA_C.focus();
            return(false);
        }
        else if(document.forms[0].fPayorCSO_C_0.checked && document.forms[0].fPayorCSOA_C.value != '' && Number(document.forms[0].fPayorCSOA_C.value)<0)
        {
            alert("please input the valid total yearly amount of child support actually paid by the Father.");
            document.forms[0].fPayorCSOA_C.focus();
            return(false);
        }

         else if(document.forms[0].fSSDI_C_0.checked && document.forms[0].fSSDIA_C.value == '')
        {
            alert("please input the total yearly amount of SSDI derivative benefits actually received by the child(ren) through NCP");
            document.forms[0].fSSDIA_C.focus();
            return(false);
        }
        else if(document.forms[0].fSSDI_C_0.checked && document.forms[0].fSSDIA_C.value != '' && Number(document.forms[0].fSSDIA_C.value)<0)
        {
            alert("please input the valid total yearly amount of SSDI derivative benefits actually received by the child(ren) through NCP");
            document.forms[0].fSSDIA_C.focus();
            return(false);
        }
          else if(document.forms[0].fLDS_C_0.checked && document.forms[0].fLDSN_C.value == '')
        {
            alert("please input the number of children in the Father's home that he has a legal duty to support (excluding the child(ren) in this case).");
            document.forms[0].fLDSN_C.focus();
            return(false);
        }
        else if(document.forms[0].fLDS_C_0.checked && document.forms[0].fLDSN_C.value != '' && isNaN(document.forms[0].fLDSN_C.value))
        {
            alert("please input valid number of children in the Father's home that he has a legal duty to support (excluding the child(ren) in this case).");
            document.forms[0].fLDSN_C.focus();
            return(false);
        }
        else if(document.forms[0].fLDS_C_0.checked && document.forms[0].fLDSN_C.value != '' && Number(document.forms[0].fLDSN_C.value)<=0)
        {
            alert("please input valid number of children in the Father's that he has a legal duty to support (excluding the child(ren) in this case).");
            document.forms[0].fLDSN_C.focus();
            return(false);
        }
   }
   
        
    function submitForm_Custody()
    {
		
        if(document.forms[0].custodyType_0.checked)
        {
          if(!(document.forms[0].soleCP_C_0.checked || document.forms[0].soleCP_C_1.checked))
            {        
                alert("please choose the custodial parent ");
                return(false);
            }
        }   
         else if(document.forms[0].custodyType_1.checked)
        {
        
            if(!(document.forms[0].optDays_0.checked || document.forms[0].optDays_1.checked))
            {
                 alert("please select one of the options percentage/days")
                return(false);
            }
             else if(document.forms[0].optDays_0.checked && document.forms[0].noPercent.value == '')
            {
                alert("please input the time (in percentage) that the child(ren) spend with the Mother");
                document.forms[0].noPercent.focus();
                return(false);
            }

             else if(document.forms[0].optDays_1.checked && document.forms[0].noDays.value == '')
            {
                alert("please input the time (in days) that the child(ren) spend with the Mother");
                document.forms[0].noDays.focus();
                return(false);
            }
   
        }   
        else if(document.forms[0].custodyType_2.checked)
        {
          if(!(document.forms[0].thirdNCP_C_0.checked || document.forms[0].thirdNCP_C_1.checked))
            {        
                alert("please choose which parent this case is filed against");
                return(false);
            }
        }   
    }
    
    function submitForm_Calc001()
    {
        if(document.forms[0].mGI_C.value != '' && Number(document.forms[0].mGI_C.value)<0)
        {
            alert("please input the valid gross income");
            document.forms[0].mGI_C.focus();
            return(false);
        }
        else if(document.forms[0].mSE_C_0.checked && document.forms[0].mSSTax_C.value == '')
        {
            alert("please input the social security tax due and payable on current income");
            document.forms[0].mSSTax_C.focus();
            return(false);
        }
        else if(document.forms[0].mSE_C_0.checked && document.forms[0].mSSTax_C.value != '' && Number(document.forms[0].mSSTax_C.value)<0)
        {
            alert("please input the valid social security tax due and payable on current income");
            document.forms[0].mSSTax_C.focus();
            return(false);
        }
        else if(document.forms[0].mSE_C_0.checked && document.forms[0].mMTax_C.value == '')
        {
             alert("please input the medicare tax due and payable on current income");
            document.forms[0].mMTax_C.focus();
            return(false);
        }
         else if(document.forms[0].mSE_C_0.checked && document.forms[0].mMTax_C.value != '' && Number(document.forms[0].mMTax_C.value)<0)
        {
             alert("please input the valid medicare tax due and payable on current income");
            document.forms[0].mMTax_C.focus();
            return(false);
        }
        else if(document.forms[0].mPayA_C_0.checked && document.forms[0].mPayAA_C.value == '')
        {
            alert("please input the total yearly amount of alimony that the Mother actually paid the Father.");
            document.forms[0].mPayAA_C.focus();
            return(false);
        }
         else if(document.forms[0].mPayA_C_0.checked && document.forms[0].mPayAA_C.value != '' && Number(document.forms[0].mPayAA_C.value)<0)
        {
            alert("please input the valid total yearly amount of alimony that the Mother actually paid the Father.");
            document.forms[0].mPayAA_C.focus();
            return(false);
        }
        else if(document.forms[0].mRecA_C_0.checked && document.forms[0].mRecAA_C.value == '')
        {
            alert("please input the total yearly amount of alimony that the Mother actually received from anyone.");
            document.forms[0].mRecAA_C.focus();
            return(false);
        }
             else if(document.forms[0].mRecA_C_0.checked && document.forms[0].mRecAA_C.value != '' && Number(document.forms[0].mRecAA_C.value)<0)
        {
            alert("please input the valid total yearly amount of alimony that the Mother actually received from anyone.");
            document.forms[0].mRecAA_C.focus();
            return(false);
        }
        else if(document.forms[0].mPayorCSO_C_0.checked && document.forms[0].mPayorCSOA_C.value == '')
        {
            alert("please input the total yearly amount of child support actually paid by the Mother.");
            document.forms[0].mPayorCSOA_C.focus();
            return(false);
        }
            else if(document.forms[0].mPayorCSO_C_0.checked && document.forms[0].mPayorCSOA_C.value != '' && Number(document.forms[0].mPayorCSOA_C.value)<0)
        {
            alert("please input the valid total yearly amount of child support actually paid by the Mother.");
            document.forms[0].mPayorCSOA_C.focus();
            return(false);
        }
            else if(document.forms[0].mSSDI_C_0.checked && document.forms[0].mSSDIA_C.value == '')
        {
            alert("please input the total yearly amount of SSDI derivative benefits actually received by the child(ren) through the Mother");
            document.forms[0].mSSDIA_C.focus();
            return(false);
        }
              else if(document.forms[0].mSSDI_C_0.checked && document.forms[0].mSSDIA_C.value != '' && Number(document.forms[0].mSSDIA_C.value)<0)
        {
            alert("please input the valid total yearly amount of SSDI derivative benefits actually received by the child(ren) through the Mother");
            document.forms[0].mSSDIA_C.focus();
            return(false);
        }
        else if(document.forms[0].mLDS_C_0.checked && document.forms[0].mLDSN_C.value == '')
        {
            alert("please input the number of children in the Mother's home that she has a legal duty to support (excluding the child(ren) in this case).");
            document.forms[0].mLDSN_C.focus();
            return(false);
        }
        
        else if(document.forms[0].mLDS_C_0.checked && document.forms[0].mLDSN_C.value != '' && isNaN(document.forms[0].mLDSN_C.value))
        {
            alert("please input the valid number of children in the mother's home that she has a legal duty to support (excluding the child(ren) in this case).");
            document.forms[0].mLDSN_C.focus();
            return(false);
        }
        else if(document.forms[0].mLDS_C_0.checked && document.forms[0].mLDSN_C.value != '' && Number(document.forms[0].mLDSN_C.value)<=0)
        {
            alert("please input valid number of children in the mother's home that she has a legal duty to support (excluding the child(ren) in this case).");
            document.forms[0].mLDSN_C.focus();
            return(false);
        }

      
        return(true);
    }
    
      function showDoc(docType)
        {
            if(docType == "Health Insurance")
                window.open("../help/helppage.aspx?help=Health Insurance","IncomeHelpPage","width=600,height=600,top=50,left=50,resizable=yes,scrollbars=yes");
            else if(docType == "Childcare")
                window.open("../help/helppage.aspx?help=Childcare","IncomeHelpPage","width=600,height=600,top=50,left=50,resizable=yes,scrollbars=yes");
            else if(docType == "Extraordinary")
                window.open("../help/helppage.aspx?help=Extraordinary","IncomeHelpPage","width=600,height=600,top=50,left=50,resizable=yes,scrollbars=yes");
            else if(docType == "guideline")
                window.open("../help/Child Support Guideline Revision Act.pdf","ChildSupportGuidelineRevisionAct","width=600,height=600,top=50,left=50,resizable=yes");
            else if(docType == "income")
                window.open("../help/helppage.aspx?help=Income","IncomeHelpPage","width=600,height=600,top=50,left=50,resizable=yes,scrollbars=yes");
                
        }
        
        function printFN()
        {
            window.print();
            return(true);
        }