function quicksort(vec, loBound, hiBound, tot) {

		var pivot, pivot2, loSwap, hiSwap, temp;

		// Two items to sort
		if (hiBound - loBound == 1)
		{
			if (vec[loBound].toUpperCase() > vec[hiBound].toUpperCase())
			{
				temp = vec[loBound];
				vec[loBound] = vec[hiBound];
				vec[hiBound] = temp;

				temp = tot[loBound];
				tot[loBound] = tot[hiBound];
				tot[hiBound] = temp;
			}
			return;
		}

		// Three or more items to sort
		pivot = vec[parseInt((loBound + hiBound) / 2)];
		vec[parseInt((loBound + hiBound) / 2)] = vec[loBound];
		vec[loBound] = pivot;

		pivot2 = tot[parseInt((loBound + hiBound) / 2)];
		tot[parseInt((loBound + hiBound) / 2)] = tot[loBound];
		tot[loBound] = pivot2;

		loSwap = loBound + 1;
		hiSwap = hiBound;

		do {
			// Find the right loSwap
			while (loSwap <= hiSwap && vec[loSwap].toUpperCase() <= pivot.toUpperCase())
				loSwap++;

			// Find the right hiSwap
			while (vec[hiSwap].toUpperCase() > pivot.toUpperCase())
				hiSwap--;

			// Swap values if loSwap is less than hiSwap
			if (loSwap < hiSwap)
			{
				temp = vec[loSwap];
				vec[loSwap] = vec[hiSwap];
				vec[hiSwap] = temp;

				temp = tot[loSwap];
				tot[loSwap] = tot[hiSwap];
				tot[hiSwap] = temp;
			}
		} while (loSwap < hiSwap);

		vec[loBound] = vec[hiSwap];
		vec[hiSwap] = pivot;

		tot[loBound] = tot[hiSwap];
		tot[hiSwap] = pivot2;

		// Recursively call function...  the beauty of quicksort

		// 2 or more items in first section		
		if (loBound < hiSwap - 1)
			quicksort(vec, loBound, hiSwap - 1, tot);


		// 2 or more items in second section
		if (hiSwap + 1 < hiBound)
			quicksort(vec, hiSwap + 1, hiBound, tot);
}
