/*~~~~~~~~~~~~~~~~~~~~~~~ additonal jQuery code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /* department - category shopping menu */ $(function() { var theMenuId = '#productMenu ul'; $(theMenuId + ' li ul').hide(); var activeNode = $.cookie('activeMenu'); $('#' + activeNode + ' ul').show(); $('#' + activeNode).addClass('activeMenu'); var activeItem = $.cookie('activeItem'); $('#' + activeItem).addClass('activeItem'); $(theMenuId + ' li').each(function() { var thisId = $(this).attr('id'); $(this).click(function() { if ($('#' + thisId + ' ul').css('display') != 'none') { $(theMenuId + ' li ul').hide(0); } else { $(theMenuId + ' li ul').hide(0); $('#' + thisId + ' ul').show(0); } $.cookie('activeMenu', thisId); }); $('#' + thisId + ' ul li a').click(function() { $.cookie('activeItem', $(this).parent().attr('id')); }); }); }); $(function() { $('body#home div.productSummary a').each( function() { $(this).click( function() { $.cookie('activeItem', $(this).attr('href').match(/mid=(SM[0-9]+)/)[1]); $.cookie('activeMenu', $(this).attr('href').match(/mm=(MM[0-9]+)/)[1]); }); }); }); /* remove the value of the keywords when taken focus to save manual deletion*/ $(function() { $('#keywords').focusin(function() { $(this).animate({ opacity: 1.0 }, 250, function() { $(this).attr('value', ''); }); }); $('#keywords').focusout(function() { var tv = $(this).attr('value'); if (tv == '') { $(this).attr('value', 'Search by keywords...'); } }); });