    function clickCounter(peerCount, indexCount, currentClick)
    {
      var count = 0;
      var checkTotal = 0;
      var checkBox;
      
      while(count<peerCount)
      {
        checkBox = document.getElementById('peer' + count);
        
        try
        {
            if (checkBox.checked == true)
            {
                checkTotal++;
            }
            count++;
        }
        catch(err)
        {
            count++;
        }
      }
      
      count = 0;
      
      while(count<indexCount)
      {
        checkBox = document.getElementById('index' + count);
        
        try
        {
            if (checkBox.checked == true)
            {
                checkTotal++;
            }
            count++;
        }
        catch(err)
        {
            count++;
        }
      }
      
      
      try
      {
        checkBox = document.getElementById('divyield');
        
        try
        {
            if (checkBox.checked == true)
            {
                    checkTotal++;
            }
        }
        catch(err)
        {
        }
      }
      catch(err)
      {
      }
      
      try
      {    
        checkBox = document.getElementById('treturn');
        
        try
        {
            if (checkBox.checked == true)
            {
                    checkTotal++;
            }
        }
        catch(err)
        {
        }
      }
      catch(err) {}
      
      if (checkTotal > 9)
    {
    alert('10 is the maximum number of items allowed.');
    currentClick.checked = false;
    }
    }

    function fillSubmitData(peerCount, indexCount)
    {
      var count = 0;
      var peer;
      var index;
      var downloadPeer;
      
      while (count<peerCount)
      {
        peer = document.getElementById('peer' + count);
        downloadPeer = document.getElementById('_peer' + count);
        
        downloadPeer.value = "";
        if (peer.checked == true)
        {
          downloadPeer.value = peer.value;
        }
        count++;
      }
      
      count = 0;
      
      while (count<indexCount)
      {
        index = document.getElementById('index' + count);
        downloadPeer = document.getElementById('_index' + count);
        
        downloadPeer.value = "";
        if (index.checked == true)
        {
          downloadPeer.value = index.value;
        }
        count++;
      }
      
      var period = document.getElementById('period');
      var download = document.getElementById('_period');
      download.value = period.value;
    }
    
    function fillDownloadPeriod()
    {
      var period; 
      period = document.getElementById('period');
      var downloadPeriod; 
      downloadPeriod = document.getElementById('__period');
      
      downloadPeriod.value = period.value;
    }
    
    function expandIFrame(width, defaultHeight, peerCount, indexCount)
    {
      var iFrame = document.getElementById('theIFrame');
      var count = 0;
      var total = 0;
      var amountToAdd = 0;
      var indexTotal = 0;
      var peer;
      var index;
      
      while (count < peerCount)
      {
        peer = document.getElementById('peer' + count);
        
        try
        {
            if (peer.checked == true)
            {
                total++;
            }
        
            count++;
        }
        catch(err)
        {
            count++;
        }        
      }
      
      count = 0;
      
      while (count < indexCount)
      {
        index = document.getElementById('index' + count);
        
        try
        {
            if (index.checked == true)
            {
                total++;
                indexTotal++;
            }
        
            count++;
        }
        catch(err)
        {
            count++;
        }
      }
      
      var halfHeight = (defaultHeight / 2) - 35;      
      amountToAdd = (total * 17) + (indexTotal * 9);
      halfHeight = halfHeight + amountToAdd;
      
      var loadingString = "<div style=\"width:" + width + "px;margin-top:" + halfHeight + "px;margin-left:auto;margin-right:auto;font-size:30px;text-align:center;\">";
      loadingString = loadingString + "<object width=\"75\" height=\"75\"><param name=\"movie\" value=\"images/graphing/loading.swf\" /><param name=\"wmode\" value=\"transparent\"><embed src=\"images/graphing/loading.swf\" wmode=\"transparent\" width=\"75\" height=\"75\" /></object></div>";
      frames['theIFrame'].document.getElementById('gContent').innerHTML = loadingString;
      iFrame.height = defaultHeight + amountToAdd;
    }

