// **********************************************************************
//
//  Compute population coverage 
//
// **********************************************************************

  function modMotifObject( incoming )
  {
    // I hope this works ....
    var ta = document.MHCRank.coverage;
    var calcArray = new Array();
    var motCoverage = new Number( 0.0 );
    if (motifObject[incoming] == 0)
        {
        motifObject[incoming] = 1;
        }
    else 
        {
            motifObject[incoming] = 0;
        }
    // calculateCoverage();
    for ( motif in motifObject ) {
        if (motifObject[motif] == 1)
            calcArray[calcArray.length] =  motif;
    }
    var motString = new String(calcArray);
    //
    //  A2 A3 A24 B7 B15 B39 B44
    //
    // if (motString == 'A2') motString = 'yes';
if (motString == "A2") motCoverage = 43.75;
if (motString == "A3") motCoverage = 32.18;
if (motString == "A24") motCoverage = 15.56;
if (motString == "B7") motCoverage = 30.64;
if (motString == "B15") motCoverage = 13.06;
if (motString == "B39") motCoverage = 5.11;
if (motString == "B44") motCoverage = 10.05;
if (motString == "A2,A3") motCoverage = 67.11;
if (motString == "A2,A24") motCoverage = 60.75;
if (motString == "A2,B7") motCoverage = 66.07;
if (motString == "A2,B15") motCoverage = 53.43;
if (motString == "A2,B39") motCoverage = 47.57;
if (motString == "A2,B44") motCoverage = 49.83;
if (motString == "A3,A24") motCoverage = 53.13;
if (motString == "A3,B7") motCoverage = 64.92;
if (motString == "A3,B15") motCoverage = 42.86;
if (motString == "A3,B39") motCoverage = 36.38;
if (motString == "A3,B44") motCoverage = 40.76;
if (motString == "A24,B7") motCoverage = 54.03;
if (motString == "A24,B15") motCoverage = 37.04;
if (motString == "A24,B39") motCoverage = 26.12;
if (motString == "A24,B44") motCoverage = 34.83;
if (motString == "B7,B15") motCoverage = 46.87;
if (motString == "B7,B39") motCoverage = 41.55;
if (motString == "B7,B44") motCoverage = 38.97;
if (motString == "B15,B39") motCoverage = 17.83;
if (motString == "B15,B44") motCoverage = 22.81;
if (motString == "B39,B44") motCoverage = 15.30;
if (motString == "A2,A3,A24") motCoverage = 81.11;
if (motString == "A2,A3,B7") motCoverage = 88.08;
if (motString == "A2,A3,B15") motCoverage = 74.41;
if (motString == "A2,A3,B39") motCoverage = 70.01;
if (motString == "A2,A3,B44") motCoverage = 71.29;
if (motString == "A2,A24,B7") motCoverage = 85.99;
if (motString == "A2,A24,B15") motCoverage = 70.46;
if (motString == "A2,A24,B39") motCoverage = 65.75;
if (motString == "A2,A24,B44") motCoverage = 67.24;
if (motString == "A2,B7,B15") motCoverage = 75.97;
if (motString == "A2,B7,B39") motCoverage = 72.38;
if (motString == "A2,B7,B44") motCoverage = 71.75;
if (motString == "A2,B15,B39") motCoverage = 56.90;
if (motString == "A2,B15,B44") motCoverage = 58.79;
if (motString == "A2,B39,B44") motCoverage = 53.37;
if (motString == "A3,A24,B7") motCoverage = 75.50;
if (motString == "A3,A24,B15") motCoverage = 61.93;
if (motString == "A3,A24,B39") motCoverage = 56.61;
if (motString == "A3,A24,B44") motCoverage = 60.21;
if (motString == "A3,B7,B15") motCoverage = 72.04;
if (motString == "A3,B7,B39") motCoverage = 67.76;
if (motString == "A3,B7,B44") motCoverage = 70.67;
if (motString == "A3,B15,B39") motCoverage = 46.71;
if (motString == "A3,B15,B44") motCoverage = 50.71;
if (motString == "A3,B39,B44") motCoverage = 44.68;
if (motString == "A24,B7,B15") motCoverage = 69.54;
if (motString == "A24,B7,B39") motCoverage = 61.52;
if (motString == "A24,B7,B44") motCoverage = 68.08;
if (motString == "A24,B15,B39") motCoverage = 41.08;
if (motString == "A24,B15,B44") motCoverage = 45.28;
if (motString == "A24,B39,B44") motCoverage = 38.94;
if (motString == "B7,B15,B39") motCoverage = 56.26;
if (motString == "B7,B15,B44") motCoverage = 54.05;
if (motString == "B7,B39,B44") motCoverage = 49.18;
if (motString == "B15,B39,B44") motCoverage = 27.29;
if (motString == "A2,A3,A24,B7") motCoverage = 93.84;
if (motString == "A2,A3,A24,B15") motCoverage = 86.53;
if (motString == "A2,A3,A24,B39") motCoverage = 83.30;
if (motString == "A2,A3,A24,B44") motCoverage = 83.80;
if (motString == "A2,A3,B7,B15") motCoverage = 91.82;
if (motString == "A2,A3,B7,B39") motCoverage = 89.62;
if (motString == "A2,A3,B7,B44") motCoverage = 89.43;
if (motString == "A2,A3,B15,B39") motCoverage = 76.96;
if (motString == "A2,A3,B15,B44") motCoverage = 77.86;
if (motString == "A2,A3,B39,B44") motCoverage = 73.92;
if (motString == "A2,A24,B7,B15") motCoverage = 92.16;
if (motString == "A2,A24,B7,B39") motCoverage = 90.07;
if (motString == "A2,A24,B7,B44") motCoverage = 89.36;
if (motString == "A2,A24,B15,B39") motCoverage = 73.21;
if (motString == "A2,A24,B15,B44") motCoverage = 74.32;
if (motString == "A2,A24,B39,B44") motCoverage = 70.06;
if (motString == "A2,B7,B15,B39") motCoverage = 80.76;
if (motString == "A2,B7,B15,B44") motCoverage = 80.51;
if (motString == "A2,B7,B39,B44") motCoverage = 77.36;
if (motString == "A2,B15,B39,B44") motCoverage = 61.98;
if (motString == "A3,A24,B7,B15") motCoverage = 82.88;
if (motString == "A3,A24,B7,B39") motCoverage = 79.75;
if (motString == "A3,A24,B7,B44") motCoverage = 81.88;
if (motString == "A3,A24,B15,B39") motCoverage = 65.06;
if (motString == "A3,A24,B15,B44") motCoverage = 68.28;
if (motString == "A3,A24,B39,B44") motCoverage = 63.41;
if (motString == "A3,B7,B15,B39") motCoverage = 74.53;
if (motString == "A3,B7,B15,B44") motCoverage = 77.06;
if (motString == "A3,B7,B39,B44") motCoverage = 73.22;
if (motString == "A3,B15,B39,B44") motCoverage = 54.28;
if (motString == "A24,B7,B15,B39") motCoverage = 73.61;
if (motString == "A24,B7,B15,B44") motCoverage = 76.35;
if (motString == "A24,B7,B39,B44") motCoverage = 72.20;
if (motString == "A24,B15,B39,B44") motCoverage = 49.05;
if (motString == "B7,B15,B39,B44") motCoverage = 62.74;
if (motString == "A2,A3,A24,B7,B15") motCoverage = 95.71;
if (motString == "A2,A3,A24,B7,B39") motCoverage = 94.67;
if (motString == "A2,A3,A24,B7,B44") motCoverage = 93.70;
if (motString == "A2,A3,A24,B15,B39") motCoverage = 88.37;
if (motString == "A2,A3,A24,B15,B44") motCoverage = 88.49;
if (motString == "A2,A3,A24,B39,B44") motCoverage = 85.71;
if (motString == "A2,A3,B7,B15,B39") motCoverage = 93.01;
if (motString == "A2,A3,B7,B15,B44") motCoverage = 92.44;
if (motString == "A2,A3,B7,B39,B44") motCoverage = 90.69;
if (motString == "A2,A3,B15,B39,B44") motCoverage = 80.14;
if (motString == "A2,A24,B7,B15,B39") motCoverage = 93.97;
if (motString == "A2,A24,B7,B15,B44") motCoverage = 93.61;
if (motString == "A2,A24,B7,B39,B44") motCoverage = 91.55;
if (motString == "A2,A24,B15,B39,B44") motCoverage = 76.79;
if (motString == "A2,B7,B15,B39,B44") motCoverage = 84.59;
if (motString == "A3,A24,B7,B15,B39") motCoverage = 84.64;
if (motString == "A3,A24,B7,B15,B44") motCoverage = 86.40;
if (motString == "A3,A24,B7,B39,B44") motCoverage = 83.72;
if (motString == "A3,A24,B15,B39,B44") motCoverage = 71.13;
if (motString == "A3,B7,B15,B39,B44") motCoverage = 79.27;
if (motString == "A24,B7,B15,B39,B44") motCoverage = 78.75;
if (motString == "A2,A3,A24,B7,B15,B39") motCoverage = 92.02;
if (motString == "A2,A3,A24,B7,B15,B44") motCoverage = 94.75;
if (motString == "A2,A3,A24,B7,B39,B44") motCoverage = 94.25;
if (motString == "A2,A3,A24,B15,B39,B44") motCoverage = 90.05;
if (motString == "A2,A3,B7,B15,B39,B44") motCoverage = 93.36;
if (motString == "A2,A24,B7,B15,B39,B44") motCoverage = 94.72;
if (motString == "A3,A24,B7,B15,B39,B44") motCoverage = 87.89;
if (motString == "A2,A3,A24,B7,B15,B39,B44") motCoverage = 85.57;
    var outString = new String((motCoverage.toString()) + "%");
    ta.value = outString;
    // document.write("<p>"+ outString+"</p>" );
  }

   var motifObject = { 
                       A2:0,
                       A3:0,
                       A24:0,
                       B7:0,
                       B15:0
                     }
///// End script to compute coverage //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
