
function chkDonorRegion()
{
   setVisDisp("donorUsaDiv1", getFormObject(ct,"donorGovernLaw").value == "usa");
   setVisDisp("donorCanadaDiv1", getFormObject(ct,"donorGovernLaw").value == "canada");
   setVisDisp("donorUkDiv1", getFormObject(ct,"donorGovernLaw").value == "uk");
   setVisDisp("donorAustraliaDiv1", getFormObject(ct,"donorGovernLaw").value == "australia");
   setVisDisp("donorUsaDiv2", getFormObject(ct,"donorGovernLaw").value == "usa");
   setVisDisp("donorCanadaDiv2", getFormObject(ct,"donorGovernLaw").value == "canada");
   setVisDisp("donorUkDiv2", getFormObject(ct,"donorGovernLaw").value == "uk");
   setVisDisp("donorAustraliaDiv2", getFormObject(ct,"donorGovernLaw").value == "australia");
}


function chkAttorneyOneRegion()
{
   setVisDisp("attorneyUsaDiv1", getFormObject(ct,"attorneyOneGovLaw").value == "usa");
   setVisDisp("attorneyCanadaDiv1", getFormObject(ct,"attorneyOneGovLaw").value == "canada");
   setVisDisp("attorneyUkDiv1", getFormObject(ct,"attorneyOneGovLaw").value == "uk");
   setVisDisp("attorneyAustraliaDiv1", getFormObject(ct,"attorneyOneGovLaw").value == "australia");
   setVisDisp("attorneyUsaDiv2", getFormObject(ct,"attorneyOneGovLaw").value == "usa");
   setVisDisp("attorneyCanadaDiv2", getFormObject(ct,"attorneyOneGovLaw").value == "canada");
   setVisDisp("attorneyUkDiv2", getFormObject(ct,"attorneyOneGovLaw").value == "uk");
   setVisDisp("attorneyAustraliaDiv2", getFormObject(ct,"attorneyOneGovLaw").value == "australia");
}

function chkAttorneyTwoRegion()
{
   setVisDisp("attorneyTwoUsaDiv1", getFormObject(ct,"attorneyTwoGovLaw").value == "usa");
   setVisDisp("attorneyTwoCanadaDiv1", getFormObject(ct,"attorneyTwoGovLaw").value == "canada");
   setVisDisp("attorneyTwoUkDiv1", getFormObject(ct,"attorneyTwoGovLaw").value == "uk");
   setVisDisp("attorneyTwoAustraliaDiv1", getFormObject(ct,"attorneyTwoGovLaw").value == "australia");
   setVisDisp("attorneyTwoUsaDiv2", getFormObject(ct,"attorneyTwoGovLaw").value == "usa");
   setVisDisp("attorneyTwoCanadaDiv2", getFormObject(ct,"attorneyTwoGovLaw").value == "canada");
   setVisDisp("attorneyTwoUkDiv2", getFormObject(ct,"attorneyTwoGovLaw").value == "uk");
   setVisDisp("attorneyTwoAustraliaDiv2", getFormObject(ct,"attorneyTwoGovLaw").value == "australia");
}

function chkAttorneyThreeRegion()
{
   setVisDisp("attorneyThreeUsaDiv1", getFormObject(ct,"attorneyThreeGovLaw").value == "usa");
   setVisDisp("attorneyThreeCanadaDiv1", getFormObject(ct,"attorneyThreeGovLaw").value == "canada");
   setVisDisp("attorneyThreeUkDiv1", getFormObject(ct,"attorneyThreeGovLaw").value == "uk");
   setVisDisp("attorneyThreeAustraliaDiv1", getFormObject(ct,"attorneyThreeGovLaw").value == "australia");
   setVisDisp("attorneyThreeUsaDiv2", getFormObject(ct,"attorneyThreeGovLaw").value == "usa");
   setVisDisp("attorneyThreeCanadaDiv2", getFormObject(ct,"attorneyThreeGovLaw").value == "canada");
   setVisDisp("attorneyThreeUkDiv2", getFormObject(ct,"attorneyThreeGovLaw").value == "uk");
   setVisDisp("attorneyThreeAustraliaDiv2", getFormObject(ct,"attorneyThreeGovLaw").value == "australia");
}

