okRating.prototype.display = function(data)
{
    if (typeof(data.profileId) == 'undefined') return;

    var container = document.getElementById(this.containerId);
    if (container == undefined) {
        alert("Container ("+this.containerId+") not found.");
        return false;
    }

    while (container.firstChild)
    {
        container.removeChild(container.firstChild);
    }
            
    this.profile_id = data.profile_id;
    html = "<div class='user-rating' id='"+this.name+"userRating'>";
    if (this.e_id == '') {
    html += "<a id='"+this.name+"rate1' title='Click to Login' href='javascript:void(0);' onclick='alert(\""+this.loginMsg+"\"); return false' onmouseover='"+this.name+".setStars(1);' onmouseout='"+this.name+".resetStars();'>1 Stars</a>";
    html += "<a id='"+this.name+"rate2' title='Click to Login' href='javascript:void(0);' onclick='alert(\""+this.loginMsg+"\"); return false' onmouseover='"+this.name+".setStars(2);' onmouseout='"+this.name+".resetStars();'>2 Stars</a>";
    html += "<a id='"+this.name+"rate3' title='Click to Login' href='javascript:void(0);' onclick='alert(\""+this.loginMsg+"\"); return false' onmouseover='"+this.name+".setStars(3);' onmouseout='"+this.name+".resetStars();'>3 Stars</a>";
    html += "<a id='"+this.name+"rate4' title='Click to Login' href='javascript:void(0);' onclick='alert(\""+this.loginMsg+"\"); return false' onmouseover='"+this.name+".setStars(4);' onmouseout='"+this.name+".resetStars();'>4 Stars</a>";
    html += "<a id='"+this.name+"rate5' title='Click to Login' href='javascript:void(0);' onclick='alert(\""+this.loginMsg+"\"); return false' onmouseover='"+this.name+".setStars(5);' onmouseout='"+this.name+".resetStars();'>5 Stars</a>";
    } else {
    html += "<a id='"+this.name+"rate1' title='Click to Rate 1 Star or Press 1' href='javascript:void(0);' onclick='"+this.name+".setRate(1);' onmouseover='"+this.name+".setStars(1);' onmouseout='"+this.name+".resetStars();'>1 Stars</a>";
    html += "<a id='"+this.name+"rate2' title='Click to Rate 2 Star or Press 2' href='javascript:void(0);' onclick='"+this.name+".setRate(2);' onmouseover='"+this.name+".setStars(2);' onmouseout='"+this.name+".resetStars();'>2 Stars</a>";
    html += "<a id='"+this.name+"rate3' title='Click to Rate 3 Star or Press 3' href='javascript:void(0);' onclick='"+this.name+".setRate(3);' onmouseover='"+this.name+".setStars(3);' onmouseout='"+this.name+".resetStars();'>3 Stars</a>";
    html += "<a id='"+this.name+"rate4' title='Click to Rate 4 Star or Press 4' href='javascript:void(0);' onclick='"+this.name+".setRate(4);' onmouseover='"+this.name+".setStars(4);' onmouseout='"+this.name+".resetStars();'>4 Stars</a>";
    html += "<a id='"+this.name+"rate5' title='Click to Rate 5 Star or Press 5' href='javascript:void(0);' onclick='"+this.name+".setRate(5);' onmouseover='"+this.name+".setStars(5);' onmouseout='"+this.name+".resetStars();'>5 Stars</a>";
    }
    html += "</div>";
    html += "<div id='"+this.name+"userHover' class='user-hover'></div>";
    html += "<div id='"+this.name+"ratingBase' class='rating-base'></div>";
    html += "<span class='lightgray'><i>";
    if(data.votes == 0){
        html += "(Be the first to rate";
    }else{
        if(data.votes == 1){
            html += "(Based on "+data.votes+" rating";
        }else{
            html += "(Based on "+data.votes+" ratings";
        }
    }
    if(data.profileRating > 0){
        html += " - you rated <span id='user_rated'>" + data.profileRating + '</span>';
    }
    html += ")";
    html += "</i></span>";
    html += "<div class='clear'></div>";

    container.innerHTML = html;
    if (data.user_rating > 0) {
        this.setRate(data.user_rating, 0);
    } else {
        this.rateSet = data.average;
        this.setRate(data.average, 0);
    }
}
