Index: wp-admin/css/custom-navigation.dev.css
===================================================================
--- wp-admin/css/custom-navigation.dev.css	(revision 13331)
+++ wp-admin/css/custom-navigation.dev.css	(working copy)
@@ -165,4 +165,4 @@
 .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -webkit-border-radius: 8px; }
 
 
-#reset_wp_menu { background:#c77 none !important;color:white!important;text-shadow:0 1px 0 #555 !important;}
+#reset-wp-menu { background:#c77 none !important;color:white!important;text-shadow:0 1px 0 #555 !important;}
Index: wp-admin/js/custom-navigation-dynamic-functions.dev.js
===================================================================
--- wp-admin/js/custom-navigation-dynamic-functions.dev.js	(revision 13331)
+++ wp-admin/js/custom-navigation-dynamic-functions.dev.js	(working copy)
@@ -115,7 +115,7 @@
      	jQuery(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
      	jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
 
-     	jQuery('#licount').attr('value',i);
+     	jQuery('#li-count').attr('value',i);
 
    });
 
Index: wp-admin/custom-navigation.php
===================================================================
--- wp-admin/custom-navigation.php	(revision 13331)
+++ wp-admin/custom-navigation.php	(working copy)
@@ -23,43 +23,37 @@
 wp_enqueue_script( 'jquery-autocomplete' );
 wp_enqueue_script( 'custom-navigation-php-functions' );
 
-require_once('admin-header.php');
-require_once (ABSPATH . WPINC . '/custom-navigation.php');
+require_once( 'admin-header.php' );
+require_once( ABSPATH . WPINC . '/custom-navigation.php' );
 
 wp_custom_navigation();
 
 function wp_custom_nav_reset() {
-	wp_custom_navigation_setup(true);
-
+	wp_custom_navigation_setup( true );
 	return true;
-
 }
 
-/*-----------------------------------------------------------------------------------*/
-/* Custom Navigation Admin Interface
-/* wp_custom_navigation() is the main function for the Custom Navigation
-/* See functions in admin-functions.php
-/*-----------------------------------------------------------------------------------*/
-
+/**
+ * Custom Navigation Admin Interface
+ * 
+ * This function renders the interface for the custom navigation and handels the POST requests 
+ */
 function wp_custom_navigation() {
 	global $wpdb, $user_ID;
-	?>
+?>
 
 	<div class="wrap">
 	<div id="no-js"><h3><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Custom Menu functionality.'); ?></h3></div>
 
-	<?php
-	$messagesdiv = '';
+<?php
+	$message_div = '';
 	$menu_id_in_edit = 0;
 
-	// Get the theme name
-	$themename = get_current_theme();
-
 	// Check which menu is selected and if menu is in edit already
-	if ( isset( $_POST['switch_menu'] ) )
-		$menu_selected_id = (int) $_POST['menu_select'];
-	elseif ( isset( $_POST['menu_id_in_edit'] ) )
-		$menu_selected_id = (int) $_POST['menu_id_in_edit'];
+	if ( isset( $_POST['switch-menu'] ) )
+		$menu_selected_id = (int) $_POST['menu-select'];
+	elseif ( isset( $_POST['menu-id-in-edit'] ) )
+		$menu_selected_id = (int) $_POST['menu-id-in-edit'];
 	else
 		$menu_selected_id = 0;
 
@@ -78,25 +72,21 @@
 		}
 	}
 
-	if ( isset( $_POST['set_wp_menu'] ) ) {
-		// @todo validate set_wp_menu
-	    update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] );
-		$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('Custom Menu has been updated!') . '</p></div>';
+	if ( isset( $_POST['set-wp-menu'] ) ) {
+		// @todo validate set-wp-menu
+	    update_option( 'wp_custom_nav_menu', $_POST['enable-wp-menu'] );
+		$message_div = '<div id="message" class="updated fade below-h2"><p>' . __('Custom Menu has been updated!') . '</p></div>';
 	}
 