function chkAltAttorneyRegion()
{
   setVisDisp("altAttorneyUsaDiv1", getFormObject(ct,"altAttorneyGovLaw").value == "usa");
   setVisDisp("altAttorneyCanadaDiv1", getFormObject(ct,"altAttorneyGovLaw").value == "canada");
   setVisDisp("altAttorneyUkDiv1", getFormObject(ct,"altAttorneyGovLaw").value == "uk");
   setVisDisp("altAttorneyAustraliaDiv1", getFormObject(ct,"altAttorneyGovLaw").value == "australia");
   setVisDisp("altAttorneyUsaDiv2", getFormObject(ct,"altAttorneyGovLaw").value == "usa");
   setVisDisp("altAttorneyCanadaDiv2", getFormObject(ct,"altAttorneyGovLaw").value == "canada");
   setVisDisp("altAttorneyUkDiv2", getFormObject(ct,"altAttorneyGovLaw").value == "uk");
   setVisDisp("altAttorneyAustraliaDiv2", getFormObject(ct,"altAttorneyGovLaw").value == "australia");
}

function chkAltAttorneyTwoRegion()
{
   setVisDisp("altAttorneyTwoUsaDiv1", getFormObject(ct,"altAttorneyTwoGovLaw").value == "usa");
   setVisDisp("altAttorneyTwoCanadaDiv1", getFormObject(ct,"altAttorneyTwoGovLaw").value == "canada");
   setVisDisp("altAttorneyTwoUkDiv1", getFormObject(ct,"altAttorneyTwoGovLaw").value == "uk");
   setVisDisp("altAttorneyTwoAustraliaDiv1", getFormObject(ct,"altAttorneyTwoGovLaw").value == "australia");
   setVisDisp("altAttorneyTwoUsaDiv2", getFormObject(ct,"altAttorneyTwoGovLaw").value == "usa");
   setVisDisp("altAttorneyTwoCanadaDiv2", getFormObject(ct,"altAttorneyTwoGovLaw").value == "canada");
   setVisDisp("altAttorneyTwoUkDiv2", getFormObject(ct,"altAttorneyTwoGovLaw").value == "uk");
   setVisDisp("altAttorneyTwoAustraliaDiv2", getFormObject(ct,"altAttorneyTwoGovLaw").value == "australia");
}

function chkSignRegion()
{
   setVisDisp("signUsaDiv1", getFormObject(ct,"signGovLaw").value == "usa");
   setVisDisp("signCanadaDiv1", getFormObject(ct,"signGovLaw").value == "canada");
   setVisDisp("signUkDiv1", getFormObject(ct,"signGovLaw").value == "uk");
   setVisDisp("signAustraliaDiv1", getFormObject(ct,"signGovLaw").value == "australia");
   setVisDisp("signUsaDiv2", getFormObject(ct,"signGovLaw").value == "usa");
   setVisDisp("signCanadaDiv2", getFormObject(ct,"signGovLaw").value == "canada");
   setVisDisp("signUkDiv2", getFormObject(ct,"signGovLaw").value == "uk");
   setVisDisp("signAustraliaDiv2", getFormObject(ct,"signGovLaw").value == "australia");

   setVisDisp("ukWarningDiv", getFormObject(ct,"signGovLaw").value == "uk");

}


function chkAttorney()
{
   var govCountry = getFormObject(ct,"governLaw").value;

   if (getFormObject(ct, "attorneyNumber1").checked == true && (govCountry == "usa" || govCountry == "canada"))
      setVisDisp("altAttorneyDiv", true);

   else
      setVisDisp("altAttorneyDiv", false);

   if (getFormObject(ct, "attorneyNumber2").checked == true)
   {
         setVisDisp("secondAttorney", true);
         setVisDisp("attorneyDecisionDiv", true);
         setVisDisp("thirdAttorney", false);
   }

   else if (getFormObject(ct, "attorneyNumber3").checked == true)
   {
      setVisDisp("thirdAttorney", true);
      setVisDisp("attorneyDecisionDiv", true);
      setVisDisp("secondAttorney", true);
   }

  else
   {
      setVisDisp("thirdAttorney", false);
      setVisDisp("attorneyDecisionDiv", false);
      setVisDisp("secondAttorney", false);
   }

   if (getFormObject(ct, "altattorneyQuestion1").checked == true)
   {
      setVisDisp("numOfAltAttorneyDiv", true);
      setVisDisp("altAttorney", true);

   }

   else
   {
      setVisDisp("numOfAltAttorneyDiv", false);
      setVisDisp("altAttorney", false);
   }

   setVisDisp("secondAltAttorney", getFormObject(ct, "altAttorneyNumber2").checked == true);
}

