String.prototype.startsWith = function(str)
{ return (this.match("^" + str) == str) }

String.prototype.endsWith = function(str)
{ return (this.match(str + "$") == str) }

String.prototype.cut = function(length) {
    if (this.length > length) {
        return this.substring(0, length) + '...';
    }

    return this.toString();
}

String.prototype.cutWord = function(length) {
    if (this.length > length
        && this.indexOf('-') == -1
        && this.indexOf(' ') == -1
    ) {
        return this.substring(0, length) + '...';
    }

    return this.toString();
}

function getNumericOrder(val) {
    var valNumericOrder = (Math.round(parseFloat(val) * 100) / 100) + '';
    valNumericOrder = valNumericOrder.replace('-', '0');

    if (valNumericOrder.indexOf('.') != -1) {
        var decimalPlaces = valNumericOrder.substring(valNumericOrder.indexOf('.')).length - 1;

        if (decimalPlaces == 1) {
            valNumericOrder += '0';
        }
    }

    var i;
    for (i = 0; i < 10; i++) {
        if (valNumericOrder.length < 10) {
            valNumericOrder = '0' + valNumericOrder;
        }
    }

    if (val < 0) {
        valNumericOrder = '-' + valNumericOrder;
    }

    return valNumericOrder;
}
