var searchPanel = null; $(document).ready(function(){ $('#fmsearch input[name="q"]').focus(function() { if( $(this).hasClass('grey') ) { $(this).removeClass('grey'); this.value =''; } }).blur( function() { if( this.value == '' ) { $(this).addClass('grey'); this.value = 'SEARCH'; } });; }); function checkSearch(fm) { if( searchPanel == null ) searchPanel = new cmsPanel( {"width":500} ); if( fm.q.value == '' || $(fm.q).hasClass('grey') ) { searchPanel.setTitle('Search'); searchPanel.setContent('Please enter keyword to search.'); searchPanel.show(); return false; } else { fm.submit(); return true; } }