<?php 

// --------------------------
// Simple PHP Blog Theme File
// --------------------------
//
// Name: 2menus-dashed
// Author: Jörg Tiedemann
// Version: 0.1
//


sb_language( 'themes' ); // load language strings

block_admin();           // this is for block management in the side menus
theme_init();            // initialize theme parameters

	
// ---------------
// Theme Variables
// ---------------
function theme_init () {
    global $theme_vars;
    global $blog_config;
		
    $theme_vars = array();
		
    // New 0.3.8
    //
    // Optional:
    // "content_width" and "menu_width" area used internally
    // within the theme only. (optional but recommended.)
    if (isset($blog_config['blog_entry_width'])){
      $theme_vars["content_width"] = $blog_config['blog_entry_width'];
    }
    else{$theme_vars["content_width"] = 550;}
    if (isset($blog_config['blog_menu_width'])){
      $theme_vars["menu_width"] = $blog_config['blog_menu_width'];
    }
    else{$theme_vars["menu_width"] = 170;}
		
    // Required:
    // "popup_window" "width" and "height" are used to determine
    // the size of window to open for the comment view.
    $theme_vars["popup_window"]["width"] = $theme_vars["content_width"] + 50;
    $theme_vars["popup_window"]["height"] = 600;
		
    // Optional:
    // "popup_window" "content_width" is only used internally.
    $theme_vars["popup_window"]["content_width"] = $theme_vars['content_width'];
		
    // Retained from 0.3.7c
    //
    // Required:
    // Determines the maximum with of images within a page.
    // Make sure this value is less then "content_width" or you
    // might have wrapping problems.
    $theme_vars["max_image_width"] = $theme_vars["content_width"] - 20;
}





// Function:
// theme_blogentry( $entry_array )
//
// Theme for Blog Entries
// ----------------------
// we simply use the default style defined in scripts/sb_theme.php

function theme_blogentry ( $entry_array ) {
  return photo_blogentry($entry_array);
}

// Display STATIC entry page.
// again, we use the default style
	
function theme_staticentry ( $entry_array ) {
  return photo_blogentry($entry_array);
}

// Display COMMENT entry page.
// ... and one again - the default style!
	
function theme_commententry ( $entry_array ) {
  return photo_blogentry($entry_array);
}
	
// display trackback entries
// use default style defined in scripts/sb_theme.php
function theme_trackbackentry ( $entry_array ) {
  return photo_trackbackentry($entry_array);
}



// functions for displaying side menus
// use functions defined in scripts/sb_menublocks.php

function theme_menu_left(){
  menu_blocks('left');
}

function theme_menu_right(){
  menu_blocks('right');
}

function theme_menu_top(){
  top_menu_blocks();
}


// Function:
// theme_default_colors( )
//
// Default Base Colors
// -------------------
// $user_colors is an associative array that stores
// all color information. These are the default colors
// for the theme. These values are read in, and then
// get overwritten when the user saved colors are
// read from file.
//
// Note
// ----
// You can create your own "keys"
// they will show up in "colors.php"
	
function theme_default_colors () {
    global $lang_string;
		
    $color_def = array();
		
    // Backgrounds
    array_push( $color_def, array( 'id' => 'bg_color',
				   'string' => $lang_string['bg_color'],
				   'default' => 'F7F7F7' ) );
    array_push( $color_def, array( 'id' => 'header_bg_color',
				   'string' => $lang_string['header_bg_color'],
				   'default' => 'F2F2F2' ) );
    array_push( $color_def, array( 'id' => 'footer_bg_color',
				   'string' => $lang_string['footer_bg_color'],
				   'default' => 'F2F2F2' ) );
    array_push( $color_def, array( 'id' => 'main_bg_color',
				   'string' => $lang_string['main_bg_color'],
				   'default' => 'FFFFFF' ) );
    array_push( $color_def, array( 'id' => 'menu_bg_color',
				   'string' => $lang_string['menu_bg_color'],
				   'default' => 'FFFFFF' ) );
		
    // Borders
    array_push( $color_def, array( 'id' => 'border_color',
				   'string' => $lang_string['border_color'],
				   'default' => 'CCCCCC' ) );
    array_push( $color_def, array( 'id' => 'inner_border_color',
				   'string' => $lang_string['inner_border_color'],
				   'default' => 'E6E6E6' ) );
    array_push( $color_def, array( 'id' => 'header_txt_color',
				   'string' => $lang_string['header_txt_color'],
				   'default' => '999999' ) );
    array_push( $color_def, array( 'id' => 'footer_txt_color',
				   'string' => $lang_string['footer_txt_color'],
				   'default' => '999999' ) );
    array_push( $color_def, array( 'id' => 'txt_color',
				   'string' => $lang_string['txt_color'],
				   'default' => '4D4D4D' ) );
    array_push( $color_def, array( 'id' => 'headline_txt_color',
				   'string' => $lang_string['headline_txt_color'],
				   'default' => '999999' ) );
    array_push( $color_def, array( 'id' => 'date_txt_color',
				   'string' => $lang_string['date_txt_color'],
				   'default' => '999999' ) );
		
		
    array_push( $color_def, array( 'id' => 'entry_bg',
				   'string' => $lang_string['entry_bg'],
				   'default' => 'FFFFFF' ) );
    array_push( $color_def, array( 'id' => 'entry_title_bg',
				   'string' => $lang_string['entry_title_bg'],
				   'default' => 'F2F2F2' ) );
    array_push( $color_def, array( 'id' => 'entry_border',
				   'string' => $lang_string['entry_border'],
				   'default' => 'CCCCCC' ) );
								
    array_push( $color_def, array( 'id' => 'entry_title_text',
				   'string' => $lang_string['entry_title_text'],
				   'default' => '999999' ) );
    array_push( $color_def, array( 'id' => 'entry_text',
				   'string' => $lang_string['entry_text'],
				   'default' => '4D4D4D' ) );
		
    array_push( $color_def, array( 'id' => 'menu_bg',
				   'string' => $lang_string['menu_bg'],
				   'default' => 'FFFFFF' ) );
    array_push( $color_def, array( 'id' => 'menu_title_bg',
				   'string' => $lang_string['menu_title_bg'],
				   'default' => 'F2F2F2' ) );
    array_push( $color_def, array( 'id' => 'menu_border',
				   'string' => $lang_string['menu_border'],
				   'default' => 'CCCCCC' ) );
								
    array_push( $color_def, array( 'id' => 'menu_title_text',
				   'string' => $lang_string['menu_title_text'],
				   'default' => '999999' ) );
    array_push( $color_def, array( 'id' => 'menu_text',
				   'string' => $lang_string['menu_text'],
				   'default' => '4D4D4D' ) );
		
    array_push( $color_def, array( 'id' => 'link_reg_color',
				   'string' => $lang_string['link_reg_color'],
				   'default' => '5977B3' ) );
    array_push( $color_def, array( 'id' => 'link_hi_color',
				   'string' => $lang_string['link_hi_color'],
				   'default' => '829FD9' ) );
    array_push( $color_def, array( 'id' => 'link_down_color',
				   'string' => $lang_string['link_down_color'],
				   'default' => '829FD9' ) );
								
    array_push( $color_def, array( 'id' => 'menu_link_reg_color',
				   'string' => $lang_string['menu_link_reg_color'],
				   'default' => '5977B3' ) );
    array_push( $color_def, array( 'id' => 'menu_link_hi_color',
				   'string' => $lang_string['menu_link_hi_color'],
				   'default' => '829FD9' ) );
    array_push( $color_def, array( 'id' => 'menu_link_down_color',
				   'string' => $lang_string['menu_link_down_color'],
				   'default' => '829FD9' ) );
		
    return ( $color_def );
}



