function Isbn(code)
{
	if(code instanceof Ean)
	{
		// isbn :    2203373873
		// ean  : 9782203373877
		this.code=code.toString().substr(3,9)+"0";
		this.corrected();
	}
	else
		this.code=code;
}

Isbn.prototype.toString = function()
{
	return this.code.toString();
}

Isbn.prototype.key = function()
{
	var key= 0;
	var weight = 10;
	for (var i=0;i<9;i++)
	{
		var c = this.code.charAt(i);
		key += c*weight;
		key %= 11;
		weight--;
	}
	key = 11 - key;
	key %= 11;
	key = "0123456789X"[key];
	
	return key;
}

Isbn.prototype.check = function()
{
	return this.key()==this.code.substr(9,1);
}

Isbn.prototype.corrected = function()
{
	this.code=this.code.substr(0,9)+this.key();
	return this;
}

