Index: trunk/xpressme_integration_kit/wp-content/themes/xpress_default/functions.php
===================================================================
--- trunk/xpressme_integration_kit/wp-content/themes/xpress_default/functions.php	(revision 623)
+++ trunk/xpressme_integration_kit/wp-content/themes/xpress_default/functions.php	(revision 631)
@@ -1,4 +1,32 @@
 <?php
-load_theme_textdomain('xpress');
+/** Tell WordPress to run xpress_setup() when the 'after_setup_theme' hook is run. */
+add_action( 'after_setup_theme', 'xpress_setup' );
+if ( ! function_exists( 'xpress_setup' ) ):
+function xpress_setup() {
+	// This theme uses post thumbnails
+	add_theme_support( 'post-thumbnails' );
+	// Add default posts and comments RSS feed links to head
+	add_theme_support( 'automatic-feed-links' );
+
+	// Make theme available for translation
+	// Translations can be filed in the /languages/ directory
+	load_theme_textdomain( 'xpress', TEMPLATEPATH . '/languages' );
+
+	$locale = get_locale();
+	$locale_file = TEMPLATEPATH . "/languages/$locale.php";
+	if ( is_readable( $locale_file ) )
+		require_once( $locale_file );
+
+	// This theme uses wp_nav_menu()
+	if ( function_exists('add_theme_support') )add_theme_support( 'nav-menus' );
+	// This theme uses wp_nav_menu() in one location.
+	if ( function_exists('register_nav_menus') ){
+			register_nav_menus( array(
+			'primary' => __('Primary Navigation','xpress'),
+		) );
+	}
+	
+}	
+endif;
 	
 if ( function_exists('register_sidebar') )
@@ -10,12 +38,4 @@
     ));
 
-// This theme uses wp_nav_menu()
-if ( function_exists('add_theme_support') )add_theme_support( 'nav-menus' );
-// This theme uses wp_nav_menu() in one location.
-if ( function_exists('register_nav_menus') ){
-		register_nav_menus( array(
-		'primary' => __('Primary Navigation','xpress'),
-	) );
-}
 
 function xpress_head() {
@@ -150,4 +170,6 @@
 				}
 			}
+			
+
 			//print_r($_REQUEST);
 			wp_redirect("themes.php?page=functions.php&saved=true");
@@ -155,7 +177,24 @@
 		}
 		add_action('admin_head', 'xpress_theme_page_head');
-	}
-	add_theme_page(__('Customize Header', 'xpress'), __('Header Image and Color', 'xpress'), 'edit_themes', basename(__FILE__), 'xpress_theme_page');
-}
+		
+		if ( isset( $_REQUEST['action'] ) && 'update_footer' == $_REQUEST['action'] ) {
+			check_admin_referer('xpress-footer');
+			if ( isset($_REQUEST['xpress_footer_sidebars_count']) ) {
+				check_admin_referer('xpress-footer');
+				if ( '' == $_REQUEST['xpress_footer_sidebars_count'] || '0' == $_REQUEST['xpress_footer_sidebars_count'] ){
+					delete_option('xpress_footer_sidebars_count');
+				} else {
+					update_option('xpress_footer_sidebars_count',  $_REQUEST['xpress_footer_sidebars_count']);
+				}
+			}
+
+			//print_r($_REQUEST);
+			wp_redirect("themes.php?page=functions.php&footer_saved=true");
+			die;
+		}
+	}
+	add_theme_page(__('Header & Footer', 'xpress'), __('Header & Footer', 'xpress'), 'edit_themes', basename(__FILE__), 'xpress_theme_header_page');
+}
+
 
 function xpress_theme_page_head() {
@@ -361,10 +400,19 @@
 		border-bottom: 0px;
 	}
+	#footer_submit {
+		margin-top: 20px;
+		text-align: center;
+	}
+	#footer_form{
+		padding-left: 40px;
+	}
+
 </style>
 <?php
 }
 
-function xpress_theme_page() {
-	if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.', 'xpress').'</strong></p></div>';
+function xpress_theme_header_page() {
+	if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Header Options saved.', 'xpress').'</strong></p></div>';
+	if ( isset( $_REQUEST['footer_saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Footer Options saved.', 'xpress').'</strong></p></div>';
 ?>
 <div class='wrap'>
@@ -424,4 +472,79 @@
 		</div>
 	</div>
+	<div id="xpress-footer">
+	<h2><?php _e('Footer', 'xpress'); ?></h2>
+		<form id="footer_setting" style="display:inline;" method="post" action="">
+			<div id="footer_form">
+				<?php wp_nonce_field('xpress-footer'); ?>
+				<?php
+				if ( function_exists('register_sidebar') ){
+					echo __('Set number of the sidebar to display in the footer.','xpress');
+					echo '<select name="xpress_footer_sidebars_count">'."\n";
+						$side_bar_num = get_option('xpress_footer_sidebars_count');
+						if (empty($side_bar_num)) $side_bar_num = 0;
+						for($i=0;$i<=5;$i++){
+							if ($i== 0) $sel_name = __('none','xpress'); else $sel_name = $i;
+							if ($i == $side_bar_num) $selected = ' selected '; else $selected = '';
+							echo "\t\t\t\t<option value=\"{$i}\" label=\"{$i}\" {$selected}>{$sel_name}</option>\n";
+						}
+					echo "</select>\n";
+				}
+				?>
+				<input type="hidden" name="action" value="update_footer" />
+			</div>
+			<div id="footer_submit">
+			<input type="submit" name="footer_submit" id="footer_submit" value="<?php echo attribute_escape(__('Update Footer &raquo;', 'xpress')); ?>" />
+			</div>
+		</form>
+	</div>
+
 </div>
-<?php } ?>
+<?php } 
+
+function footer_widgets_init() {
+	if (!function_exists('register_sidebar') ) return;
+
+	$side_bar_num = get_option('xpress_footer_sidebars_count');
+	if (empty($side_bar_num)) return;
+	for($i=1;$i <= $side_bar_num;$i++){
+		switch($i){
+			case 1:
+				$name = __( 'First Footer Widget Area', 'kubrick' );
+				$description = __( 'The first footer widget area', 'kubrick' );
+				break;
+			case 2:
+				$name = __( 'Second Footer Widget Area', 'kubrick' );
+				$description = __( 'The second footer widget area', 'kubrick' );
+				break;
+			case 3:
+				$name = __( 'Third Footer Widget Area', 'kubrick' );
+				$description = __( 'The third footer widget area', 'kubrick' );
+				break;
+			case 4:
+				$name = __( 'Fourth Footer Widget Area', 'kubrick' );
+				$description = __( 'The fourth footer widget area', 'kubrick' );
+				break;
+			case 5:
+				$name = __( 'Fifth Footer Widget Area', 'kubrick' );
+				$description = __( 'The fifth footer widget area', 'kubrick' );
+				break;
+				
+		}
+
+		register_sidebar( array(
+			'name' => $name,
+			'id' => 'footer-widget-area-'.$i,
+			'description' => $description,
+			'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+			'after_widget' => '</li>',
+			'before_title' => '<h3 class="widget-title">',
+			'after_title' => '</h3>',
+		) );
+	}
+}
+
+add_action( 'widgets_init', 'footer_widgets_init' );
+
+
+
+?>