function chkLandFeature()
{
  var govNation=getFormObject(ct,"governLaw").value;

   switch(govNation) {
      case "canada":
         governingLaw = getFormObject("powerattny","governingProv").value;
         break;
      case "usa":
         governingLaw = getFormObject("powerattny","governingState").value;
         break;
      case "australia":
         governingLaw = getFormObject("powerattny","governingTerritory").value;
         break;
      default:
         governingLaw = getFormObject("powerattny","governingCountry").value;
         break;
   }

   if ((governingLaw == "British Columbia") && (govNation == "canada"))
   {
      if ((getFormObject(ct,"sellrealtyFeature").checked == true) || (getFormObject(ct,"buyrealtyFeature").checked == true) || (getFormObject(ct,"realFeature").checked == true))
      {
         setVisDisp("otherAffidavitDiv", true);
         setVisDisp("legalAdviceDiv", true);
         setVisDisp("witnessCertDiv", true);
         //setVisDisp("bcWitnessCertDiv", true);
         setVisDisp("landFeatureDisp", true);
      }

      else
      {
         setVisDisp("signDiv", true);
         setVisDisp("landFeatureDisp", false);
      }
   }

   else if (govNation == "uk")
   {
      setVisDisp("signDiv", false);
      setVisDisp("landFeatureDisp", false);
   }

   else if ((governingLaw == "Arizona") && (govNation == "usa"))
   {
      setVisDisp("signDiv", false);
      setVisDisp("landFeatureDisp", false);
   }

  else
   {
      setVisDisp("signDiv", true);
      setVisDisp("landFeatureDisp", false);
   }

}




function chkMentalCap()
{
   var govCountry = getFormObject(ct,"governLaw").value;
   var governingLaw = getFormObject(ct,"governingState").value;

   if (!getFormObject(ct,"powerType")[0].checked && getFormObject(ct,"attorneyType").value != "Immediate" &&
       ((govCountry == "usa" && governingLaw != "Louisiana") || govCountry == "canada"))
   {
   setVisDisp("MentalIncapacityDefinitionDiv", true);
      setVisDisp("altMentalCapDiv", govCountry == "canada");
   }

   else
   {
      setVisDisp("MentalIncapacityDefinitionDiv", false);
      setVisDisp("altMentalCapDiv", false);
   }
}


function louisianaDisp(governingLaw)
{
   setVisDisp("detailDiv2", governingLaw == "Louisiana");
   setVisDisp("detailDiv1", governingLaw != "Louisiana");
   setVisDisp("hintDiv1", getFormObject(ct,"hintDisplay").checked && governingLaw != "Louisiana");
      setVisDisp("hintDiv2", getFormObject(ct,"hintDisplay").checked && governingLaw == "Louisiana");
}


