  function quickSort(tbody, reverse, clickedColumnIndex, left, right, special)
  {
    var a, b;
    var s;
    passFlag=1;

    a = left;
    b = right;
    middleRow = tbody.children[parseInt((left+right)/2)];
    if(special!='integerComparison')
    {
      middleRowSortByValue=middleRow.children[clickedColumnIndex].innerText;
    }
    else
    {
      middleRowSortByValue=parseInt(middleRow.children[clickedColumnIndex].innerText);
    }

    while(a<=b||(passFlag==1))
    {   
      if(!reverse)
      {
        if(special!='integerComparison')
        {
          while(tbody.children[a].children[clickedColumnIndex].innerText.toLowerCase()<middleRowSortByValue.toLowerCase() && a<right)
          {
            a++;
          }
          while(middleRowSortByValue.toLowerCase()<tbody.children[b].children[clickedColumnIndex].innerText.toLowerCase() && b>left)
          {
            b--;
          }
        }
        else
        {
          while(parseInt(tbody.children[a].children[clickedColumnIndex].innerText)<middleRowSortByValue && a<right)
          {
            a++;
          }
          while(middleRowSortByValue<parseInt(tbody.children[b].children[clickedColumnIndex].innerText) && b>left)
          {
            b--;
          }
        }
      }
      else
      {
        if(special!='integerComparison')
        {
          while(tbody.children[a].children[clickedColumnIndex].innerText.toLowerCase()>middleRowSortByValue.toLowerCase() && a<right)
          {
            a++;
          }
          while(middleRowSortByValue.toLowerCase()>tbody.children[b].children[clickedColumnIndex].innerText.toLowerCase() && b>left)
          {
            b--;
          }      
        }
        else
        {
          while(parseInt(tbody.children[a].children[clickedColumnIndex].innerText)>middleRowSortByValue && a<right)
          {
            a++;
          }
          while(middleRowSortByValue>parseInt(tbody.children[b].children[clickedColumnIndex].innerText) && b>left)
          {
            b--;
          }
        }
      }
      if(a<=b)
      {
         tbody.children[a].swapNode(tbody.children[b]);
         a++;
         b--;
      }
      passFlag=0;
    }
    if(left<b)  quickSort(tbody, reverse, clickedColumnIndex, left, b, special);   /* recursion */
    if(a<right) quickSort(tbody, reverse, clickedColumnIndex, a, right, special);  /* recursion, again */
  }
