var ClearInputText = Class.create();
ClearInputText.prototype = {
	
	// コンストラクタ
	initialize: function(inputClear, inputText) {
		// ユーザー設定項目
		// クリアーボタンオブジェクト
		this.inputClear = inputClear;
		// input textオブジェクト
		this.inputText = inputText;
		
		this._processInitialize();
	},
	
	// インスタンス化時の処理を行います。
	_processInitialize: function() {
		this.inputClear = $(this.inputClear);
		this.inputText = $(this.inputText);
		
		if (!this.inputClear) {
			throw 'Error: Not found the inputClear button.'; 
		}
		if (!this.inputText) {
			throw 'Error: Not found the inputText input.'; 
		}
		
		Event.observe(this.inputClear, 'click', this._processClearOnClick.bind(this));
		Event.observe(this.inputClear, 'keypress', this._processClearOnKeyPress.bind(this));
		Event.observe(this.inputClear, 'keyup', this._processClearOnKeyUp.bind(this));
	},
	
	// クリアーボタンのクリック時の処理を行います。
	_processClearOnClick: function(event) {
		this._deleteInputTextValue();
	},
	
	// クリアーボタンのkeyPress時の処理を行います。
	_processClearOnKeyPress: function(event) {
		Event.stop(event);
	},
	
	// クリアーボタンのkeyUp時の処理を行います。
	_processClearOnKeyUp: function(event) {
		this._deleteInputTextValue();
	},
	
	// input textオブジェクトの値を消去します。
	_deleteInputTextValue: function() {
		this.inputText.clear();
	}
};