function printWitnessNotary(governingLaw)
{
   var witness = false;

   if(governingLaw == "Alaska" || governingLaw == "Colorado" || governingLaw == "Delaware" || governingLaw == "Hawaii" || governingLaw == "Idaho" || governingLaw == "Indiana" || governingLaw == "Iowa" || governingLaw == "Kansas" || governingLaw == "Kentucky" || governingLaw == "Maine" || governingLaw == "Maryland" || governingLaw == "Massachusetts" || governingLaw == "Minnesota" || governingLaw == "Mississippi" || governingLaw == "Missouri" || governingLaw == "Montana" || governingLaw == "Nebraska" || governingLaw == "Nevada" || governingLaw == "New Hampshire" || governingLaw == "New Jersey" || governingLaw == "New Mexico" || governingLaw == "New York" || governingLaw == "North Carolina" || governingLaw == "North Dakota" || governingLaw == "Ohio" || governingLaw == "Oregon" || governingLaw == "Rhode Island" || governingLaw == "South Dakota" || governingLaw == "Tennessee" || governingLaw == "Texas" || governingLaw == "Utah" || governingLaw == "Virginia" || governingLaw == "Washington" || governingLaw == "West Virginia" || governingLaw == "Wyoming")
      {
         setVisDisp("usWarningDiv1", true);
         getObject('govJuris1').innerHTML = governingLaw+" ";
         setVisDisp("usSignDiv1", true);

         if(getFormObject(ct, "witnessNum").value == "1" || getFormObject(ct, "witnessNum").value == "2")
            witness = true;


      }

      else
      {
         setVisDisp("usWarningDiv1", false);
         setVisDisp("usSignDiv1", false);
      }


      if(governingLaw == "Arizona" || governingLaw == "Illinois" || governingLaw == "Vermont")
      {
         setVisDisp("usWarningDiv2", true);
         getObject('govJuris2').innerHTML = governingLaw+" ";
         setVisDisp("usSignDiv2", governingLaw == "Illinois" || governingLaw == "Vermont");

         if(getFormObject(ct, "signWitnessNum").value == "1" || getFormObject(ct, "signWitnessNum").value == "2")
            witness = true;


      }

      else
      {
            setVisDisp("usWarningDiv2", false);
            setVisDisp("usSignDiv2", false);

      }


      if(governingLaw == "Arkansas" || governingLaw == "California")
      {
         setVisDisp("usWarningDiv3", true);
         getObject('govJuris3').innerHTML = governingLaw+" ";
         setVisDisp("usSignDiv3", true);

         if(getFormObject(ct, "printWith1").value == "witnesses" || getFormObject(ct, "printWith1").value == "both")
            witness = true;
      }

      else
      {
         setVisDisp("usWarningDiv3", false);
         setVisDisp("usSignDiv3", false);
      }

      if(governingLaw == "Connecticut" || governingLaw == "District of Columbia" || governingLaw == "Florida" || governingLaw == "Georgia" || governingLaw == "Michigan" || governingLaw == "Pennsylvania" || governingLaw == "South Carolina" || governingLaw == "Wisconsin" || (governingLaw == "Oklahoma" && getFormObject(ct,"powerType")[1].checked))
      {
            setVisDisp("georgiaDiv", governingLaw == "Georgia");

            setVisDisp("usWarningDiv4", true);
            getObject('govJuris4').innerHTML = governingLaw+" ";
            setVisDisp("usNotaryDiv", true);

            if(getFormObject(ct, "notaryAck").value == "yes")
               witness = true;
         }

         else
         {
            setVisDisp("usWarningDiv4", false);
            setVisDisp("usNotaryDiv", false);
            setVisDisp("georgiaDiv", false);
      }

      if ((governingLaw == "Oklahoma" && getFormObject(ct,"powerType")[0].checked) || governingLaw == "Alabama")
      {
         setVisDisp("usSignDiv5", true);

         if(getFormObject(ct, "printWith2").value == "oneWitness" || getFormObject(ct, "printWith2").value == "twoWitnesses" || getFormObject(ct, "printWith2").value == "both")
            witness = true;
      }

      else
         setVisDisp("usSignDiv5", false);


      if (governingLaw == "Louisiana")
      {
         setVisDisp("usSignDiv6", true);
         witness = true;
      }
      else
         setVisDisp("usSignDiv6", false);


      return witness;
}

function chkLandTitle(governingLaw)
{
   if (governingLaw == "British Columbia")
   {
      if(getFormObject(ct,"sellrealtyFeature").checked || getFormObject(ct,"buyrealtyFeature").checked || getFormObject(ct,"realFeature").checked)
         return true;

      else
         return false;
   }

   else
      return false;
}

