/*
	Contains helper functions for general purpose
*/

		// sort option strings of a select box
	function sortSelect(selElem) {
	 if (selElem.options.length > 1)
	 quicksortOptions(selElem.options, 0, selElem.options.length - 1);
	}
	
		// do the sort of option strings of a select box in quick sort manner
	function quicksortOptions(o, l, h) {
	 var tv, tt, i = l, j = h, x = o[Math.floor((l + h) / 2)];
	 while (i <= j) {
	  while (o[i].text < x.text) i++;
	  while (o[j].text > x.text) j--;
	  if (i <= j) {
	   tt = o[i].text;
	   tv = o[i].value;
	   o[i].text = o[j].text;
	   o[i].value = o[j].value;
	   o[j].text = tt;
	   o[j].value = tv;
	   i++;
	   j--;
	  }
	 }
	 if (l < j) quicksortOptions(o, l, j);
	 if (i < h) quicksortOptions(o, i, h);
	}

	
