How to add classes to BODY tag dynamically based on page path/depth? How to add classes to the body tag dynamically such as this example below?

-Home
-Cities &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
--Melbourne &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body class="melbourne"&gt;
---Theme Parks &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body class="melbourne theme_parks"&gt;
---Restaurants &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body class="melbourne restaurants"&gt;
--New York &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body class="new_york"&gt;
---Theme Parks &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body class="new_york theme_parks"&gt;
---Restaurants &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body class="new_york restaurants"&gt;
-Contact Us &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body class="contact_us"&gt;

Drupal newbie here and without programming background. Therefore, I'd much appreciate if you could be as detailed as possible when sharing a solution.
To expound on Nikhil Mohan's answer, you can implement template_preprocess_html() inside your theme's template.php file. Read the documentation on Overriding Themable Output to understand the basics of what is going on here.

Within this function, you have access to the variable $vars['classes_array'], which holds a list of classes that will be applied to the HTML &lt;body&gt; tag on the page.

Unfortunately, information about the current page's location in the menu is not immediately available. You could use menu_get_item() and then menu_get_ancestors() to get this information, but that is a lot of processing power for something that we can probably get to with a simpiler approach.

Assuming you are using the pathauto module to automatically create semantic paths for your content pages based on the menu path (i.e., your Melbourne Theme Parks page would have the path 'melbourne/theme_parks') you can use the page's path to create the classes you are looking for:

function THEMENAME_preprocess_html(&amp;$vars) {
  $path = drupal_get_path_alias();
  $aliases = explode('/', $path);

  foreach($aliases as $alias) {
    $vars['classes_array'][] = drupal_clean_css_identifier($alias);
  } 
}


That's it. Drupal will now look at the path alias of the current page and add a class to the &lt;body&gt; tag for each chunk of the path alias.