function canadaWitnessing()
{
   var govCountry=getFormObject(ct,"governLaw").value;
   var governingLaw;
   var landTitle, witness;
   var isProv = false;
   var isManitoba = false;
   var isOntario = false;
   var isSask = false;
   var isCanada = false;

   if (govCountry == "canada")
   {
      governingLaw = getFormObject("powerattny","governingProv").value;
      isCanada=true;
   }

   else if (govCountry == "usa")
      governingLaw = getFormObject("powerattny","governingState").value;

   else if (govCountry == "australia")
      governingLaw = getFormObject("powerattny","governingTerritory").value;

   else
      governingLaw = getFormObject("powerattny","governingCountry").value;


   landTitle = chkLandTitle(governingLaw);


   setVisDisp("landFeatureDisp", landTitle);

   if ((governingLaw == "Alberta") || (governingLaw == "British Columbia") || (governingLaw == "Manitoba" && getFormObject(ct,"powerType")[0].checked) || (governingLaw == "Newfoundland and Labrador") || (governingLaw == "New Brunswick") || (governingLaw == "Northwest Territories") || (governingLaw == "Nova Scotia") || (governingLaw == "Nunavut") || (governingLaw == "Ontario" && getFormObject(ct,"powerType")[0].checked) || (governingLaw == "Prince Edward Island") || (governingLaw == "Saskatchewan" && getFormObject(ct,"powerType")[0].checked) || (governingLaw == "Yukon"))
      isProv = true;

   else if (governingLaw == "Manitoba" && getFormObject(ct,"powerType")[1].checked)
      isManitoba = true;

   else if (governingLaw == "Ontario" && getFormObject(ct,"powerType")[1].checked)
      isOntario = true;

   else if (governingLaw == "Saskatchewan" && getFormObject(ct,"powerType")[1].checked)
      isSask = true;

   setVisDisp("canadaSignDiv", isProv && landTitle == false);
   setVisDisp('canadaRESignDiv', isProv && landTitle);
   setVisDisp("canadaDonorAckDiv", (isProv && landTitle == false) || isOntario || isSask);
   setVisDisp("canadaBankNote", (isProv && landTitle == false) || isOntario || isSask);

   witness = printWitnessNotary(governingLaw);

   setVisDisp("otherAffidavitDiv", (govCountry == "usa") || isCanada);
   setVisDisp("canadaWitnessCert",(isCanada && ((landTitle == false) || governingLaw == "British Columbia" || isManitoba == false)));
   setVisDisp("usaWitnessCert", govCountry == "usa");

   setVisDisp("witnessNote",isCanada && isManitoba == false);

   if (landTitle && governingLaw == "British Columbia")
      setVisDisp("canadaWitnessCert", false);


   setVisDisp("bcWitnessCert",(isCanada && landTitle));


   setVisDisp("witnessCertDiv", isProv || isOntario || isSask || isManitoba==false || (govCountry == "usa"));
   setVisDisp("witnessStatementDiv",(getFormObject(ct,"witnessCertificate").checked == true) && ((isProv && landTitle == false) || isOntario || isSask));
   setVisDisp("legalAdviceDiv", isProv || isManitoba || isOntario || (isSask && getFormObject(ct, "saskSign").value == "witness"));
   setVisDisp("affidExecOfficerDiv",getFormObject(ct, "signGovLaw").value != "usa" && getFormObject(ct,"witnessCertificate").checked == true && getFormObject(ct,"witnessStatement")[1].checked && ((isProv && landTitle == false) || isOntario || isSask)); //affidavit is selected

   if (getFormObject(ct, "signGovLaw").value == "usa")
      getFormObject(ct, "affidExecOfficer").value = "Notary Public";

   //Manitoba, Ontario, Saskatchewan
   setVisDisp("manitobaMsg", isManitoba);
   setVisDisp("affidavitDiv", isManitoba);
   setVisDisp("ontarioMsg", isOntario);
   setVisDisp("saskMsg", isSask);
   setVisDisp("saskSignDiv", isSask);

   chkSignRegion();
}


function usaCanadaNameDisp()
{
  var attorneyType = getFormObject(ct,'attorneyType');
  var govCountry = getFormObject(ct,"governLaw").value;
   var oldIndex = attorneyType.selectedIndex;

   if (govCountry == "canada")
   {
      attorneyType.options[2] = new Option('Immediate and Springing','Both');
      attorneyType.options.length = 3;
   }

   else
   {
      attorneyType.options.length = 2;
   }

   attorneyType.selectedIndex = oldIndex;
}


