/* initialise */ var shopby_act=""; var pred_results=0; var pred_current=0; var pred_orig=""; var htimer; $(document).ready(function() { // ie6 png fix $('.ssleight').supersleight(); // shopby blocks $('.shopby').hover(function(){$(this).css('cursor','pointer');},function(){}); $('.shopby_cont').click(function(){ var id=$(this).attr( 'id' ); id=id.replace( '_cont','' ); if( shopby_act==id ) { shopby_act=""; $('.shopby_list').slideUp('fast'); $('#'+id).removeClass( 'shopby_open' ); $('#'+id).addClass( 'shopby_closed' ); } else { shopby_act=id; $('.shopby_list').not( '#'+shopby_act+' > .shopby_list' ).slideUp('fast'); $('.shopby_list','#'+id).slideToggle('fast',function(){ var height=$('#'+id+' > .shopby_list').height(); if( height>300 ) { $('#'+id+' > .shopby_list').css( 'height','300px' ); $('#'+id+' > .shopby_list').css( 'overflowY','auto' ); } }); $('.shopby').removeClass( 'shopby_open' ); $('.shopby').addClass( 'shopby_closed' ); $('#'+id).removeClass( 'shopby_closed' ); $('#'+id).addClass( 'shopby_open' ); } return false; }); // mailing list text $('#email_box').focus(function(){ if( $(this).val()=='Enter your email...' ) { $(this).val( '' ); } }); $('#email_box').blur(function(){ if( $(this).val()=='' ) { $(this).val( 'Enter your email...' ); } }); // search box text $('#search_box').focus(function(){ if( $(this).val()=='Search...' ) { $(this).val( '' ); } }); $('#search_box').blur(function(){ if( $(this).val()=='' ) { $(this).val( 'Search...' ); } }); // predictive search $('#search_box').keyup(function(event){ if( event.keyCode=='13' ) { $('#form_search').submit(); } else if( event.keyCode=='27' ) { $('#search_box').val( pred_orig ); $('#pred').slideUp('slow'); } else if( event.keyCode=='38' ) { if( pred_results ) { $('.pred-line').removeClass( 'pred-line-hover' ); if( pred_current>1 ) { pred_current--; } else { pred_current=pred_results; } $('#pred-'+pred_current).mouseover(); } } else if( event.keyCode=='40' ) { if( pred_results ) { $('.pred-line').removeClass( 'pred-line-hover' ); if( pred_current