﻿search = function () { }

search.prototype.txt_keyword = null;
search.prototype.tooltip = 'Search here...';
search.prototype.initColor = '#bbbbbb';
search.prototype.origColor = null;

search.prototype.init = function () {
    var s = this;

    this.txt_keyword = $('input[id$=txt_keyword]');
    this.origColor = this.txt_keyword.css('color');

    this.txt_keyword.val(s.tooltip).css('color', this.initColor);

    this.txt_keyword
        .focus(function () {
            if ($(this).val() == s.tooltip)
                $(this).val('').css('color', s.origColor);
        })
        .blur(function () {
            if ($(this).val() == '')
                $(this).val(s.tooltip).css('color', s.initColor);
        });
};

search.prototype.searchKeyword = function () {
    if (this.txt_keyword.val().length < 1 || this.txt_keyword.val() == this.tooltip) {
        this.txt_keyword.val(this.tooltip).css('color', this.initColor);
        return false;
    }
};

$(function () {
    search = new search();
    search.init();
});


