﻿var SEARCH_FIELD_STRING = 'Поиск запчастей по коду';


$(document).ready(function () {
    // Строка поиска
    $('#SearchFieald')
        .val(SEARCH_FIELD_STRING)
        .click(function () { if (this.value == SEARCH_FIELD_STRING) this.value = ''; })
        .blur(function () { if (this.value == '') this.value = SEARCH_FIELD_STRING; });

    // Подсветка строк таблиц данных
    $("table.data tr:not(.footer) > td.dxgv:not(.group-col)")
        .mouseenter(function () { $(this).parent().find("td.dxgv:not(.group-col)").addClass("focused"); })
        .mouseleave(function () { $(this).parent().find("td").removeClass("focused"); });
    $("table.data tr.complex > td")
        .mouseenter(function () { $(this).parent().find("td").addClass("focused"); })
        .mouseleave(function () { $(this).parent().find("td").removeClass("focused"); });
});


function CheckSearchString() {
    if ($('#SearchFieald').val() == SEARCH_FIELD_STRING) {
        $('#SearchFieald').focus().trigger("click");
        return false;
    } 
    return true;
}


function AddStringToSearch(str) {
    $('#SearchFieald').val(str);
}