function theme_pagelayout () {
  global $blog_config;
  $blog_config['show_links_in_header']=true;
  $blog_config['show_searchbox_in_header']=true;

  //  default_pagelayout();

    global $user_colors, $blog_config, $theme_vars, $blog_theme, 
	$logged_in, $lang_string, $sb_info, $signed_in;
		
    $left_blocks = get_menu_blocks('left');
    $right_blocks = get_menu_blocks('right');
    $top_blocks = get_menu_blocks('top');

?>
<body>
  <div class="page">
      <?php if (count($top_blocks) && 
		function_exists('theme_menu_top')){ ?>
        <?php theme_menu_top(); ?>
      <br clear="all" />
      <?php } ?>


      <?php if (count($left_blocks) && function_exists('theme_menu_left')){ ?>
<!-- ........... LEFT SIDE MENU ................ -->
      <div class="left">
        <div class="sidebar">
        <?php theme_menu_left(); ?>
        </div>
      </div>
      <?php } ?>


     <?php if (count($right_blocks) && function_exists('theme_menu_right')){ ?>
<!-- ........... RIGHT SIDE MENU ............... -->
      <div class="right">
        <div class="sidebar">
          <?php theme_menu_right(); ?>
        </div>
      </div>
      <?php } ?>


    <div class="main">
<!-- ........... HEADER MENU ................ -->
<?php   if (!$blog_config['blog_hide_header']){ ?>
    <div class="header">
<?php   if ($blog_config['show_searchbox_in_header'] && 
	    (! $blog_config['blog_hide_header_searchbox'] == 'on')){ ?>
      <div class="search_box">
        <br />
        <?php
        $result = menu_search_field();
        echo( $result["content"] );
        ?>
      </div>
<?php }
      if (!$blog_config['blog_hide_title']){ ?>
      <div class="title">
	<a href="index.php">
        <?php echo($blog_config[ 'blog_title' ]); ?>
        </a>
      </div>
<?php }
      if ($blog_config['show_links_in_header'] && 
	  (! $blog_config['blog_hide_header_links'] == 'on')){
	  echo '<span class="links">';
	  $parts = explode('.',$sb_info[ 'version' ]);
	  if ($parts['1'] > 3){
	    if ($parts['2'] > 3){
	      $newspb = true;
	    }
	  }

	  $links = link_array( $logged_in );
	  for ( $i = 0; $i < count( $links ); $i = $i + 2 ) {
	    if ($i){echo ' / ';}
	    if ( $links[$i+1] == '' ) {
	      echo $links[$i];
	    } else {
	      echo '<a href="' . $links[$i+1] . '">' . $links[$i] . '</a>';
	    }
	  }

	  echo '</span>';
	    }
	  ?>
    </div>

<?php } ?>

<!-- ........... BLOG ENTRIES START HERE ....... -->
      <div class="centercontent">
	<?php page_content(); ?>
      </div>
    </div>
    <br clear="all">
  </div>
<script language="JavaScript">
<!--
setStyleByClass("div","centercontent","height",innerHeight()-165+"px");
//-->
</script>
<?php 
      // End Page Layout HTML
      //  default_pagelayout();
}


// ... and this is for popup windows
// use default layout from scripts/sb_theme.php

function theme_popuplayout () {
  default_popuplayout();
}

?>
