var promptInput = {};
//------------------------------------------------------------------------------
promptInput.init = function(id, promptStr, baseClass){
	var e = document.getElementById( id );
	if(e){
		e.promptStr   = promptStr;
		e.baseClass   = baseClass;
		e.value       = e.value;
		core.addEvent(e, "focus", this.onfocus);
		core.addEvent(e, "blur",  this.onblur);
		e.updateClass = this.updateClass;
		e.updateValue = this.updateValue;
		e.getValue    = this.getValue;
		e.updateValue();
		e.updateClass();
	}
};
//------------------------------------------------------------------------------
promptInput.onfocus = function(E){
	var e = core.getTarget(E);
	if(e.value == e.promptStr)
		e.value = "";
	else
		e.select();
	e.updateClass();
};
//------------------------------------------------------------------------------
promptInput.onblur = function(E){
	var e = core.getTarget(E);
	e.updateValue();
	e.updateClass();
};
//------------------------------------------------------------------------------
promptInput.updateClass = function(){
	var base = this.baseClass;
	if(base.lenth)base += " ";
	if(this.value == this.promptStr && this.promptStr.length)
		this.className = base + "promptOn";
	else
		this.className = base + "promptOff";
};
//------------------------------------------------------------------------------
promptInput.updateValue = function(){
	if(this.value == "")
		this.value = this.promptStr;
};
//------------------------------------------------------------------------------
promptInput.getValue = function(){
	if(this.value == this.promptStr)
		return "";
	else
		return this.value;
};
//------------------------------------------------------------------------------
