?>
stylesheet.css">
</head>
<div id="wrap">
  <div id="header"><img src="<?php 
                echo DIR_WS_INSTALL_IMAGES;
                ?>
phreebooks_logo.png" height="80"></div>
  <div class="progress" align="center">Installation In Progress...<br /><br />
<?php 
            }
            // create the database tables
            db_executeSql('sql/current/tables.sql', $_POST['db_name'], $_POST['db_prefix']);
            // populate the necessary table data
            require '../../includes/database_tables.php';
            load_startup_table_data($language = $_GET['language']);
            $db->Close();
            // Create the directory and subdirectories to store company data
            define('DIR_FS_MY_FILES', '../../my_files/');
            install_build_dirs($_POST['db_name'], false);
            // done - now onto next page for Store Setup (entries into database)
            if ($zc_show_progress == 'yes') {
                $linkto = 'index.php?main_page=admin_setup&language=' . $language;
                $link = '<a href="' . $linkto . '">' . '<br /><br />Done!<br />Click Here To Continue<br /><br />' . '</a>';
                echo "\n<script type=\"text/javascript\">\nwindow.location=\"{$linkto}\";\n</script>\n";
                echo '<noscript>' . $link . '</noscript><br /><br />';
                echo '<div id="footer"><p>Copyright &copy; ' . date('Y', time()) . '<a href="http://www.PhreeSoft.com" target="_blank">PhreeSoft</a></p></div></div></body></html>';
            }
            header('location: index.php?main_page=admin_setup&language=' . $language);
            exit;
        }
     } else {
         if (!$db->connect(DB_SERVER, $db_user, $db_pw, $company)) {
             $messageStack->add(SETUP_CO_MGR_CANNOT_CONNECT, 'error');
             break;
         }
     }
 }
 $result = db_executeSql(DIR_FS_MODULES . 'install/sql/current/tables.sql', $company, DB_PREFIX);
 if (count($result['errors']) > 0) {
     $messageStack->add(SETUP_CO_MGR_ERROR_1, 'error');
     break;
 }
 // copy the required table data
 if ($action == 'new' || $action == 'copy' && !$cb_all) {
     // only if not copying all the data
     $result = load_startup_table_data($language = 'en_us');
     if (!$result) {
         $messageStack->add(SETUP_CO_MGR_ERROR_2, 'error');
         break;
     }
 }
 // create the new directory and sub-directories
 if (!install_build_dirs($company, $cb_demo)) {
     $messageStack->add(SETUP_CO_MGR_ERROR_3, 'error');
     break;
 }
 // create the config.php file and update COMPANY_NAME configuration parameter in table
 install_build_co_config_file(DB_DATABASE, DB_DATABASE . '_TITLE', $company_name);
 install_build_co_config_file(DB_DATABASE, 'DB_SERVER_USERNAME', $db_user);
 install_build_co_config_file(DB_DATABASE, 'DB_SERVER_PASSWORD', $db_pw);
 install_build_co_config_file(DB_DATABASE, 'DB_SERVER', $db_server);