Date.prototype.addDays = function(days)
{    
    var tmp = this.getTime();
    return new Date(tmp + (days * 86400000));    
}

Date.prototype.format = function(formatStr)
{
    var str = formatStr;
    str = str.replace(/yyyy/gi, this.getFullYear());
    str = str.replace(/mm/gi, this.getMonth()+1);
    str = str.replace(/dd/gi, this.getDate());
    return str;
}