-	if ( isset( $_POST['licount'] ) )
-		$postCounter = $_POST['licount'];
-	else
-	    $postCounter = 0;
+	$post_counter = isset( $_POST['li-count'] )? $_POST['li-count'] : 0;
 
 	// Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
-	if ( isset( $_POST['add_menu'] ) ) {
-	 	$insert_menu_name = $_POST['add_menu_name'];
-
+	if ( isset( $_POST['add-menu'] ) ) {
+	 	$insert_menu_name = $_POST['add-menu-name'];
 	 	if ( $insert_menu_name != '' ) {
 			$existing_term = get_term_by( 'name', $insert_menu_name, 'nav_menu' );
 	 		if ( $existing_term ) {
-	 			$messagesdiv = '<div id="message" class="error fade below-h2"><p>' . esc_html( sprintf( e__('A menu named "%s" already exists; please try another name.'), $existing_term->name ) ) . '</p></div>';
+	 			$message_div = '<div id="message" class="error fade below-h2"><p>' . sprintf( __('A menu named "%s" already exists; please try another name.'), esc_html( $existing_term->name ) ) . '</p></div>';
 	 		} else {
 				$term = wp_insert_term( $insert_menu_name, 'nav_menu' );
 				if ( !is_wp_error($term) ) {
@@ -104,34 +94,31 @@
 					$custom_menus[$term->term_id] = $term;
 	 				$menu_selected_id = $term->term_id;
 	 				$menu_id_in_edit = $menu_selected_id;
-	 				$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . esc_html( sprintf( __('"%s" menu has been created!'), $term->name ) ) . '</p></div>';
-
-					$postCounter = 0;
-	 			}
+	 				$message_div = '<div id="message" class="updated fade below-h2"><p>' . sprintf( __('"%s" menu has been created!'), esc_html( $term->name ) ) . '</p></div>';
+					$post_counter = 0;
+	 			} else {
+					$message_div = '<div id="message" class="error fade below-h2"><p>' . sprintf( __('Error creating menu: %s'), $term->get_error_message() ) . '</p></div>';
+				}
 	 		}
 	 	} else {
-	 		$messagesdiv = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>';
+	 		$message_div = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>';
 	 	}
 	}
 
