BwClasses["BwLabelWithRank"] = BwLabelWithRank;

function BwLabelWithRank ()
{
	this.isa = BwWidget;
	this.isa();
	
	this.initFromDOM = BwLabelWithRank.initFromDOM;
	
	this.setValue = BwLabelWithRank.setValue;
	this.getValue = BwLabelWithRank.getValue;

}

BwLabelWithRank.newInstance = function (label, ranki)
{
    var self = document.createElement ("DIV");

	self.BwClass = BwLabelWithRank;
	self.BwClass();
	
	self.className = "BwLabel";
	
    self.setAttribute ("text", label);

    /* for ranking number */
    self.setAttribute ("rank", BwNumber.addZero(ranki, 10));
    
	self.initFromDOM();
    return self;
};

BwLabelWithRank.initFromDOM = function ()
{
	BwWidget.initFromDOM.call (this);
	
	this.style.display="inline";
	this.style.MozUserSelect="none";
	this.style.cursor="default";
	this.onselectstart=function(){return false;};

	var txt = this.getAttribute ("text");
	if (txt != null) {
		this.setValue(txt);
	}
	return false;
};

BwLabelWithRank.getValue = function ()
{   
    var rank = this.getAttribute ("rank");
    if (rank != null)
    	return rank;

    return 0;
};

BwLabelWithRank.setValue = function (txt)
{
	this.innerHTML = txt;
};

