//class Password
Password = function ()
{
	this.element = null;
	this.text = null;
	this.value = null;
}

Password.prototype = new Control();

Password.prototype.getDocumentElement = function ()
{
	return this.element;
}

Password.prototype.setDocumentElement = function (newElement)
{
	this.element = newElement;
}

Password.prototype.getText = function ()
{
	return this.text;
}

Password.prototype.setText = function (newText)
{
	this.text = newText;
}

Password.prototype.getValue = function ()
{
	return this.value;
}

Password.prototype.setValue = function (newValue)
{
	this.value = newValue;
}

Password.prototype.select = function ()
{
	var input = document.getElementById(this.element.id + "_value");
	input.focus();
	try
	{
		input.select();
	}
	catch (ex) { }
}

Password.prototype.setView = function ()
{
	var input = document.getElementById(this.element.id + "_value");
	input.value = this.value;
}

Password.prototype.setModel = function ()
{
	var input = document.getElementById(this.element.id + "_value");
	this.text = input.value.replace(/./g, "*");
	this.value = input.value; //TODO: request to get code
}

//static variables and methods
Password.existent = new Array();

Password.create = function (passwordId, editable)
{
	Password.existent[passwordId] = new Password();
	Password.existent[passwordId].setDocumentElement(
		document.getElementById(passwordId));
	Password.existent[passwordId].setEditable(editable);
	Control.register(passwordId, Password.existent[passwordId]);
	return Password.existent[passwordId];
}

Password.get = function (textboxId)
{
	return Password.existent[textboxId];
}