-	if ( isset($_POST['reset_wp_menu']) ) {
-    	$success = wp_custom_nav_reset();
-    	if ( $success ) {
-	    	// DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
-			$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been reset.') . '</p></div>';
-			// GET reset menu id
+	if ( isset( $_POST['reset-wp-menu'] ) ) {
+    	if ( wp_custom_nav_reset() ) {
+			$message_div = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been reset.') . '</p></div>';
 			$custom_menus = array();
 			$menu_selected_id = 0;
 	    } else {
-    		// DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
-			$messagesdiv = '<div id="message" class="error fade below-h2"><p>' . __('The menu could not be reset. Please try again.') . '</p></div>';
+			$message_div = '<div id="message" class="error fade below-h2"><p>' . __('The menu could not be reset. Please try again.') . '</p></div>';
 	    }
-	} elseif ( $postCounter > 0 && $menu_selected_id > 0 ) {
+	} elseif ( $post_counter > 0 && $menu_selected_id > 0 ) {
 		$menu_objects = get_objects_in_term( $menu_selected_id, 'nav_menu' );
 		$menu_items = wp_custom_navigation_get_menu_items( $menu_objects );
 
 		// Loop through all POST variables
- 		for ( $k = 1; $k <= $postCounter; $k++ ) {
+ 		for ( $k = 1; $k <= $post_counter; $k++ ) {
  			if (isset($_POST['dbid'.$k])) { $db_id = $_POST['dbid'.$k]; } else { $db_id = 0; }
  			if (isset($_POST['postmenu'.$k])) { $object_id = $_POST['postmenu'.$k]; } else { $object_id = 0; }
 			if (isset($_POST['parent'.$k])) { $parent_id = $_POST['parent'.$k]; } else { $parent_id = 0; }
@@ -153,8 +140,8 @@
 				$post['post_content_filtered'] = '_blank';
 			else
 				$post['post_content_filtered'] = '';
-			if ( $parent_id > 0 && isset( $_POST[ 'dbid' . $parent_id ] ) )
-				$post[ 'post_parent' ] = (int) $_POST[ 'dbid' . $parent_id ];
+			if ( $parent_id > 0 && isset( $_POST['dbid' . $parent_id] ) )
+				$post[ 'post_parent' ] = (int) $_POST['dbid' . $parent_id];
 
 			// New menu item
 	 		if ( $db_id == 0 ) {
@@ -172,50 +159,38 @@
 				wp_delete_post( $menu_id );
 			}
 		}
-		// DISPLAY SUCCESS MESSAGE IF POST CORRECT
-		$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>';
+		$message_div = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>';
 	}
-
- 		// DISPLAY Custom Navigation
- 		?>
+?>
 		<div id="pages-left">
 			<div class="inside">
 			<h2 class="maintitle"><?php esc_html_e('Custom Navigation') ?></h2>
-			<?php
-
-				// CHECK if custom menu has been enabled
-				$enabled_menu = get_option('wp_custom_nav_menu');
-			    $checked = strtolower($enabled_menu);
-
-				if ( $checked != 'true' )
-					echo '<div id="message-enabled" class="error fade below-h2"><p><strong>' . __('The Custom Menu has not been Enabled yet. Please enable it in order to use it -------->') . '</strong></p></div>';
-
-			?>
-			<?php echo $messagesdiv; ?>
+<?php
+	$menu_enabled = strtolower( get_option( 'wp_custom_nav_menu' ) );
+	if ( !$menu_enabled ) $menu_enabled = 'false';
+	if ( $menu_enabled != 'true') {
+		echo '<div id="message-enabled" class="error fade below-h2"><p><strong>' . __('The Custom Menu is disabled. Please enable it on the right in order to use it &rarr;') . '</strong></p></div>';
+	}
+	echo $message_div;
+?>
 			<form onsubmit="updatepostdata()" action="custom-navigation.php" method="post"  enctype="multipart/form-data">
+				
+			<input type="hidden" name="li-count" id="li-count" value="0" />
+			<input type="hidden" name="menu-id-in-edit" id="menu-id-in-edit" value="<?php echo esc_attr( $menu_selected_id ); ?>" />
 
-			<input type="hidden" name="licount" id="licount" value="0" />
-			<input type="hidden" name="menu_id_in_edit" id="menu_id_in_edit" value="<?php echo esc_attr($menu_selected_id); ?>" />
-
 			<div class="sidebar-name">
-
 				<div class="sidebar-name-arrow">
 					<br/>
 				</div>
-				<h3><?php echo esc_html($menu_title); ?></h3>
-
+				<h3><?php echo esc_html( $menu_title ); ?></h3>
 			</div>
 
 			<div id="nav-container">
 				<ul id="custom-nav">
 
 			<?php
-			//DISPLAY existing menu
 			if ( $menu_selected_id > 0 ) {
-				// SET output type
-				$output_type = "backend";
-				// MAIN OUTPUT FUNCTION
-				wp_custom_navigation_output( 'type='.$output_type.'&name='.$menu_title.'&id='.$menu_selected_id );
+				wp_custom_navigation_output( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) );
 			}
 			?>
 
@@ -242,27 +217,19 @@
 					<h3><?php esc_html_e('Setup Custom Menu'); ?></h3>
 				</div>
 				<div class="widget-holder">
+					<span >
+						<input type="radio" name="enable-wp-menu" id="enable-wp-menu-true" value="true" <?php checked( $menu_enabled, 'true' ); ?> />
+						<label for="enable-wp-menu-true"><?php _e('Enable'); ?></label>
+						&nbsp;
+						<input type="radio" name="enable-wp-menu" id="enable-wp-menu-false" value="false" <?php checked( $menu_enabled, 'false' ); ?> />
+						<label for="enable-wp-menu-false"><?php _e('Disable'); ?></label>
+					</span>
 
-					<?php
+					<input id="set-wp-menu" type="submit" value="<?php esc_attr_e('Set Menu'); ?>" name="set-wp-menu" class="button" /><br />
 
-			    	// Setup custom menu
-
-					$enabled_menu = get_option('wp_custom_nav_menu');
-
-			    	$checked = strtolower($enabled_menu);
-
-			    	?>
-
-			    	<span >
-			    		<label><?php _e('Enable'); ?></label><input type="radio" name="enable_wp_menu" value="true" <?php if ($checked=='true') { echo 'checked="checked"'; } ?> />
-			    		<label><?php _e('Disable'); ?></label><input type="radio" name="enable_wp_menu" value="false" <?php if ($checked=='true') { } else { echo 'checked="checked"'; } ?> />
-					</span><!-- /.checkboxes -->
-
-					<input id="set_wp_menu" type="submit" value="<?php esc_attr_e('Set Menu'); ?>" name="set_wp_menu" class="button" /><br />
-
 					<span>
 						<label><?php _e('Reset Menu to Default'); ?></label>
-						<input id="reset_wp_menu" type="submit" value="Reset" name="reset_wp_menu" class="button" onclick="return confirm('<?php _e('Are you sure you want to reset the menu to its default settings?'); ?>');" />
+						<input id="reset-wp-menu" type="submit" value="Reset" name="reset-wp-menu" class="button" onclick="return confirm('<?php echo esc_js( __('Are you sure you want to reset the menu to its default settings?') ); ?>');" />
 					</span>
 
 					<div class="fix"></div>
@@ -275,27 +242,21 @@
 					<h3><?php esc_html_e('Menu Selector'); ?></h3>
 				</div>
 				<div class="widget-holder">
-					<select id="menu_select" name="menu_select">
-						<?php
-
-						// Display select options
-						foreach ( $custom_menus as $menu ) {
-							$menu_term = get_term( $menu, 'nav_menu' );
-							if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) )
-								$selected_option = 'selected="selected"';
-							else
-								$selected_option = '';
-							?>
-							<option value="<?php echo esc_attr($menu_term->term_id); ?>" <?php echo $selected_option; ?>><?php echo $menu_term->name; ?></option>
-							<?php
-
-						}
-						?>
+					<select id="menu-select" name="menu-select">
+<?php
+	foreach ( $custom_menus as $menu ) {
+		$menu_term = get_term( $menu, 'nav_menu' );
+		$selected_option = selected( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ), true, false );
+?>
+						<option value="<?php echo esc_attr( $menu_term->term_id ); ?>" <?php echo $selected_option; ?>><?php echo $menu_term->name; ?></option>
+<?php
+	}
+?>
 					</select>
 
