function smallbiz_do_repair()
{
    echo "repair called";
    $home_id = smallbiz_get_page_id_by_title_create_if_needed('Home', -5, 'Home ', "index.php");
    update_option("smallbiz_page_on_front", $home_id);
    update_option("page_on_front", $home_id);
    update_option("smallbiz_homepage_id", $home_id);
}
function smallbiz_setup_menu_pages()
{
    $home_id = smallbiz_get_page_id_by_title_create_if_needed('Home', -5, 'Home ', "index.php");
    if (!get_option("smallbiz_page_for_posts")) {
        if (get_option("smallbiz_page_for_posts_created")) {
            $blog_id = smallbiz_get_page_id_by_title('Blog', 40, 'To add blog posts click on Posts - Add New in the WordPress Dashboard', "posts.php");
        } else {
            $blog_id = smallbiz_get_page_id_by_title_create_if_needed('Blog', 40, 'To add blog posts click on Posts - Add New in the WordPress Dashboard', "posts.php");
            update_option("smallbiz_page_for_posts_created", "true");
        }
    } else {
        $blog_id = get_option("smallbiz_page_for_posts");
    }
    // page stuff:
    if (get_option("show_on_front") != "page") {
        update_option("show_on_front", "page");
    }
    // If they've changed this, change it back... and store their pick in our system.
    if (get_option("page_on_front") != $home_id && get_option("page_on_front") != 0) {
        update_option("smallbiz_page_on_front", get_option("page_on_front"));
        update_option("page_on_front", $home_id);
    } else {
        if (get_option("page_on_front") == 0 || isset($_REQUEST["page_on_front"]) && $_REQUEST["page_on_front"] == $home_id) {
            update_option("smallbiz_page_on_front", $home_id);
            update_option("page_on_front", $home_id);
        }
    }
    if ($blog_id != false) {
        // Update our verion of the blog page:
        if (get_option("page_for_posts") && get_option("smallbiz_page_for_posts") != get_option("page_for_posts")) {
            update_option("smallbiz_page_for_posts", get_option("page_for_posts"));
            $blog_id = get_option("smallbiz_page_for_posts");
        }
    }
    //if(get_option("page_for_posts") != $blog_id){
    if (get_option("page_for_posts") != 0 && $blog_id) {
        //update_option("smallbiz_page_for_posts",get_option("page_for_posts"));
        update_option("page_for_posts", $blog_id);
    }
    add_option('smallbiz_homepage_id', $home_id);
    add_option('smallbiz_added_menu_pages', "true");
}
function smallbiz_setup_menu_pages()
{
    $home_id = smallbiz_get_page_id_by_title_create_if_needed('Home', -5, 'Please visit the SmallBiz Options Panel, open the "Layouts" section and select "SmallBiz" under the "Custom Homepage" selector drop down menu. Alternatively you can select any of your other pages as homepage.', "index.php");
    if (!get_option("smallbiz_page_for_posts")) {
        if (get_option("smallbiz_page_for_posts_created")) {
            $blog_id = smallbiz_get_page_id_by_title('Blog', 40, 'To add blog posts click on Posts - Add New in the Worpdpress Dashboard', "posts.php");
        } else {
            $blog_id = smallbiz_get_page_id_by_title_create_if_needed('Blog', 40, 'To add blog posts click on Posts - Add New in the Worpdpress Dashboard', "posts.php");
            update_option("smallbiz_page_for_posts_created", "true");
        }
    } else {
        $blog_id = get_option("smallbiz_page_for_posts");
    }
    // page stuff:
    if (get_option("show_on_front") != "page") {
        update_option("show_on_front", "page");
    }
    // If they've changed this, change it back... and store their pick in our system.
    if (get_option("page_on_front") != $home_id && get_option("page_on_front") != 0) {
        update_option("smallbiz_page_on_front", get_option("page_on_front"));
        update_option("page_on_front", $home_id);
    } else {
        if (get_option("page_on_front") == 0 || isset($_REQUEST["page_on_front"]) && $_REQUEST["page_on_front"] == $home_id) {
            update_option("smallbiz_page_on_front", $home_id);
            update_option("page_on_front", $home_id);
        }
    }
    if ($blog_id != false) {
        // Update our verion of the blog page:
        if (get_option("page_for_posts") && get_option("smallbiz_page_for_posts") != get_option("page_for_posts")) {
            update_option("smallbiz_page_for_posts", get_option("page_for_posts"));
            $blog_id = get_option("smallbiz_page_for_posts");
        }
    }
    //if(get_option("page_for_posts") != $blog_id){
    if (get_option("page_for_posts") != 0 && $blog_id) {
        //update_option("smallbiz_page_for_posts",get_option("page_for_posts"));
        update_option("page_for_posts", $blog_id);
    }
    add_option('smallbiz_homepage_id', $home_id);
    add_option('smallbiz_added_menu_pages', "true");
}