This is great! Thanks mate! it is going to be active in http://www.janapriya.net within few hours.
I can’t believe you have published this yesterday and I was searching the samething today :D.
Hope following will help for the people who come across problems using this method.
1. while linking the javascript file to the header.php, it is better to use the following.
<script type=”text/javascript” src=”<?php bloginfo(‘url’); ?>/wp-content/themes/ThemeNameGoesHere/dropdown.js”></script>
This fix makes sure, above javascript file is properly linked even when WP is installed in a subdirectory of the server.
2. people who want to use the “menu-order” of pages to order the horizontal links, replace the 3rd line from the above code with following.
$menuPages = $wpdb->get_results(“SELECT ID FROM $wpdb->posts WHERE post_parent=0 AND post_type=’page’ AND post_status=’publish’ ORDER BY menu_order ASC”);
Also, above AND post_status=’publish’ will make sure WP list only the published pages.