$.tablesorter.addParser({
    id: "figure",
    is: function(s) { 
        // return false so this parser is not auto detected 
        return false; 
    },
    format: function(s) {
        s = s.replace(/^\s+|\s+$/g,"");;
        return s;
    },
    type: "numeric"
});
$.tablesorter.addParser({
    id: "figure_money",
    is: function(s) { 
        // return false so this parser is not auto detected 
        return false; 
    },
    format: function(s) {
        s = s.replace(/^\s+|\s+$/g,"");;
        n = s.replace('$', '');
        return n;
    },
    type: "numeric"
});
$.tablesorter.addParser({
    id: "mil_figure",
    is: function(s) { 
        // return false so this parser is not auto detected 
        return false; 
    },
    format: function(s) {
        s = s.replace(/^\s+|\s+$/g,"");;
        if(s.match(/T$/)) {
            n = s.replace(/T$/,'') * 1000000;
        }
        else if(s.match(/B$/)) {
            n = s.replace(/B$/,'') * 1000;
        }
        else if(s.match(/M$/)) {
            n = s.replace(/M$/,'');
        }
        else {
            n = s.replace('$', '');
        }
        return n;
    },
    type: "numeric"
});
$.tablesorter.addParser({
    id: "mil_figure_money",
    is: function(s) { 
        // return false so this parser is not auto detected 
        return false; 
    },
    format: function(s) {
        s = s.replace(/^\s+|\s+$/g,"");;
        if(s.match(/T$/)) {
            n = s.replace('$','').replace(/T$/,'') * 1000000;
        }
        else if(s.match(/B$/)) {
            n = s.replace('$','').replace(/B$/,'') * 1000;
        }
        else if(s.match(/M$/)) {
            n = s.replace('$','').replace(/M$/,'');
        }
        else {
            n = s.replace('$', '');
        }
        return n;
    },
    type: "numeric"
});

$.tablesorter.addParser({
    id: "overall_rating",
    is: function(s) { 
        // return false so this parser is not auto detected 
        return false; 
    },
    format: function(s) {
        s = s.replace(/^\s+|\s+$/g,"");;
        if(s.match(/^Attractive$/)) {
            n = 2;
        }
        else if(s.match(/^Neutral$/)) {
            n = 1;
        }
        else if(s.match(/^Avoid$/)) {
            n = 0;
        }
        else {
            n = -1;
        }
        return n;
    },
    type: "numeric"
});

/*
 * Table formatter for - Aug. 12 2011
 *   variations:   August 12 09
 */
$.tablesorter.addParser({
    id: "long_date",
    is: function (s) {
        return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2} ([0-9]{4}|'?[0-9]{2})$/));
    }, format: function (s) {
        return $.tablesorter.formatFloat(new Date(s).getTime());
    }, type: "numeric"
});

/*
 * Table formatter for - Jun 23
 *     variations:   september 05
 */
$.tablesorter.addParser({
    id: "month_day",
    is: function (s) {
        return s.match(new RegExp(/^[A-Za-z]{3,10} [0-9]{1,2}$/));
    }, format: function (s) {
        return $.tablesorter.formatFloat(new Date(s).getTime());
    }, type: "numeric"
});