function chkWitnessDiv()
{
   var govCountry = getFormObject(ct,"governLaw").value;


    setVisDisp("saskatchewanWitness",(getFormObject(ct, "governingProv").value == "Saskatchewan") && (govCountry == "canada"));
    setVisDisp("manitobaWitness", (getFormObject(ct, "governingProv").value == "Manitoba") && (govCountry == "canada"));
    setVisDisp("ontarioWitness", (getFormObject(ct, "governingProv").value == "Ontario") && (govCountry == "canada"));

   setVisDisp("otherAffidavitDiv",( (getFormObject(ct, "governingState").value != "New York") && (govCountry == "usa") )||
               ((getFormObject(ct,"witnessNum").value != "None") && (govCountry == "usa") ) );
    //setVisDisp("arizonaWitness",(getFormObject(ct, "governingState").value == "Arizona") && (govCountry == "usa"));
    setVisDisp("arkansasWitness",(getFormObject(ct, "governingState").value == "Arkansas") && (govCountry == "usa"));
    setVisDisp("connecticutWitness",(getFormObject(ct, "governingState").value == "Connecticut") && (govCountry == "usa"));
    setVisDisp("californiaWitness",(getFormObject(ct, "governingState").value == "California") && (govCountry == "usa"));
    setVisDisp("dcWitness",(getFormObject(ct, "governingState").value == "District of Columbia") && (govCountry == "usa"));
    setVisDisp("floridaWitness",(getFormObject(ct, "governingState").value == "Florida") && (govCountry == "usa"));
    setVisDisp("georgiaWitness",(getFormObject(ct, "governingState").value == "Georgia") && (govCountry == "usa"));
    setVisDisp("illinoisWitness",(getFormObject(ct, "governingState").value == "Illinois") && (govCountry == "usa"));
    setVisDisp("michiganWitness",(getFormObject(ct, "governingState").value == "Michigan") && (govCountry == "usa"));
    setVisDisp("oklahomaWitness",(getFormObject(ct, "governingState").value == "Oklahoma") && (govCountry == "usa"));
    setVisDisp("pennsylvaniaWitness",(getFormObject(ct, "governingState").value == "Pennsylvania") && (govCountry == "usa"));
    setVisDisp("scWitness",(getFormObject(ct, "governingState").value == "South Carolina") && (govCountry == "usa"));
    setVisDisp("vermontWitness",(getFormObject(ct, "governingState").value == "Vermont") && (govCountry == "usa"));
    setVisDisp("wisconsinWitness",(getFormObject(ct, "governingState").value == "Wisconsin") && (govCountry == "usa"));
}

function powerAttType(selAttorneyType)
{
   var govCountry = getFormObject(ct,"governLaw").value;

   setVisDisp("canImmediateDetails",selAttorneyType.value == "Immediate" && govCountry == "canada");
  setVisDisp("usaImmediateDetails",selAttorneyType.value == "Immediate" && govCountry == "usa");
   setVisDisp("usaSpringingDetails",selAttorneyType.value == "Springing" && govCountry == "usa");
   setVisDisp("otherSpringingDetails",selAttorneyType.value == "Springing" && (govCountry == "uk" || govCountry == "canada"));
  setVisDisp("immedandsprDetails",selAttorneyType.value == "Both");

}  // end of function

function checkSpecificPowers(check)
{
   getFormObject(ct,"usgeneralFeature").checked = check;
   getFormObject(ct,"realFeature").checked = check;
   getFormObject(ct,"chattelFeature").checked = check;
   getFormObject(ct,"bankfullFeature").checked = check;
   getFormObject(ct,"businessoperateFeature").checked = check;
   getFormObject(ct,"insuranceFeature").checked = check;
   getFormObject(ct,"estatetransFeature").checked = check;
   getFormObject(ct,"livingtrustFeature").checked = check;
   getFormObject(ct,"litigationFeature").checked = check;
   getFormObject(ct,"govtbenefitsFeature").checked = check;
   getFormObject(ct,"retirementplanFeature").checked = check;
   getFormObject(ct,"familycareFeature").checked = check;
   getFormObject(ct,"taxFeature").checked = check;
   getFormObject(ct,"maintainassetsFeature").checked = check;
   getFormObject(ct,"professionalsFeature").checked = check;
   if (document.forms[ct].giftsFeature) {
   getFormObject(ct,"giftsFeature").checked = check;
   }
   if (document.forms[ct].charityFeature) {
   getFormObject(ct,"charityFeature").checked = check;
   }
    /*Add all the specific powers here */
}


function setAgreementType(agreementType)
{
   var country=getFormObject(ct,"governLaw").value;

   if (country=="canada") {
      if (agreementType=="nonenduring") {
         getFormObject(ct, 'powerType')[0].checked=true;

      } else if (agreementType=="enduring") {
         getFormObject(ct, 'powerType')[1].checked=true;

      }
   } else if (country=="usa") {
      if (agreementType=="nondurable") {
         getFormObject(ct, 'powerType')[0].checked=true;

      } else if (agreementType=="durable") {
         getFormObject(ct, 'powerType')[1].checked=true;

      }

   }

  // northAmericaDisplay();
}


