/**
 * User: Thomas
 * Date: 12.01.2011
 * Time: 12:54:23
 */
/*
var search_note = "\
<b>Search Info</b><br /><br />\
Enter the name of your printer or the part number of the ink catridge or toner module into the serach field. \
After clicking on the 'GO' button you will be presented with a selection of the products found.<br /><br />\
If you do not remember the exact part number, you may also just enter a partial term. \
E.g. if you know that your printer model contains the number 155, just enter that number.<br /><br />\
If our search engine does not find an exact match, you will see a selection of products and/or printer \
models that include your search expression.<br /><br />\
It is also possible to enter a SKU or a text like e.g. 'laminieren'. \
With the pattern truncate feature enabled, this would also find 'Laminiergerät'.\
";
*/
function search()
{
  $('#search-ajax-feedback').html($('#search-ajax-wait').html());
  $('.ss_result').html('');
  $.post("/specialsearch.php",
         $('#search_form').serialize(),
         function(data)
         {
           $('#welcome_hdr').html('<br/><br/>');
           $('#search-ajax-feedback').html('');
           $('#result_header').html(data.header);
           $('#products_header').html(data.products_header);
           if (data.products_result)
           {
             $('#products_info').html(data.products_info);
             $('#products_result').html(data.products_result);
             $('#product-grid table.ts-grid-gtable').tablesorter(
             {
               headers: { 5: { sorter: false} },
               widgets: ['zebra'],
               headerTable: $('#product-grid table.ts-grid-htable')
             });
           }
           $('#printers_header').html(data.printers_header);
           if (data.printers_result)
           {
             $('#printers_info').html(data.printers_info);
             $('#printers_result').html(data.printers_result);
             $('#printer-grid table.ts-grid-gtable').tablesorter(
             {
               headers: { 5: { sorter: false} },
               widgets: ['zebra'],
               headerTable: $('#printer-grid table.ts-grid-htable')
             });
           }
           $('#others_header').html(data.others_header);
           if (data.others_result)
           {
             $('#others_info').html(data.others_info);
             $('#others_result').html(data.others_result);
             $('#other-grid table.ts-grid-gtable').tablesorter(
             {
               headers: { 3: { sorter: false} },
               widgets: ['zebra'],
               headerTable: $('#other-grid table.ts-grid-htable')
             });
           }
           $('#result_footer').html(data.footer);
           $('table.ts-grid-gtable tr').click(function()
           {
             // alert('http://' + http_host + '/product/' + $('div#' + 'i_' + this.id).html());
             top.location = 'http://' + http_host + '/product/' + $('div#' + 'i_' + this.id).html();
           });
           $('a.ts-grid-titlebar-close').click(function()
           {
             $(this).blur();
             var obj = $(this).children('span');
             if ($(obj).hasClass('slide-up'))
             {
               $(obj).removeClass('slide-up').addClass('slide-down')
             }
             else
             {
               $(obj).removeClass('slide-down').addClass('slide-up')
             }
             var gid = $(this).parents('div.ts-grid').attr('id');
             $('#' + gid + ' .slider').slideToggle('slow');
           });
         },
         "json"
        );
}
