
/* Represents a basic cell in the Leaderboard grid */
function BaseCell()
{
    /* This object contains the properties necessary to create an HTML 'td' element */
    this.MarkupObj = null;
    
    /*
        Compares the current cell with otherCell.
        This function returns the following:
             -1 if this cell is smaller than otherCell
             0 if this cell is equal to otherCell
             1 if this cell is greater than otherCell
    */
    this.Compare = function(otherCell)
    {
        return -1;
    };
    
    this.Render = function()
    {
        var td = document.createElement("td");
        td.className = this.MarkupObj.Classname;
        td.innerHTML = this.MarkupObj.Contents;
        return td;
    }
}


/* Represents a cell in the Application column */
function ApplicationCell(appName, markupObj)
{
    BaseCell.call(this);
    
    this.ApplicationName = appName;
    this.MarkupObj = markupObj;
    
    this.Compare = function(otherCell)
    {
        if (this.ApplicationName.toLowerCase() < otherCell.ApplicationName.toLowerCase())
            return -1;
        else if (this.ApplicationName.toLowerCase() > otherCell.ApplicationName.toLowerCase())
            return 1;
        else
            return 0;
    };
}

/* Represents a cell in the Developer column */
function DeveloperCell(developerName, markupObj)
{
    BaseCell.call(this);
    
    this.DeveloperName = developerName;
    this.MarkupObj = markupObj;
    
    this.Compare = function(otherCell)
    {
        if (this.DeveloperName.toLowerCase() < otherCell.DeveloperName.toLowerCase())
            return -1;
        else if (this.DeveloperName.toLowerCase() > otherCell.DeveloperName.toLowerCase())
            return 1;
        else
            return 0;
    };
}

/* Represents a cell in the one of the earnings column */
function EarningsCell(amount, markupObj)
{
    BaseCell.call(this);
    
    this.Amount = amount;
    this.MarkupObj = markupObj;
    
    this.Compare = function(otherCell)
    {
        if (this.Amount < otherCell.Amount)
            return -1;
        else if (this.Amount > otherCell.Amount)
            return 1;
        else
            return 0;
    };
}

/* Represents a cell in the Source column */
function SourceCell(markupObj)
{
    BaseCell.call(this);
    
    this.MarkupObj = markupObj;
    
    this.DomainList = {
        'SourceHigh': 0,
        'SourceMiddle': 0,
        'SourceLow': 0
    };
}