function NAGoverningLaw()
{
   var country = getFormObject('hiddenform',"country").value;
   var govCountry = getFormObject(ct,"governLaw").value;
   var witness;

   var governingLaw;

   if (country == "Canada")
   {
      governingLaw = getFormObject("powerattny","governingProv").value;
      if (governingLaw == "British Columbia")
         getFormObject(ct, "attorneyType").value = "Immediate";

   }

   else if (country == "USA")
   {
      governingLaw = getFormObject("powerattny","governingState").value;

   }

   setVisDisp("validLocationDiv", governingLaw != "Quebec");
   //setVisDisp("viewResultDiv", governingLaw != "Quebec");
   //setVisDisp("LouisianaDiv", governingLaw == "Louisiana");
   setVisDisp("QuebecDiv", governingLaw == "Quebec");

   louisianaDisp(governingLaw);

   witness = printWitnessNotary(governingLaw);


   chkAttorney();
   powerAttType(getFormObject(ct,'attorneyType'));


   setVisDisp("powerTypeDiv", govCountry == "usa" || govCountry == "canada"); 
   //setVisDisp("usaOrdinaryHintText", govCountry == "usa" && getFormObject(ct,"powerType")[0].checked);
   //setVisDisp("canadaOrdinaryHintText", govCountry == "canada" && getFormObject(ct,"powerType")[0].checked);


   /*setVisDisp("enduringTypeDiv", !getFormObject(ct,"powerType")[0].checked && (governingLaw != "Florida") &&
                  (govCountry == "usa" || govCountry == "canada"));

   if (governingLaw == "Florida" && govCountry == "usa" && !getFormObject(ct,"powerType")[0].checked)
      getFormObject(ct, "attorneyType").value = "Immediate";*/



   setVisDisp("enduringTypeDiv", !getFormObject(ct,"powerType")[0].checked && ((govCountry == "usa" && governingLaw != "Louisiana") || (govCountry == "canada" && getFormObject(ct, "governingProv").value != 'British Columbia')));

   setVisDisp("specificPowersDiv", govCountry == "usa" || govCountry == "canada");
   setVisDisp("restrictionDiv", govCountry == "usa" || govCountry == "canada");
   setVisDisp("otherIssueDiv", govCountry == "usa" || govCountry == "canada");

   setVisDisp("attorneyendDateDiv", getFormObject(ct,"powerType")[0].checked && (govCountry == "usa" || govCountry == "canada"));


   setVisDisp("usaWitness", !getFormObject(ct,'powerType')[0].checked && govCountry == "usa" && governingLaw == "Alabama");
   setVisDisp("usanondurableWitness", getFormObject(ct,'powerType')[0].checked && govCountry == "usa" && (governingLaw == "Alabama" || governingLaw == "Oklahoma"));
   setVisDisp("bcrealestatewarningDiv",(getFormObject(ct, "governingProv").value == "British Columbia") && (govCountry == "canada"));
   setVisDisp("ncWarning",(getFormObject(ct, "governingState").value == "North Carolina") && (!getFormObject(ct,'powerType')[0].checked) && (govCountry == "usa"));
   setVisDisp("scWarning",(getFormObject(ct, "governingState").value == "South Carolina") && (!getFormObject(ct,'powerType')[0].checked) && (govCountry == "usa"));
   setVisDisp("usterritoriesWarning", (getFormObject(ct, "governingState").value == "Guam" || getFormObject(ct, "governingState").value == "Puerto Rico" || getFormObject(ct, "governingState").value == "Virgin Islands") && (govCountry == "usa"));


   chkMentalCap();


   var showTR = getFormObject(ct,'powerType')[0].checked;

   setVisDisp("linebreakFeatureTR",showTR);
   setVisDisp("sellRealtyFeatureTR",showTR);
   setVisDisp("buyrealtyFeatureTR",showTR);
   setVisDisp("managerealtyFeatureTR",showTR);
   setVisDisp("managebankFeatureTR",showTR);


   setVisDisp("genPowerDiv", govCountry == "canada");
   setVisDisp("canSpecificDiv", govCountry == "canada" && (getFormObject(ct, "specificClause1").checked == true));
   setVisDisp("selectPowerDiv", govCountry == "usa");

   setVisDisp("usaPowersDiv", govCountry == "usa");

   setVisDisp("stayHomeDiv1", govCountry == "canada");
   setVisDisp("stayHomeDiv2", govCountry == "canada");

   setVisDisp("usgenFeatureDiv1", govCountry == "usa");
   setVisDisp("usgenFeatureDiv2", govCountry == "usa");

   setVisDisp("corpShareDiv1", govCountry == "canada");
   setVisDisp("corpShareDiv2", govCountry == "canada");

   setVisDisp("canSellBuyDiv", govCountry == "canada");
   setVisDisp("usaAttorneyDiv", govCountry == "usa");
   

   setVisDisp("selSpecificPowersDiv", (govCountry == "usa" || (govCountry == "canada" && (getFormObject(ct, "specificClause1").checked == true))));


   usaCanadaNameDisp();

   canadaWitnessing();

   return governingLaw;
}




