  function addData(idNCAC, id1, text1, id2, text2, id3, text3) {
     if (idNCAC && 0 < idNCAC.length) {
       updateAccred(idNCAC);
     }
     if (id3) {
       addTripleMyChild(id1, text1, id2, text2, id3, text3);
     } else if (id2) {
       addDoubleMyChild(id1, text1, id2, text2);
     } else if (id1) {
       addSingleMyChild(id1);
     }  
  }

  function updateAccred(idNCAC) {
  
    var dom1 = "ncac";
    
    var newAnchor = document.createElement("a");
    var anchorText = document.createTextNode("NCAC - View current Accreditation status");
    newAnchor.appendChild(anchorText);
    newAnchor.setAttribute("href", "http://www." + dom1 + ".gov.au/Search/Search3.asp?LDCC="+ idNCAC);
    newAnchor.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    newAnchor.setAttribute("rel", "nofollow");

    var accredElem = document.getElementById("accreditation");

    accredElem.appendChild(newAnchor)
  }

  function addSingleMyChild(id1) {
    var mychildElem1 = document.getElementById("mychildElem");

    var elem1 =  document.createElement("span");
    var anchorText1 = document.createTextNode("See more details at ");
    elem1.appendChild(anchorText1);

    var dom2 = "mychild";    
    var anchor2 = document.createElement("a");
    var anchorText2 = document.createTextNode("mychild.gov.au");
    anchor2.appendChild(anchorText2);
    anchor2.setAttribute("href", "http://ifp." + dom2 + ".gov.au/ChildCareService/Provider.aspx/"+ id1);
    anchor2.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    anchor2.setAttribute("rel", "nofollow");

    mychildElem1.appendChild(elem1)
    mychildElem1.appendChild(anchor2)
  }
  function SimpleaddSingleMyChild(idNCAC) {
  
    var dom2 = "mychild";
    
    var anchor2 = document.createElement("a");
    var anchorText2 = document.createTextNode("See more details at mychild.gov.au");
    anchor2.appendChild(anchorText2);
    anchor2.setAttribute("href", "http://ifp." + dom2 + ".gov.au/ChildCareService/Provider.aspx/"+ idNCAC);
    anchor2.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    anchor2.setAttribute("rel", "nofollow");

    var mychildElem1 = document.getElementById("mychildElem");

    mychildElem1.appendChild(anchor2)
  }
  
  function addTripleMyChild(id1, text1, id2, text2, id3, text3) {
    var mychildElem1 = document.getElementById("mychildElem");
    var dom = "mychild";    

    var elem1 =  document.createElement("span");
    var anchorText1 = document.createTextNode("See more details about ");
    elem1.appendChild(anchorText1);

    var anchor2 = document.createElement("a");
    var anchorText2 = document.createTextNode(text1);
    anchor2.appendChild(anchorText2);
    anchor2.setAttribute("href", "http://ifp." + dom + ".gov.au/ChildCareService/Provider.aspx/"+ id1);
    anchor2.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    anchor2.setAttribute("rel", "nofollow");

    var elem3 =  document.createElement("span");
    var anchorText3 = document.createTextNode(" , ");
    elem3.appendChild(anchorText3);

    var anchor4 = document.createElement("a");
    var anchorText4 = document.createTextNode(text2);
    anchor4.appendChild(anchorText4);
    anchor4.setAttribute("href", "http://ifp." + dom + ".gov.au/ChildCareService/Provider.aspx/"+ id2);
    anchor4.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    anchor4.setAttribute("rel", "nofollow");

    var elem5 =  document.createElement("span");
    var anchorText5 = document.createTextNode(" or ");
    elem5.appendChild(anchorText5);

    var anchor6 = document.createElement("a");
    var anchorText6 = document.createTextNode(text3);
    anchor6.appendChild(anchorText6);
    anchor6.setAttribute("href", "http://ifp." + dom + ".gov.au/ChildCareService/Provider.aspx/"+ id3);
    anchor6.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    anchor6.setAttribute("rel", "nofollow");

    var elem7 =  document.createElement("span");
    var anchorText7 = document.createTextNode(" at mychild.gov.au ");
    elem7.appendChild(anchorText7);

    mychildElem1.appendChild(elem1)
    mychildElem1.appendChild(anchor2)
    mychildElem1.appendChild(elem3)
    mychildElem1.appendChild(anchor4)
    mychildElem1.appendChild(elem5)
    mychildElem1.appendChild(anchor6)
    mychildElem1.appendChild(elem7)
  }

  function addDoubleMyChild(id1, text1, id2, text2) {
    var mychildElem1 = document.getElementById("mychildElem");
    var dom = "mychild";    

    var elem1 =  document.createElement("span");
    var anchorText1 = document.createTextNode("See more details about ");
    elem1.appendChild(anchorText1);

    var anchor2 = document.createElement("a");
    var anchorText2 = document.createTextNode(text1);
    anchor2.appendChild(anchorText2);
    anchor2.setAttribute("href", "http://ifp." + dom + ".gov.au/ChildCareService/Provider.aspx/"+ id1);
    anchor2.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    anchor2.setAttribute("rel", "nofollow");

    var elem3 =  document.createElement("span");
    var anchorText3 = document.createTextNode(" or ");
    elem3.appendChild(anchorText3);

    var anchor4 = document.createElement("a");
    var anchorText4 = document.createTextNode(text2);
    anchor4.appendChild(anchorText4);
    anchor4.setAttribute("href", "http://ifp." + dom + ".gov.au/ChildCareService/Provider.aspx/"+ id2);
    anchor4.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");
    anchor4.setAttribute("rel", "nofollow");

    var elem5 =  document.createElement("span");
    var anchorText5 = document.createTextNode(" at mychild.gov.au ");
    elem5.appendChild(anchorText5);

    mychildElem1.appendChild(elem1)
    mychildElem1.appendChild(anchor2)
    mychildElem1.appendChild(elem3)
    mychildElem1.appendChild(anchor4)
    mychildElem1.appendChild(elem5)
  }
  

  function addMyChildtry2(id1) {
    var dom1 = "mychild";
    
    var newAnchor = document.createElement("a");
    var anchorText = document.createTextNode("See more details at mychild.gov.au");
    newAnchor.appendChild(anchorText);
    newAnchor.setAttribute("href", "http://ifp." + dom2 + ".gov.au/ChildCareService/Provider.aspx/"+ id1);
    newAnchor.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");

    var accredElem = document.getElementById("accreditation");

    var newChild = accredElem.appendChild(newAnchor)

    AccredElem.appendChild = textNode;
  }
  
  function afunc() {
    var dom2 = "mychild";
    
    var newAnchor2 = document.createElement("a");
    var anchorText2 = document.createTextNode("mychild.gov.au");
    newAnchor2.appendChild(anchorText2);
    newAnchor2.setAttribute("href", "http://ifp." + dom2 + ".gov.au/ChildCareService/Provider.aspx/"+ id1);
    newAnchor2.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");

    var myChildElem = document.getElementById("mychild");

    var newChild = myChildElem.appendChild(newAnchor2)

    MyChildElem.appendChild = textNode;
  }

  function showMychildLinktry1(id1, text1, id2, text2, id3, text3) {
alert (id1.length);
    if (0 < id1.length) {
alert('in 1');
      if (0 < text1.length && 0 < text2.length && 0 < id2.length) {
        if (0 < text3.length && 0 < id3.length) {
            // 3 links are supplied              
        } else {
            // 2 links are supplied              

        }
      } else {
alert('in 2');
         // 1 link supplied
         var newAnchor = document.createElement("a");
         var anchorText = document.createTextNode("See more details mychild.gov.au");
         newAnchor.appendChild(anchorText);
         newAnchor.setAttribute("href", "http://ifp.mychild.gov.au/ChildCareService/Provider.aspx/"+ id1);
         newAnchor.setAttribute("onclick", "logExternalClick(this.href, '"+document.URL+"','externalSite')");

         var accredElem = document.getElementById("otherserviceshere");

         var newChild = accredElem.appendChild(newAnchor)

         AccredElem.appendChild = textNode;
      }
    } else {
alert('in 3');
    }
  }