﻿function ValidateSearchBoxIsFilled(source, value) {

    var input = jQuery(document.getElementById(source.controltovalidate));
    var selectList = input.parents('div.subRoundedBox').find('select.uiDdlCustopmCategories');

    alert(selectList.get(0).selectedIndex);

    if (!input || !selectList) {
        value.IsValid = false;
        return false;
    }

    if (Trim(input.attr('value')).length && selectList.get(0).selectedIndex == 0) {
        value.IsValid = false;
        return false;
    }

    value.IsValid = true;
    return true;
}

function Trim(str) {
    return str.replace(/^\s+|\s+$/g, '');
}
