The `$main_menu`variable only contains first level menu items.

> The default $main_menu variable in page.tpl.php is set to
> menu_main_menu(), which is a contextual view of the main menu tree.
> 
> To get your desired output, you need to get the entire menu tree using
> menu_tree_all_data() and menu_tree_output().

Have a look at this question. 
http://drupal.stackexchange.com/questions/4656/show-all-nested-menu-links-in-drupal-7