﻿Array.prototype.contains = function (obj) {
    var i = this.length;
    while (i--) {
        if (this[i] === obj) {
            return true;
        }
    }
    return false;
}

Array.prototype.add = function (obj, unique) {
    var f = false;
    
    for (e in this) {
        if (e == obj) {
            f = true;
            break;
        }
    }

    if (!f || !unique) {
        this.push(obj);
    }
}
