<?php
  /*===================================================
    ShowMainPage()
  ===================================================*/

  function ShowMainPage() {

    // vars global configuration
    global $dbConn, $theme_path, $number_of_links_format, $category_separator,
             $cat_default_image, $cat_columns, $max_sub_cat, $cat_link_style, 
             $subcat_link_style, $cat_table_width, $cat_cellspacing, 
             $theme_name, $cat_description_format;

    // vars messages
    global $msg;

    // vars template
    global $category;

    // show categories
    $category_obj = new clsCategory;
    $category_obj->table_name             = "idx_category";
    $category_obj->link_table_name        = "idx_link";
    $category_obj->number_of_columns      = $cat_columns;
    $category_obj->number_of_subcats      = $max_sub_cat;
    $category_obj->default_image          = $cat_default_image;
    $category_obj->image_path             = "themes/" . $theme_name . "/images/";
    $category_obj->show_subcat            = true;
    $category_obj->show_description       = true;
    $category_obj->number_of_links_format = $number_of_links_format;
    $category_obj->cat_description_format = $cat_description_format;
    $category_obj->cat_link_style         = $cat_link_style;
    $category_obj->subcat_link_style      = $subcat_link_style;
    $category_obj->cat_table_width        = $cat_table_width;
    $category_obj->cat_cellspacing        = $cat_cellspacing;
    $category_obj->separator              = $category_separator;
    $category_obj->parent                 = 0;
    $category                             = $category_obj->Display();
    
    DisplayTemplate($theme_path . "index.html", "\$category");
  }


  /*===================================================
    main
  ===================================================*/

  include "application.php";

  AddFilter("page_cache");
  RunPreFilter(__FILE__);

  if (!defined('CACHED_PAGE')) {
    ShowMainPage();
  }

  RunPostFilter(__FILE__);

?>