// function to display div based on answers selected
function northAmericaDisplay()
{
   var witness;
   var govCountry=getFormObject(ct,"governLaw").value;
   var country = getFormObject('hiddenform',"country").value;
   var governingLaw;

   governingLaw = NAGoverningLaw();


   //force the signing nation to one of the choices
   if (getFormObject(ct, "signGovLaw").value == "")
   {
      if (country == "USA")
         getFormObject(ct, "signGovLaw").selectedIndex = "1";

      else if (country == "Canada")
         getFormObject(ct, "signGovLaw").selectedIndex = "2";

      else
         getFormObject(ct, "signGovLaw").selectedIndex = "0";
   }


   chkAttorney();

   specifyDate();


   chkMentalCap();
   usaCanadaNameDisp();

   chkDonorRegion();


   chkAttorneyOneRegion();
   chkAttorneyTwoRegion();
   chkAttorneyThreeRegion();
   chkAltAttorneyRegion();
   chkAltAttorneyTwoRegion();


   var canada;

   if(getFormObject('hiddenform',"country").value == "Canada")
      canada = true;

   else
      canada = false;


            if (getFormObject(ct,"attorneyNumber")[0].checked != true) {
                  funcradChangeDiv('true','secondAttorney');
             }

             else
             {
                  funcradChangeDiv('false','secondAttorney')
             }

             if (getFormObject(ct,"attorneyNumber")[2].checked == true) {
                funcradChangeDiv('true','thirdAttorney');

             }

             else
             {
                funcradChangeDiv('false','thirdAttorney')
             }

             if (getFormObject(ct,"altAttorneyNumber")[0].checked != true) {
                  funcradChangeDiv('true','secondAltAttorney');
             }

             else {
                  funcradChangeDiv('false','secondAltAttorney')
             }

             if (getFormObject(ct,"altattorneyQuestion")[0].checked == true) {
                  funcradChangeDiv('true','altAttorney');
             }

             else {
                  funcradChangeDiv('false','altAttorney')
             }


   if (getFormObject(ct,"attorneyRelationship")[0].checked != true) {
      //funcradChangeDiv('true','secondAltAttorney');
      setVisDisp("desc0",false);
      setVisDisp("desc1",getFormObject('hiddenform',"country").value != "Canada");
      setVisDisp("desc2",getFormObject('hiddenform',"country").value == "Canada");
   }

   else {
      //funcradChangeDiv('false','secondAltAttorney')
      setVisDisp("desc0",true);
      setVisDisp("desc1",false);
      setVisDisp("desc2",false);
   }

   powerAttType(getFormObject(ct,'attorneyType'));


   setVisDisp("RestrictionListDiv",getFormObject(ct,'restrictionsClause')[0].checked);

   setVisDisp("otherMentalCapacity",getFormObject(ct,'altMentalCapacity').value =='4');



   setVisDisp("compensationOptionDiv",getFormObject(ct,'compensationOption')[0].checked);

   setVisDisp("setcompensationDiv",
         !getFormObject(ct,'compamountOption')[0].checked &&
         getFormObject(ct,'compensationOption')[0].checked);

   setVisDisp("prepareOptionDiv",getFormObject(ct,'statementOption')[0].checked);

   setVisDisp("reportaddressDiv",getFormObject(ct,'statementOption')[0].checked);

   setVisDisp("attorneyendDate",getFormObject(ct,"endOption")[0].checked);

}  // end of divdisplay function

