<script>

my_array  = new Array('flavio','gomes','de','araujo','pego');
el_array  = new Array(9,8,7,65,4,7,8,9,6,47,9);
tim_array = new Array(0.129872,0.164749,0,10.1961,10.5643,1003,100,104.813049,10,11.390914,1121);

function sort2(el1,el2)
{
 if (el1 == parseFloat(el1)) el1 = parseFloat(el1);
 if (el2 == parseFloat(el2)) el2 = parseFloat(el2);

 if (el1 < el2) {return -1}
  else if (el1 > el2) {return 1}
  else {return 0}
}

function sorting(array)
{
  //array = array.toString().split(',');
    // uncomment the above line to ensure the array 
    // to be passed through value and not by reference 

  while(1) //will run until..
  { aaa = array.toString();  //get array by value

    for(x=0;array[x+1] && true;x++)
    { diff = sort2(array[x],array[x+1]);
      if (diff > 0)
      { item       = array[x+1];
        array[x+1] = array[x];
        array[x]   = item;
      }
    }
    if (aaa == array) break; //aaa and array is the same 
                             // (so, it's sorted)
  }
  return array;
}


document.write('<br>'+sorting(el_array));
document.write('<br>'+sorting(my_array));
document.write('<br>'+sorting(tim_array));
</script>