
function IsValidSearch(txtBoxID, noInputMessage, InputInvalid, defaultSearchValue) {
    var txtBoxValue = document.getElementById(txtBoxID).value;
    var regExpBeginning = /^\s+/;
    var regExpEnd = /\s+$/;
    var filter = /^[^<>]+$/;

    txtBoxValue = txtBoxValue.replace(regExpBeginning, '').replace(regExpEnd, '');

    if (document.getElementById(txtBoxID).value == defaultSearchValue) {
        alert(noInputMessage);
        return false;
    }
    if (!filter.test(txtBoxValue) && txtBoxValue.length > 0) {
        alert(InputInvalid);
        return false;
    }
    if (txtBoxValue.length > 0 && txtBoxValue.indexOf('?') == -1) {
        return true;
    }
    else {
        alert(noInputMessage);
        return false;
    }
}