
/* Create a track object */
function Track(name, author, length, albumid, trackid, location, allowPurchase, productid)
{
    this.UniqueID = GenerateUniqueTrackID(trackid);
    this.TrackName = name;
    this.AuthorName = author;
    this.TrackLength = length;
    this.AlbumID = albumid;
    this.TrackID = trackid;
    this.Location = location;
    this.ProductID = productid;
    this.AllowPurchase = allowPurchase;
    return this;
}

function GenerateUniqueTrackID(trackid)
{
    var randomNumber = parseInt(Math.random()*5000);
    var currentDate = new Date();

    return 'tr' + trackid + '-' + currentDate.getYear() + currentDate.getMonth() + 'a' + currentDate.getDate() + '-' + currentDate.getHours() + currentDate.getMinutes() + currentDate.getSeconds() + '-' + randomNumber;
}