
var InputUsability = Class.create();

InputUsability.prototype = {
	_text:"",
	_target:null,

	initialize:function(text, target) {
		var scope = this;
		this._text = text;
		this._target = target;
		this._target.onfocus = function(){scope.onfocusCallback(this)}
		this._target.onblur = function(){scope.onblurCallback(this)}
	
	},
	onfocusCallback:function(elm) {
		if (elm.value == this._text) {
			elm.value = "";
		} else {
			elm.select();
		}
	},
	onblurCallback:function(elm) {
		if (elm.value.length == 0) {
			elm.value = this._text;
		}
	}
}

Event.observe(window, 'load', function(){new InputUsability("メールアドレスを入力", $("input_email"))}, false);

