<?php
/*
osCommerce, Open Source E-Commerce Solutions 
http://www.oscommerce.com 

Copyright (c) 2003 osCommerce 

osCommRes, Services Oline 
http://www.oscommres.com 
Copyright (c) 2005 osCommRes 

Freeway eCommerce 
http://www.zac-ware.com/freeway 
Copyright (c) 2007 ZacWare

Released under the GNU General Public License
*/
// Set flag that this is a parent file
	define( '_FEXEC', 1 );

  require('includes/application_top.php');
  
		  $file_name = (isset($HTTP_COOKIE_VARS["store_file_name"]) ? $HTTP_COOKIE_VARS["store_file_name"] : '');
		  $selected_box = (isset($HTTP_COOKIE_VARS["selected_box_name"]) ? $HTTP_COOKIE_VARS["selected_box_name"] : '');
		  if (trim($file_name)=="") $file_name=FILENAME_CONFIGURATION;
		  if (trim($selected_box)=="") $selected_box="configuration";

   tep_redirect(tep_href_link($file_name,'selected_box='.$selected_box));
 
  $cat = array(array('title' => BOX_HEADING_CONFIGURATION,
//Admin begin
                     'access' => tep_admin_check_boxes('configuration.php'),
//Admin end
                     'image' => 'configuration.gif',
                     'href' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=1'),
                     'children' => array(array('title' => BOX_CONFIGURATION_MYSTORE, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=1')),
                                         array('title' => BOX_CONFIGURATION_LOGGING, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=10')),
                                         array('title' => BOX_CONFIGURATION_CACHE, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=11')))),
               array('title' => BOX_HEADING_MODULES,
//Admin begin
                     'access' => tep_admin_check_boxes('modules.php'),
//Admin end
                     'image' => 'modules.gif',
                     'href' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=payment'),
                     'children' => array(array('title' => BOX_MODULES_PAYMENT, 'link' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=payment')),
                                         array('title' => BOX_MODULES_SHIPPING, 'link' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=shipping')),
										 array('title' => BOX_MODULES_SMS, 'link' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=sms')))),
               array('title' => BOX_HEADING_CATALOG,
//Admin begin
                     'access' => tep_admin_check_boxes('catalog.php'),
//Admin end
                     'image' => 'catalog.gif',
                     'href' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'),
                     'children' => array(array('title' => CATALOG_CONTENTS, 'link' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog')),
                                         array('title' => BOX_CATALOG_MANUFACTURERS, 'link' => tep_href_link(FILENAME_MANUFACTURERS, 'selected_box=catalog')))),
               array('title' => BOX_HEADING_EVENTS,
//Admin begin
                     'access' => tep_admin_check_boxes('event.php'),
//Admin end
                     'image' => 'events.gif',
                     'href' => tep_href_link(FILENAME_EVENTS_CATEGORIES, 'selected_box=event'),
                     'children' => array(array( 'title' => CATALOG_CONTENTS, 'link' => tep_href_link(FILENAME_EVENTS_CATEGORIES, 'selected_box=event')),
					 					 array( 'title' => EVENTS_RESERVATIONS, 'link' => tep_href_link(FILENAME_SEARCH_RESERVATIONS, 'selected_box=event')))),

               array('title' => BOX_HEADING_LOCATION_AND_TAXES,
//Admin begin
                     'access' => tep_admin_check_boxes('taxes.php'),
//Admin end
                     'image' => 'location.gif',
                     'href' => tep_href_link(FILENAME_COUNTRIES, 'selected_box=taxes'),
                     'children' => array(array('title' => BOX_TAXES_COUNTRIES, 'link' => tep_href_link(FILENAME_COUNTRIES, 'selected_box=taxes')),
                                         array('title' => BOX_TAXES_GEO_ZONES, 'link' => tep_href_link(FILENAME_GEO_ZONES, 'selected_box=taxes')))),
               array('title' => BOX_HEADING_CUSTOMERS,
//Admin begin
                     'access' => tep_admin_check_boxes('customers.php'),
//Admin end
                     'image' => 'customers.gif',
                     'href' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'),
                     'children' => array(array('title' => BOX_CUSTOMERS_CUSTOMERS, 'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers')),
                                         array('title' => BOX_CUSTOMERS_ORDERS, 'link' => tep_href_link(FILENAME_ORDERS, 'selected_box=customers')))),
               array('title' => BOX_HEADING_LOCALIZATION,
//Admin begin
                     'access' => tep_admin_check_boxes('localization.php'),
//Admin end
                     'image' => 'localization.gif',
                     'href' => tep_href_link(FILENAME_CURRENCIES, 'selected_box=localization'),
                     'children' => array(array('title' => BOX_LOCALIZATION_CURRENCIES, 'link' => tep_href_link(FILENAME_CURRENCIES, 'selected_box=localization')),
                                         array('title' => BOX_LOCALIZATION_LANGUAGES, 'link' => tep_href_link(FILENAME_LANGUAGES, 'selected_box=localization')))),
               array('title' => BOX_HEADING_REPORTS,
//Admin begin
                     'access' => tep_admin_check_boxes('reports.php'),
//Admin end
                     'image' => 'reports.gif',
                     'href' => tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, 'selected_box=reports'),
                     'children' => array(array('title' => REPORTS_PRODUCTS, 'link' => tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, 'selected_box=reports')),
                                         array('title' => REPORTS_ORDERS, 'link' => tep_href_link(FILENAME_STATS_CUSTOMERS, 'selected_box=reports')),
										 array('title' => REPORTS_EVENTS, 'link' => tep_href_link(FILENAME_EVENTS_REPORTS_WAITLIST, 'selected_box=event'),
										 		'access'=> tep_admin_check_boxes(FILENAME_EVENTS_REPORTS_WAITLIST, 'sub_boxes')))),
array('title' => BOX_HEADING_AFFILIATE,
                     'image' => 'affiliates.gif',
                     'href' => tep_href_link(FILENAME_AFFILIATE_SUMMARY, 'selected_box=affiliate'),
                     'children' => array(array('title' => BOX_AFFILIATE, 'link' => tep_href_link(FILENAME_AFFILIATE, 'selected_box=affiliate')),
                                         array('title' => BOX_AFFILIATE_BANNERS, 'link' => tep_href_link(FILENAME_AFFILIATE_BANNERS, 'selected_box=affiliate')))),


// added for support
/*
	array(
		'title' => BOX_SUPPORT_HEADING,
//Admin begin
		'access' => tep_admin_check_boxes('support.php'),
//Admin end
		'image' => 'helpdesk.gif',
		'href' => tep_href_link(FILENAME_SUPPORT_TICKETS, 'selected_box=support'),
		'children' => array(array(
				'title' => BOX_TICKET_STATUS, 
				'link' => tep_href_link(FILENAME_SUPPORT_STATUS, 'selected_box=support')
			),
			array(
				'title' => BOX_TICKET_ADMINS, 
				'link' => tep_href_link(FILENAME_SUPPORT_ADMIN, 'selected_box=support'))
			)
	),
*/
//end of support


// added for newsdesk
	array(
		'title' => BOX_HEADING_NEWSDESK,
//Admin begin
		'access' => tep_admin_check_boxes('newsdesk.php'),
//Admin end
		'image' => 'newsdesk.gif',
		'href' => tep_href_link(FILENAME_NEWSDESK, 'selected_box=newsdesk'),
		'children' => array(array(
				'title' => NEWSDESK_ARTICLES, 
				'link' => tep_href_link(FILENAME_NEWSDESK, 'selected_box=newsdesk')
			),
			array(
				'title' => NEWSDESK_REVIEWS, 
				'link' => tep_href_link(FILENAME_NEWSDESK_REVIEWS, 'selected_box=newsdesk'))
			)
	),
//end of newsdesk


// added for faqdesk
	array(
		'title' => BOX_HEADING_FAQDESK,
//Admin begin
		'access' => tep_admin_check_boxes('faqdesk.php'),
//Admin end
		'image' => 'faqdesk.gif',
		'href' => tep_href_link(FILENAME_FAQDESK, 'selected_box=faqdesk'),
		'children' => array(array(
				'title' => FAQDESK_ARTICLES, 
				'link' => tep_href_link(FILENAME_FAQDESK, 'selected_box=faqdesk')
			),
			array(
				'title' => FAQDESK_REVIEWS, 
				'link' => tep_href_link(FILENAME_FAQDESK_REVIEWS, 'selected_box=faqdesk'))
			)
	),
//end of faqdesk


//Admin begin
       	       array('title' => BOX_HEADING_MY_ACCOUNT,
                     'access' => 'true',
                     'image' => 'myaccount.gif',
                     'href' => tep_href_link(FILENAME_ADMIN_ACCOUNT),
                     'children' => array(array('title' => HEADER_TITLE_ACCOUNT, 'link' => tep_href_link(FILENAME_ADMIN_ACCOUNT),
                                               'access' => 'true'),
                                         array('title' => HEADER_TITLE_LOGOFF, 'link' => tep_href_link(FILENAME_LOGOFF),
                                               'access' => 'true'))),
               array('title' => BOX_HEADING_ADMINISTRATOR,
                     'access' => tep_admin_check_boxes('administrator.php'),
                     'image' => 'administrator.gif',
                     'href' => tep_href_link(tep_selected_file('administrator.php'), 'selected_box=administrator'),
                     'children' => array(array('title' => BOX_ADMINISTRATOR_MEMBER, 'link' => tep_href_link(FILENAME_ADMIN_MEMBERS, 'selected_box=administrator'),
                                               'access' => tep_admin_check_boxes(FILENAME_ADMIN_MEMBERS, 'sub_boxes')),
                                         array('title' => BOX_ADMINISTRATOR_BOXES, 'link' => tep_href_link(FILENAME_ADMIN_FILES, 'selected_box=administrator'),
                                               'access' => tep_admin_check_boxes(FILENAME_ADMIN_FILES, 'sub_boxes')),
                                         array('title' => BOX_ADMINISTRATOR_EMAIL, 'link' => tep_href_link(FILENAME_EMAIL_MESSAGES, 'selected_box=administrator'),
                                               'access' => tep_admin_check_boxes(FILENAME_EMAIL_MESSAGES, 'sub_boxes')),
)),
//Admin end
               array('title' => BOX_HEADING_TOOLS,
//Admin begin
                     'access' => tep_admin_check_boxes('tools.php'),
//Admin end
                     'image' => 'tools.gif',
                     'href' => tep_href_link(FILENAME_BACKUP, 'selected_box=tools'),
                     'children' => array(array('title' => TOOLS_BACKUP, 'link' => tep_href_link(FILENAME_BACKUP, 'selected_box=tools')),
                                         array('title' => TOOLS_BANNERS, 'link' => tep_href_link(FILENAME_BANNER_MANAGER, 'selected_box=tools')),
                                         array('title' => TOOLS_FILES, 'link' => tep_href_link(FILENAME_FILE_MANAGER, 'selected_box=tools')))),
//Admin end
               array('title' => BOX_HEADING_MARKETING,
//Admin begin
                     'access' => tep_admin_check_boxes('event.php'),
//Admin end
                     'image' => 'marketing.gif',
                     'href' => tep_href_link(FILENAME_EVENTS_MESSAGES, 'selected_box=event'),
                     'children' => array(array('title' => EVENTS_EMARKETING, 'link' => tep_href_link(FILENAME_EVENTS_MESSAGES, 'selected_box=event')),
                                         array('title' => EVENTS_SMS, 'link' => tep_href_link(FILENAME_EVENTS_SMS_MESSAGES, 'selected_box=event')),
                                         array('title' => EVENTS_SURVEYS, 'link' => tep_href_link(FILENAME_EVENTS_SURVEYS, 'selected_box=event'))))
					 );

  $languages = tep_get_languages();
  $languages_array = array();
  $languages_selected = DEFAULT_LANGUAGE;
  for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
    $languages_array[] = array('id' => $languages[$i]['code'],
                               'text' => $languages[$i]['name']);
    if ($languages[$i]['directory'] == $language) {
      $languages_selected = $languages[$i]['code'];
    }
  }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<style type="text/css"><!--
a { color:#080381; text-decoration:none; }
a:hover { color:#000000;text-decoration:underline; }
a.text:link, a.text:visited { color: #000000; text-decoration: none; }
a.text:hover { color: #000000; text-decoration: underline; }
a.top:link, a.top:visited { color: #FFFFFF; text-decoration: none; }
a.top:hover { color: #FFFFFF; text-decoration: underline; }
a.main:link, a.main:visited { color:#29467A; text-decoration: none; }
A.main:hover { color:#29467A;text-decoration: underline; }
a.sub:link, a.sub:visited { color:#687DA4;text-decoration: none; }
A.sub:hover {text-decoration: underline; }
.heading { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold; line-height: 1.5;color:#29467A; }
.main { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; line-height: 1;color:#29467A;}
.sub { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; line-height: 1.5;color:#29467A;}
.text { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; line-height: 1.5; color: #000000; }
.toptext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; line-height: 1.5; color: #FFFFFF; }
.menuBoxHeading { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; background-color: #FFFFFF; border-color: #FFFFFF; border-style: solid; border-width: 0px; color:#29467A;}
.menuBoxLink { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; background-color: #D6DFF7;#D8E2F4; border-color: #7187bb; border-style: solid; border-width: 0px; }
.infoLinkBox { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; background-color: #f2f4ff; border-color: #7187bb; border-style: solid; border-width: 1px; }
.infoBox { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; background-color: #D6DFF7; border-color: #FFFFFF; border-style: solid; border-width: 1px; }
.smallText { font-family: Verdana, Arial, sans-serif; font-size: 10px; }
//--></style>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<table border="0" width="600" height="100%" cellspacing="0" cellpadding="0" align="center" valign="middle">
  <tr>
    <td><table border="0" width="600" height="440" cellspacing="0" cellpadding="1" align="center" valign="middle">
      <tr>
        <td><table border="1" width="600" height="440" cellspacing="0" cellpadding="0" bordercolor="#6478D7">
			<tr height="50"><td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
          <tr height="50" bgcolor="white">
            <td height="50"><?php //echo tep_image(DIR_WS_IMAGES . 'oscommres_index.gif', '', '', ''); 
			//echo tep_image(DIR_WS_IMAGES . "freeway.png",STORE_NAME,'','','');
			echo tep_image(DIR_WS_TEMPLATES.DEFAULT_TEMPLATE.'/'.DIR_WS_IMAGES . COMPANY_LOGO, STORE_NAME,'','','');
			?></td>
            <td align="right" class="toptext" nowrap><?php echo '&nbsp;&nbsp;<a href="http://www.oscommres.com/index.php?id=302" target="_blank" class="toptext1">Doco</a>&nbsp;&nbsp;<font color=black>|</font>&nbsp;&nbsp;<a href="http://www.oscommres.com/" class="toptext1">osCommRes</a>&nbsp;&nbsp;<font color=black>|</font>&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_DEFAULT) . '" class="toptext1">' . HEADER_TITLE_ADMINISTRATION . '</a>&nbsp;&nbsp;<font color=black>|</font>&nbsp;&nbsp;<a href="' . tep_catalog_href_link() . '" class="toptext1">' . HEADER_TITLE_ONLINE_CATALOG . '</a>'; ?>&nbsp;&nbsp;</td>
          </tr></table></td>
		  </tr>
          <tr bgcolor="#6478D7">
            <td colspan="2"><table border="0" width="460" height="390" cellspacing="0" cellpadding="2">
              <tr valign="top">
                <td width="140" valign="top"><table border="0" width="140" height="390" cellspacing="0" cellpadding="2">
                  <tr>
                    <td valign="top"><br>
<?php
  $heading = array();
  $contents = array();

  $heading[] = array('params' => 'class="menuBoxHeading"',
                     'text'  => 'osCommRes');

  $contents[] = array('params' => 'class="infoBox"',
                      'text'  => '<a href="http://www.oscommres.com" target="_blank">' . BOX_ENTRY_SUPPORT_SITE . '</a><br>' .
                                 '<a href="http://www.oscommres.com/index.php?id=379" target="_blank">' . BOX_ENTRY_MAILING_LISTS . '</a><br>' .
                                 '<a href="http://www.oscommres.com/bugzilla" target="_blank">' . BOX_ENTRY_BUG_REPORTS . '</a><br>' .
                                 '<a href="http://www.oscommres.com/index.php?id=359" target="_blank">' . BOX_ENTRY_FAQ . '</a><br>' .
                                 '<a href="http://www.oscommres.com/svn/" target="_blank">' . BOX_ENTRY_SVN_REPOSITORY . '</a><br>' .
                                 '<a href="http://www.oscommres.com/index.php?id=302" target="_blank">' . BOX_ENTRY_DOCUMENTATION . '</a>');
  

  $box = new box;

	echo '<table border="0" cellspacing="0" cellpadding="0" class="menuboxHeading" width="100%"><tr>' .
		'<td nowrap align=left><img src="' . DIR_WS_IMAGES . 'categories/corner_left.gif" height=20 width=3 border=0></td>' .
		'<td align=left>osCommRes</td>' .
		'<td nowrap valign=top align=right><img src="' . DIR_WS_IMAGES . 'categories/corner_right.gif" height=20 width=3  border=0></td>' .
		'</tr></table>';
	echo $box->tableBlock($contents);
	echo '<br>';

  $orders_contents = '';
  $orders_status_query = tep_db_query("select orders_status_name, orders_status_id from " . TABLE_ORDERS_STATUS . " where language_id = '" . $languages_id . "'");
  while ($orders_status = tep_db_fetch_array($orders_status_query)) {
    $orders_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where orders_status = '" . $orders_status['orders_status_id'] . "'");
    $orders_pending = tep_db_fetch_array($orders_pending_query);
//Admin begin
//    $orders_contents .= '<a href="' . tep_href_link(FILENAME_ORDERS, 'selected_box=customers&status=' . $orders_status['orders_status_id']) . '">' . $orders_status['orders_status_name'] . '</a>: ' . $orders_pending['count'] . '<br>';
    if (tep_admin_check_boxes(FILENAME_ORDERS, 'sub_boxes') == true) { 
      $orders_contents .= '<a href="' . tep_href_link(FILENAME_ORDERS, 'selected_box=customers&status=' . $orders_status['orders_status_id']) . '">' . $orders_status['orders_status_name'] . '</a>: ' . $orders_pending['count'] . '<br>';
    } else {
      $orders_contents .= '' . $orders_status['orders_status_name'] . ': ' . $orders_pending['count'] . '<br>';
    }
//Admin end
  }
  $orders_contents = substr($orders_contents, 0, -4);

  $heading = array();
  $contents = array();

  $heading[] = array('params' => 'class="menuBoxHeading"',
                     'text'  => BOX_TITLE_ORDERS);

  $contents[] = array('params' => 'class="infoBox"',
                      'text'  => $orders_contents);

  $box = new box;
	echo '<table border="0" cellspacing="0" cellpadding="0" class="menuboxHeading" width="100%"><tr>' .
		'<td nowrap align=left><img src="' . DIR_WS_IMAGES . 'categories/corner_left.gif" height=20 width=3 border=0></td>' .
		'<td align=left>' . BOX_TITLE_ORDERS . '</td>' .
		'<td nowrap valign=top align=right><img src="' . DIR_WS_IMAGES . 'categories/corner_right.gif" height=20 width=3  border=0></td>' .
		'</tr></table>';

  echo $box->tableBlock($contents);

  echo '<br>';

  $customers_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS);
  $customers = tep_db_fetch_array($customers_query);
  $products_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS . " where products_status = '1'");
  $products = tep_db_fetch_array($products_query);
  $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS);
  $reviews = tep_db_fetch_array($reviews_query);

  $heading = array();
  $contents = array();

  $heading[] = array('params' => 'class="menuBoxHeading"',
                     'text'  => BOX_TITLE_STATISTICS);

  $contents[] = array('params' => 'class="infoBox"',
                      'text'  => BOX_ENTRY_CUSTOMERS . ' ' . $customers['count'] . '<br>' .
                                 BOX_ENTRY_PRODUCTS . ' ' . $products['count'] . '<br>' .
                                 BOX_ENTRY_REVIEWS . ' ' . $reviews['count']);

  $box = new box;
	echo '<table border="0" cellspacing="0" cellpadding="0" class="menuboxHeading" width="100%"><tr>' .
		'<td nowrap align=left><img src="' . DIR_WS_IMAGES . 'categories/corner_left.gif" height=20 width=3 border=0></td>' .
		'<td align=left>' . BOX_TITLE_STATISTICS . '</td>' .
		'<td nowrap valign=top align=right><img src="' . DIR_WS_IMAGES . 'categories/corner_right.gif" height=20 width=3  border=0></td>' .
		'</tr></table>';

  echo $box->tableBlock($contents);

  echo '<br>';

  $contents = array();

  if (getenv('HTTPS') == 'on') {
    $size = ((getenv('SSL_CIPHER_ALGKEYSIZE')) ? getenv('SSL_CIPHER_ALGKEYSIZE') . '-bit' : '<i>' . BOX_CONNECTION_UNKNOWN . '</i>');
    $contents[] = array('params' => 'class="infoBox"',
                        'text' => tep_image(DIR_WS_ICONS . 'locked.gif', ICON_LOCKED, '', '', 'align="right"') . sprintf(BOX_CONNECTION_PROTECTED, $size));
  } else {
    $contents[] = array('params' => 'class="infoBox"',
                        'text' => tep_image(DIR_WS_ICONS . 'unlocked.gif', ICON_UNLOCKED, '', '', 'align="right"') . BOX_CONNECTION_UNPROTECTED);
  }

  $box = new box;
  echo $box->tableBlock($contents);
?>
                    </td>
                  </tr>
                </table></td>
                <td width="500" bgcolor="#FFFFFF"><table border="0" width="500" height="390" cellspacing="0" cellpadding="2">
                  <tr>
                    <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                      <tr><?php echo tep_draw_form('languages', 'index.php', '', 'get'); ?>
                        <td class="heading"><?php echo HEADING_TITLE; ?></td>
                        <td align="right"><?php echo tep_draw_pull_down_menu('language', $languages_array, $languages_selected, 'onChange="this.form.submit();"'); ?></td>
                      </form></tr>
                    </table></td>
                  </tr>
<?php
  $col = 2;
  $counter = 0;
  for ($i = 0, $n = sizeof($cat); $i < $n; $i++) {
    $counter++;
    if ($counter < $col) {
      echo '                  <tr>' . "\n";
    }

    echo '                    <td width="50%"><table border="0" cellspacing="0" cellpadding="2" width="100%">' . "\n" .
         '                      <tr>' . "\n" .
         '                        <td width=32><a href="' . $cat[$i]['href'] . '">' . tep_image(DIR_WS_IMAGES . 'categories/' . $cat[$i]['image'], $cat[$i]['title'], '32', '32') . '</a></td>' . "\n" .
         '                        <td><table border="0" cellspacing="0" cellpadding="2" width="100%">' . "\n" .
         '                          <tr height=40>' . "\n" .
         '                            <td class="main"><a href="' . $cat[$i]['href'] . '" class="main">' . $cat[$i]['title'] . '</a><br><span class="sub">' . "\n" .
    //     '                          </tr>' . "\n" .
    //     '                          <tr>' . "\n" .
    //     '                            <td class="sub">';

    $children = '';
    for ($j = 0, $k = sizeof($cat[$i]['children']); $j < $k; $j++) {
      $children .= '<a href="' . $cat[$i]['children'][$j]['link'] . '" class="sub">' . $cat[$i]['children'][$j]['title'] . '</a>, ';
    }
    echo substr($children, 0, -2);

    echo '</span></td> ' . "\n" .
         '                          </tr>' . "\n" .
         '                        </table></td>' . "\n" .
         '                      </tr>' . "\n" .
         '                    </table></td>' . "\n";

    if ($counter >= $col) {
      echo '                  </tr>' . "\n";
      $counter = 0;
    }
  }
?>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php require(DIR_WS_INCLUDES . 'footer.php'); ?></td>
      </tr>
    </table></td>
  </tr>
</table>

</body>

</html>
