function Sorting(){this.sortSelect=sortSelect;function sortSelect(selectToSort,ascendingOrder,lang){if(lang=="th"){var sortOptions=[];for(var loop=0;loop<selectToSort.length;loop++){sortOptions[loop]={optText:GetChar(selectToSort[loop].optText),optValue:selectToSort[loop].optValue};}if(ascendingOrder){sortOptions.sort(sortFuncAsc);}else{sortOptions.sort(sortFuncDesc);}var myOptions=[];for(var loop=0;loop<sortOptions.length;loop++){var no=findNo(sortOptions[loop].optValue,selectToSort);myOptions[loop]={optText:selectToSort[no].optText,optValue:selectToSort[no].optValue};}return myOptions;}else{if(ascendingOrder){selectToSort.sort(sortFuncAsc);}else{selectToSort.sort(sortFuncDesc);}return selectToSort;}}function findNo(value,myOptions){for(var i=0;i<myOptions.length;i++){if(value==myOptions[i].optValue){return i;}}return 0;}function GetChar(word){var newWord="";for(var i=0;i<word.length;i++){var ch=word.substring(i,i+1);if(isAlphabet(ch)){newWord+=ch;}}return newWord;}function isAlphabet(ch){var ascii=Asc(ch);if(ascii>=3585&&ascii<=3630){return true;}else{return false;}}function Asc(String){return String.charCodeAt(0);}function Chr(AsciiNum){return String.fromCharCode(AsciiNum);}function sortFuncAsc(record1,record2){var value1=record1.optText.toLowerCase();var value2=record2.optText.toLowerCase();if(value1>value2){return 1;}if(value1<value2){return-1;}return 0;}function sortFuncDesc(record1,record2){var value1=record1.optText.toLowerCase();var value2=record2.optText.toLowerCase();if(value1>value2){return-1;}if(value1<value2){return 1;}return 0;}}function SortingArray(){this.sortSelect=sortSelect;function sortSelect(selectToSort,ascendingOrder,lang){if(lang=="th"){var sortOptions=[];for(var loop=0;loop<selectToSort.length;loop++){sortOptions[loop]={optText:GetChar(selectToSort[loop].optText),optValue:selectToSort[loop].optValue};}if(ascendingOrder){sortOptions.sort(sortFuncAsc);}else{sortOptions.sort(sortFuncDesc);}var myOptions=[];for(var loop=0;loop<sortOptions.length;loop++){var no=findNo(sortOptions[loop].optValue,selectToSort);myOptions[loop]={optText:selectToSort[no].optText,optValue:selectToSort[no].optValue};}return myOptions;}else{if(ascendingOrder){selectToSort.sort(sortFuncAsc);}else{selectToSort.sort(sortFuncDesc);}return selectToSort;}}function findNo(value,myOptions){for(var i=0;i<myOptions.length;i++){if(value==myOptions[i].optValue){return i;}}return 0;}function GetChar(word){var newWord="";for(var i=0;i<word.length;i++){var ch=word.substring(i,i+1);if(isAlphabet(ch)){newWord+=ch;}}return newWord;}function isAlphabet(ch){var ascii=Asc(ch);if(ascii>=3585&&ascii<=3630){return true;}else{return false;}}function Asc(String){return String.charCodeAt(0);}function Chr(AsciiNum){return String.fromCharCode(AsciiNum);}function sortFuncAsc(record1,record2){var value1=record1.optText.toLowerCase();var value2=record2.optText.toLowerCase();if(value1>value2){return 1;}if(value1<value2){return-1;}return 0;}function sortFuncDesc(record1,record2){var value1=record1.optText.toLowerCase();var value2=record2.optText.toLowerCase();if(value1>value2){return-1;}if(value1<value2){return 1;}return 0;}}