function sortRowsBySubjectAscending(a, b) {
var subjectOne = getTextContent(a.getElementsByTagName("td")[0]).toLowerCase();
var subjectTwo = getTextContent(b.getElementsByTagName("td")[0]).toLowerCase();
- return (subjectOne.charCodeAt(0) - subjectTwo.charCodeAt(0));
+ return strcmp(subjectOne, subjectTwo);
}
function sortRowsBySubjectDescending(a, b) {
var subjectOne = getTextContent(a.getElementsByTagName("td")[0]).toLowerCase();
var subjectTwo = getTextContent(b.getElementsByTagName("td")[0]).toLowerCase();
- return (subjectTwo.charCodeAt(0) - subjectOne.charCodeAt(0));
+ return strcmp(subjectOne, subjectTwo);
}
function sortRowsByFromAscending(a, b) {
var fromOne = getTextContent(a.getElementsByTagName("td")[1]).toLowerCase();
var fromTwo = getTextContent(b.getElementsByTagName("td")[1]).toLowerCase();
- return (fromOne.charCodeAt(0) - fromTwo.charCodeAt(0));
+ return strcmp(fromOne, fromTwo);
}
function sortRowsByFromDescending(a, b) {
var fromOne = getTextContent(a.getElementsByTagName("td")[1]).toLowerCase();
var fromTwo = getTextContent(b.getElementsByTagName("td")[1]).toLowerCase();
- return (fromTwo.charCodeAt(0) - fromOne.charCodeAt(0));
+ return strcmp(fromOne, fromTwo);
}
function CtdlMessageListClick(evt) {
function CtdlRandomString() {
return((Math.random()+'').substr(3));
}
+function strcmp ( str1, str2 ) {
+ // http://kevin.vanzonneveld.net
+ // + original by: Waldo Malqui Silva
+ // + input by: Steve Hilder
+ // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + revised by: gorthaur
+ // * example 1: strcmp( 'waldo', 'owald' );
+ // * returns 1: 1
+ // * example 2: strcmp( 'owald', 'waldo' );
+ // * returns 2: -1
+
+ return ( ( str1 == str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) );
+}
function emptyElement(element) {
childNodes = element.childNodes;