-					<input id="switch_menu" type="submit" value="<?php esc_attr_e('Switch'); ?>" name="switch_menu" class="button" />
-					<input id="add_menu_name" name="add_menu_name" type="text" value=""  />
-					<input id="add_menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add_menu" class="button" />
+					<input id="switch-menu" type="submit" value="<?php esc_attr_e('Switch'); ?>" name="switch-menu" class="button" />
+					<input id="add-menu-name" name="add-menu-name" type="text" value=""  />
+					<input id="add-menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add-menu" class="button" />
 
 					<div class="fix"></div>
 				</div>
@@ -308,32 +269,34 @@
 				</div>
 				<div class="widget-holder">
 					<span><?php _e('Display Descriptions in Top Level Menu?'); ?></span>
-
-					<?php
-
+<?php
 			    	// UPDATE and DISPLAY Menu Description Option
-			    	if ( isset($_POST['menu-descriptions']) ) {
-						if ( !isset($_POST['switch_menu']) ) {
-							$menu_options_to_edit = $_POST['menu_id_in_edit'];
-			    			update_option('wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions',$_POST['menu-descriptions']);
+			    	if ( isset( $_POST['menu-descriptions'] ) ) {
+						if ( !isset( $_POST['switch-menu'] ) ) {
+							$menu_options_to_edit = $_POST['menu-id-in-edit'];
+			    			update_option( 'wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions', $_POST['menu-descriptions'] );
 						}
 			    	}
 
 			    	if ( $menu_id_in_edit > 0 )
-						$checkedraw = get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions');
+						$show_descriptions = get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions');
 					else
-						$checkedraw = get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions');
+						$show_descriptions = get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions');
 
-			    	$checked = strtolower($checkedraw);
+			    	$show_descriptions = strtolower( $show_descriptions );
+					if ( !$show_descriptions )
+						$show_descriptions = 'no';
 
 			    	if ( $advanced_option_descriptions == 'no' )
-			    		$checked = 'no';
+			    		$show_descriptions = 'no';
+?>
 
-			    	?>
-
 			    	<span class="checkboxes">
-			    		<label><?php _e('Yes'); ?></label><input type="radio" name="menu-descriptions" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> />
-			    		<label><?php _e('No'); ?></label><input type="radio" name="menu-descriptions" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> />
+						<input type="radio" name="menu-descriptions" id="menu-descriptions-yes" value="yes" <?php checked( $show_descriptions, 'yes' ); ?> />
+			    		<label for="menu-descriptions-yes"><?php _e('Yes'); ?></label>
+						&nbsp;
+						<input type="radio" name="menu-descriptions" id="menu-descriptions-no" value="no" <?php checked( $show_descriptions, 'no' ); ?> />
+			    		<label for="menu-descriptions-no"><?php _e('No'); ?></label>
 					</span><!-- /.checkboxes -->
 			    	</form>
 					<div class="fix"></div>
@@ -364,29 +327,23 @@
 					'number' => '',
 					'offset' => 0 );
 
-					//GET all pages
-					$pages_array = get_pages($pages_args);
+					$pages_array = get_pages( $pages_args );
 					$page_name = '';
-					//CHECK if pages exist
 					if ( $pages_array ) {
 						foreach ( $pages_array as $post ) {
-							//Add page name to
-							$page_name .= htmlentities($post->post_title).'|';
+							$page_name .= esc_html( $post->post_title ).'|';
 						}
 					} else {
 						$page_name = __('No pages available');
 					}
-
-					?>
-
-					<script>
+?>
+					<script type="text/javascript">
   						jQuery(document).ready(function(){
 
-							//GET PHP pages
-    						var dataposts = "<?php echo esc_js($page_name); ?>".split("|");
+    						var data_posts = "<?php echo esc_js($page_name); ?>".split("|");
 
 							//Set autocomplete
-							jQuery("#page-search").autocomplete(dataposts);
+							jQuery("#page-search").autocomplete(data_posts);
 
 							//Handle autocomplete result
 							jQuery("#page-search").result(function(event, data, formatted) {
@@ -404,23 +361,19 @@
 
 					<input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" />
 
-					<a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();">View All</a>
-					<a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();">Hide All</a>
+					<a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();"><?php _e('View All'); ?></a>
+					<a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();"><?php _e('Hide All'); ?></a>
 
 					<script type="text/javascript">
-
 						jQuery('#hide-pages').hide();
-
 					</script>
 
 					<ul id="existing-pages" class="list">
 						<?php
-							$intCounter = 0;
-							//Get default Pages
-							$intCounter = wp_custom_nav_get_pages($intCounter,'default');
+							$item_counter = 0;
+							$item_counter = wp_custom_nav_get_pages( $item_counter, 'default' );
 						?>
 					</ul>
-
 					<div class="fix"></div>
 
 				</div>
@@ -433,47 +386,36 @@
 				</div>
 				<div class="widget-holder">
 
-					<?php
+<?php
+	// Custom GET categories query
+	// @todo Use API
+	$categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC");
+	$cat_name = '';
+	//CHECK for results
+	if ( $categories ) {
+		foreach ( $categories as $category ) {
+			$cat_id = $category->term_id;
 
-					// Custom GET categories query
-					// @todo Use API
-					$categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC");
-					$cat_name = '';
-					//CHECK for results
-					if ( $categories ) {
-						foreach ( $categories as $category ) {
-							$cat_id = $category->term_id;
+			$cat_args = array(
+			 	'orderby' => 'name',
+			  	'include' => $cat_id,
+			  	'hierarchical' => 1,
+		  		'order' => 'ASC'
+	 		);
+			$category_names = get_categories( $cat_args );
 
-							$cat_args = array(
-							 	'orderby' => 'name',
-							  	'include' => $cat_id,
-							  	'hierarchical' => 1,
-						  		'order' => 'ASC'
-				  			);
-
-				  			$category_names=get_categories($cat_args);
-
-							if ( isset($category_names[0]->name) ) {
-								// Add category name to data string
-								$cat_name .= htmlentities($category_names[0]->name).'|';
-							}
-				  		}
-				  	} else {
-						$cat_name = __('No categories available');
-					}
-
-					?>
-
-					<script>
+			if ( isset( $category_names[0]->name ) ) {
+				$cat_name .= esc_html( $category_names[0]->name ).'|';
+			}
+	 	}
+	} else {
+		$cat_name = __('No categories available');
+	}
+?>
+					<script type="text/javascript">
   						jQuery(document).ready(function(){
-
-							//GET PHP categories
-    						var datacats = "<?php echo esc_js($cat_name); ?>".split("|");
-
-							//Set autocomplete
-							jQuery("#cat-search").autocomplete(datacats);
-
-							//Handle autocomplete result
+    						var data_cats = "<?php echo esc_js($cat_name); ?>".split("|");
+							jQuery("#cat-search").autocomplete(data_cats);
 							jQuery("#cat-search").result(function(event, data, formatted) {
     							jQuery('#existing-categories').css('display','block');
     							jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block");
@@ -489,24 +431,17 @@
 
 					<input type="text" onfocus="jQuery('#cat-search').attr('value','');" id="cat-search" value="<?php esc_attr_e('Search Categories'); ?>" />
 
-					<a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();">View All</a>
-					<a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();">Hide All</a>
+					<a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();"><?php _e('View All'); ?></a>
+					<a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();"><?php _e('Hide All'); ?></a>
 
 					<script type="text/javascript">
-
 						jQuery('#hide-cats').hide();
-
 					</script>
 
 					<ul id="existing-categories" class="list">
-            			<?php
-						 	// Get default Categories
-            				$intCounter = wp_custom_nav_get_categories($intCounter, 'default');
-						?>
+            			<?php $item_counter = wp_custom_nav_get_categories( $item_counter, 'default' ); ?>
        				</ul>
-
        				<div class="fix"></div>
-
 				</div>
 			</div><!-- /.widgets-holder-wrap -->
 
@@ -518,13 +453,13 @@
 				<div class="widget-holder">
 					<input id="custom_menu_item_url" type="text" value="http://"  />
 					<label><?php _e('URL'); ?></label><br />
-           			<?php $templatedir = get_bloginfo('url'); ?>
-            		<input type="hidden" id="templatedir" value="<?php echo esc_attr($templatedir); ?>" />
+           			<?php $template_dir = get_bloginfo('url'); ?>
+            		<input type="hidden" id="template_dir" value="<?php echo esc_attr($template_dir); ?>" />
             		<input id="custom_menu_item_name" type="text" value="Menu Item" onfocus="jQuery('#custom_menu_item_name').attr('value','');"  />
             		<label><?php _e('Menu Text'); ?></label><br />
            			<input id="custom_menu_item_description" type="text" value="<?php esc_attr_e('A description'); ?>" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> onfocus="jQuery('#custom_menu_item_description').attr('value','');" />
            			<label <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> ><?php _e('Description'); ?></label>
-           			<a class="addtomenu" onclick="appendToList('<?php echo $templatedir; ?>','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');"><?php _e('Add to menu'); ?></a>
+           			<a class="addtomenu" onclick="appendToList('<?php echo $template_dir; ?>','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');"><?php _e('Add to menu'); ?></a>
 					<div class="fix"></div>
 				</div>
 			</div><!-- /.widgets-holder-wrap -->
@@ -552,4 +487,4 @@
 <?php
 }
 
-include("admin-footer.php");
+include("admin-footer.php");
\ No newline at end of file

