fixed colspan length, added row orderBy
removed redundant functions
changed Array sort function return numbers in compliance with ECMA Script 5.1