﻿var ProjectID = 219;
var AppBusy = false;

function ShowMoreInfo(LoanProductID){
  if(document.getElementById('Description' + LoanProductID)){ 
    if(document.getElementById('Description' + LoanProductID).style.display == 'none'){
      ShowItem('Description' + LoanProductID);
    }else{
      HideItem('Description' + LoanProductID);
    }
  }
}

function ShowProviderPage(LeadID, ProductTypeID){
  window.location = 'providers.aspx?LeadID=' + LeadID + '&ProductTypeID=' + ProductTypeID;
}

function ShowForm(){
  ShowItem('Page1');
  HideItem('HouseNameTextRow');
  HideItem('FindAddressButton');
}

function DisableSubmitButton(){
  if(document.getElementById('PreviousButton')){ document.getElementById('PreviousButton').disabled = 'true'; }
  document.getElementById('SubmitButton').value = 'Processing...   ';
  document.getElementById('SubmitButton').disabled = 'true';
}

function HideForm(){
  HideItem('Page1');
}

function DisplayExtraQuestionA(){
  var f = document.forms[0];
  if(f.IsPersonalPension[1].checked){
    ShowItem('TotalCompanyPensionsRow');
  }else{
    HideItem('TotalCompanyPensionsRow');
  }
}
function DisplayExtraQuestionB(){
  var f = document.forms[0];
  if(f.TotalCompanyPensions[0].checked){
    ShowItem('IsStillContributingRow');
  }else{
    HideItem('IsStillContributingRow');
  }
}

function SubmitAdditionalInfo(LeadId, ProductTypeID, AdditionalInfoPage){
  if(AppBusy){
    return;
  }
  AppBusy = false;
  window.location = AdditionalInfoPage + '?LeadID=' + LeadId + '&ProductTypeID=' + ProductTypeID;
}

function ShowTotalCompanyPensions(){
  ShowItem('TotalCompanyPensionsRow');
}
function ShowIsStillContributing(){
  ShowItem('TotalCompanyPensionsRow');
  ShowItem('IsStillContributingRow');
}

function HideFields(ProductTypeID){
  if(ProductTypeID==1){
    HideItem('PensionProviderRow');
    HideItem('RetirementAgeRow');
    HideItem('PensionQuantityRow');
    HideItem('IsPersonalPensionRow2');
  }
  if(ProductTypeID==2){
    HideItem('BestTimeToContactRow');
    HideItem('PensionDetailsRow');
    HideItem('IsUKPensionRow');
    HideItem('IsReceivingBenefitsRow');
    HideItem('TotalCompanyPensionsRow');
    HideItem('IsStillContributingRow');
    HideItem('IsCashOrIncomeRow');
    HideItem('IsPersonalPensionRow');
  }
}

function HideItem(Id){
  if(document.getElementById(Id)){ document.getElementById(Id).style.display = 'none'; }
}
function ShowItem(Id){
  if(document.getElementById(Id)){ document.getElementById(Id).style.display = ''; }
}
