Customize search block in frontpage
I suggest you use drupal_is_front_page() to check it is on front page or not. You can achieve it using code similar to the following.

function myrtheme_form_search_block_form_alter(&amp;$form, &amp;$form_state) {
  $form['actions']['submit'] = array('#type' =&gt; 'image_button', '#src' =&gt; base_path() . path_to_theme() . '/images/search-icon.png');
  if (drupal_is_front_page()) {
    $form['actions']['submit']['#attributes']['class'][] = 'fpage-search-icon';
    $form['search_block_form']['#attributes']['class'][] = 'fpage-search-box';
  }
  else {
    $form['actions']['submit']['#attributes']['class'][] = 'other-page-search-icon';
    $form['search_block_form']['#attributes']['class'][] = 'other-page-search-box';
  }
}