/**
 * @author pop webdev [cn]
 * @version: 0.1.
 * @classDescription: insures search input is not empty
 * @dependencies: Prototype v1.6.1
 */
// start VerifySearchbox
var VerifySearchbox = Class.create({
	initialize: function(form,txtLabel,txtInput,submitBtn)
	{
		this.form = form;
		this.txtLabel = txtLabel;
		this.txtInput = txtInput;
		this.submitBtn = submitBtn;
		this.form.observe('keypress', this.__keyPress.bindAsEventListener(this));
		this.submitBtn.observe('click', this.__click.bindAsEventListener(this));
	},
	__keyPress: function(e)
	{
		if ((e.keyCode == Event.KEY_RETURN))
		{
			e.stop();
			var txtInputVal = $F(this.txtInput);
			if (!txtInputVal == '') {
				this.submitBtn.click();
			}
		}
	},
	__click: function(e)
	{
		var txtInputVal = $F(this.txtInput);
		if ((txtInputVal == '') || (txtInputVal == this.txtLabel.innerHTML))
		{
			e.stop();
		}
	}
});
// end VerifySearchbox

