<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/

  class box extends tableBlock {
    function box() {
      $this->heading = array();
      $this->contents = array();
    }

    function infoBox($heading, $contents) {
      $this->table_row_parameters = 'class="dataTableHeadingRowR"';
      $this->table_data_parameters = 'class="pageHeadingR"';
      $this->heading = $this->tableBlock($heading);

      $this->table_row_parameters = '';
      $this->table_data_parameters = 'class="infoBoxContent"';
      $this->contents = $this->tableBlock($contents);

      return $this->heading . $this->contents;
    }

    function menuBox($heading, $contents) {
		global $menu_dhtml;              // add for dhtml_menu
		if ($menu_dhtml == false ) {     // add for dhtml_menu
	    	$this->table_data_parameters = 'class="menuBoxHeading"';
			if (isset($heading[0]['link'])) {
				$this->table_data_parameters .= ' onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . $heading[0]['link'] . '\'"';
				$heading[0]['text'] = '&nbsp;<a href="' . $heading[0]['link'] . '" class="menuBoxHeadingLink">' . $heading[0]['text'] . '</a>&nbsp;';
			} else {
				$heading[0]['text'] = '&nbsp;' . $heading[0]['text'] . '&nbsp;';
			}
			$this->heading = $this->tableBlock($heading);
			$this->table_data_parameters = 'class="menuBoxContent"';
			$this->contents = $this->tableBlock($contents);
			return $this->heading . $this->contents;
		} else {
			// Replaced this to make sure that the correct id is passed to the menu
			$url = parse_url($heading[0]['link']);
			$params = explode("&", $url["query"]);
			foreach($params AS $param) {
				list($key, $value) = explode("=", $param);
				if ($key == "selected_box")
					$selected = $value;
			}
			// Eof replacement
	      	$dhtml_contents = $contents[0]['text'];
		    $change_style = array ('<br>'=>' ','<BR>'=>' ', 'a href='=> 'a class="menuItem" href=','class="menuBoxContentLink"'=>' ');
		    $dhtml_contents = strtr($dhtml_contents,$change_style);
		    $dhtml_contents = '<div id="'.$selected.'Menu" class="menu" onmouseover="menuMouseover(event)">'. $dhtml_contents . '</div>';
		    return $dhtml_contents;
		}
	}
  }
?>
