<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
require('load_this/load_bigware_11.php');

if (file_exists(FOLDER_ABSOLUT_CATALOG . 'modules/konfigurator')) {
  require(FOLDER_ABSOLUT_CATALOG . 'modules/konfigurator/configmain/configurator.php');
}else{
	
	$type_array=array('0'=> array('id'=>"selectframe",'text'=>"SelectBox"),'1'=>array('id'=>"radioframe", 'text'=>"RadioBox"), '2'=>array('id'=>"checkbox", 'text'=>"CheckBox"));
	  
	  $languages = go_get_languages();
	  $action = (isset($_GET['action']) ? $_GET['action'] : '');
	  if (go_not_null($action)) {
	    $page_info = '';
	    if (isset($_GET['option_conf_page'])) $page_info .= 'option_conf_page=' . $_GET['option_conf_page'] . '&';
	    if (isset($_GET['value_conf_page'])) $page_info .= 'value_conf_page=' . $_GET['value_conf_page'] . '&';
	    if (isset($_GET['characteristic_conf_page'])) $page_info .= 'characteristic_conf_page=' . $_GET['characteristic_conf_page'] . '&';
	    if (go_not_null($page_info)) {
	      $page_info = substr($page_info, 0, -1);
	    }
	    switch ($action) {
	      case 'add_item_options_conf':
	        $items_options_conf_id = go_db_producing_input($_POST['items_options_conf_id']);
	        $option_conf_name_array = $_POST['option_conf_name'];
					$option_conf_type_array = $_POST['option_conf_type'];
	        for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	          $option_conf_name = go_db_producing_input($option_conf_name_array[$languages[$i]['id']]);
						$option_conf_type = go_db_producing_input($option_conf_type_array[$languages[$i]['id']]);
	          go_db_query("insert into " . DB_TBL_ITEMS_OPTIONS_CONF . " (items_options_conf_id, items_options_conf_name, language_id,items_type) values ('" . (int)$items_options_conf_id . "', '" . go_db_input($option_conf_name) . "', '" . (int)$languages[$i]['id'] . "', '" . go_db_input($option_conf_type) . "')");
	        }
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'add_item_option_conf_values':
	        $value_conf_name_array = $_POST['value_conf_name'];
					$value_conf_desc_array = $_POST['value_conf_desc'];
	        $value_conf_id = go_db_producing_input($_POST['value_conf_id']);
	        $option_conf_id = go_db_producing_input($_POST['option_conf_id']);
	        for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	          $value_conf_name = go_db_producing_input($value_conf_name_array[$languages[$i]['id']]);
						$value_conf_desc = go_db_producing_input($value_conf_desc_array[$languages[$i]['id']]);
	          go_db_query("insert into " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " (items_options_conf_values_id, language_id, items_options_conf_values_name,items_options_conf_values_desc) values ('" . (int)$value_conf_id . "', '" . (int)$languages[$i]['id'] . "', '" . go_db_input($value_conf_name) . "', '" . go_db_input($value_conf_desc) . "')");
	        }
	        go_db_query("insert into " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES_TO_ITEMS_OPTIONS_CONF . " (items_options_conf_id, items_options_conf_values_id) values ('" . (int)$option_conf_id . "', '" . (int)$value_conf_id . "')");
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'add_item_characteristics_conf': 
	        $items_id = go_db_producing_input($_POST['items_id']);
	        $options_conf_id = go_db_producing_input($_POST['options_conf_id']);
					$options_conf_parent_id = go_db_producing_input($_POST['options_conf_parent_id']);
	        $values_conf_id = go_db_producing_input($_POST['values_conf_id']);
	        $values_conf_parent_id = go_db_producing_input($_POST['values_conf_parent_id']);
	        $value_conf_price = go_db_producing_input($_POST['value_conf_price']);
	        $price_prefix = go_db_producing_input($_POST['price_prefix']);
	        go_db_query("insert into " . DB_TBL_ITEMS_CHARACTERISTICS_CONF . "(items_id, options_conf_id, options_conf_values_id, options_conf_parent_id , options_conf_values_parent_id , options_conf_values_price, price_prefix) values ( '" . (int)$items_id . "', '" . (int)$options_conf_id . "', '" . (int)$values_conf_id . "',  '" . (int)$options_conf_parent_id . "', '" . (int)$values_conf_parent_id . "', '" . go_db_input($value_conf_price) . "', '" . go_db_input($price_prefix) . "')");
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'update_option_conf_name':
	        $option_conf_name_array = $_POST['option_conf_name'];
					$option_conf_type_array = $_POST['option_conf_type'];
	        $option_conf_id = go_db_producing_input($_POST['option_conf_id']);
	        for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	          $option_conf_name = go_db_producing_input($option_conf_name_array[$languages[$i]['id']]);
						$option_conf_type = go_db_producing_input($option_conf_type_array[$languages[$i]['id']]);
	          go_db_query("update " . DB_TBL_ITEMS_OPTIONS_CONF . " set items_options_conf_name = '" . go_db_input($option_conf_name) . "', items_type  = '" . go_db_input($option_conf_type) . "' where items_options_conf_id = '" . (int)$option_conf_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	        }
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'update_value_conf':
	        $value_conf_name_array = $_POST['value_conf_name'];
					$value_conf_desc_array = $_POST['value_conf_desc'];
	        $value_conf_id = go_db_producing_input($_POST['value_conf_id']);
	        $option_conf_id = go_db_producing_input($_POST['option_conf_id']);
	        for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	          $value_conf_name = go_db_producing_input($value_conf_name_array[$languages[$i]['id']]);
						$value_conf_desc = go_db_producing_input($value_conf_desc_array[$languages[$i]['id']]);
	          go_db_query("update " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " set items_options_conf_values_name = '" . go_db_input($value_conf_name) . "',items_options_conf_values_desc = '" . go_db_input($value_conf_desc) . "' where items_options_conf_values_id = '" . go_db_input($value_conf_id) . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	        }
	        go_db_query("update " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES_TO_ITEMS_OPTIONS_CONF . " set items_options_conf_id = '" . (int)$option_conf_id . "'  where items_options_conf_values_id = '" . (int)$value_conf_id . "'");
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'update_item_characteristic_conf':
	        $items_id = go_db_producing_input($_POST['items_id']);
	        $options_conf_id = go_db_producing_input($_POST['options_conf_id']);
	        $values_conf_id = go_db_producing_input($_POST['values_conf_id']);
					$options_conf_parent_id = go_db_producing_input($_POST['options_conf_parent_id']);
	        $values_conf_parent_id = go_db_producing_input($_POST['values_conf_parent_id']);
	        $value_conf_price = go_db_producing_input($_POST['value_conf_price']);
	        $price_prefix = go_db_producing_input($_POST['price_prefix']);
	        $characteristic_conf_id = go_db_producing_input($_POST['characteristic_conf_id']);
	        go_db_query("update " . DB_TBL_ITEMS_CHARACTERISTICS_CONF . " set items_id = '" . (int)$items_id . "', options_conf_id = '" . (int)$options_conf_id . "',  options_conf_parent_id = '" . (int)$options_conf_parent_id . "', options_conf_values_id = '" . (int)$values_conf_id . "',  options_conf_values_parent_id = '" . (int)$values_conf_parent_id . "', options_conf_values_price = '" . go_db_input($value_conf_price) . "', price_prefix = '" . go_db_input($price_prefix) . "' where items_characteristics_conf_id = '" . (int)$characteristic_conf_id . "'");
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'delete_option_conf':
	        $option_conf_id = go_db_producing_input($_GET['option_conf_id']);
	        go_db_query("delete from " . DB_TBL_ITEMS_OPTIONS_CONF . " where items_options_conf_id = '" . (int)$option_conf_id . "'");
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'delete_value_conf':
	        $value_conf_id = go_db_producing_input($_GET['value_conf_id']);
	        go_db_query("delete from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where items_options_conf_values_id = '" . (int)$value_conf_id . "'");
	        go_db_query("delete from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where items_options_conf_values_id = '" . (int)$value_conf_id . "'");
	        go_db_query("delete from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES_TO_ITEMS_OPTIONS_CONF . " where items_options_conf_values_id = '" . (int)$value_conf_id . "'");
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	      case 'delete_characteristic_conf':
	        $characteristic_conf_id = go_db_producing_input($_GET['characteristic_conf_id']);
	        go_db_query("delete from " . DB_TBL_ITEMS_CHARACTERISTICS_CONF . " where items_characteristics_conf_id = '" . (int)$characteristic_conf_id . "'");
	        go_forward(go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, $page_info));
	        break;
	    }
	  }
	?>
	<!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>
	<link rel="stylesheet" type="text/css" href="load_this/style.css">
	<script language="javascript" src="load_this/menu.js"></script>
	<script language="javascript"><!--
	function go_option_conf() {
	  if (document.option_conf_order_by.selected.options_conf[document.option_conf_order_by.selected.selectedIndex].value != "none") {
	    location = "<?php echo go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'option_conf_page=' . ($_GET['option_conf_page'] ? $_GET['option_conf_page'] : 1)); ?>&option_conf_order_by="+document.option_conf_order_by.selected.options_conf[document.option_conf_order_by.selected.selectedIndex].value;
	  }
	}
	//--></script>
	</head>
	<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
	<!-- header //-->
	<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php'); ?>
	<!-- header_eof //-->
	<!-- body //-->
	<table border="0" width="100%" cellspacing="2" cellpadding="2">
	  <tr>
	    <td width="<?php echo FRAME_WIDTH; ?>" valign="top">
	<!-- left_navigation //-->
	<!-- left_navigation_eof //-->
	</td>
	<!-- body_text //-->
	    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
	<!-- options and values//-->
	      <tr>
	        <td width="100%"><table border="0" cellspacing="0" cellpadding="0">
	          <tr>
	            <td valign="top"><table border="0" cellspacing="0" cellpadding="2">
	<!-- options //-->
	<?php
	  if ($action == 'delete_item_option_conf') { 
	    $options_conf = go_db_query("select items_options_conf_id, items_options_conf_name,items_type from " . DB_TBL_ITEMS_OPTIONS_CONF . " where items_options_conf_id = '" . (int)$_GET['option_conf_id'] . "' and language_id = '" . (int)$languages_id . "'");
	    $options_conf_values = go_db_fetch_array($options_conf);
	?>
	              <tr>
	                <td class="pageGeneralsign">&nbsp;<?php echo $options_conf_values['items_options_conf_name']; ?>&nbsp;</td>
	                <td>&nbsp;<?php echo go_picture(FOLDER_RELATIV_PICTURES . 'tranparentes.gif', '', '1', '53'); ?>&nbsp;</td>
	              </tr>
	              <tr>
	                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	                  <tr>
	                    <td colspan="3"><?php echo go_black_line(); ?></td>
	                  </tr>
	<?php
	    $items = go_db_query("select p.items_id, pd.items_name, pov.items_options_conf_values_name,pov.items_options_conf_values_desc from " . DB_TBL_ITEMS . " p, " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " pov, " . DB_TBL_ITEMS_CHARACTERISTICS_CONF . " pa, " . DB_TBL_ITEMS_DESCRIPTION . " pd where pd.items_id = p.items_id and pov.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "' and pa.items_id = p.items_id and pa.options_conf_id='" . (int)$_GET['option_conf_id'] . "' and pov.items_options_conf_values_id = pa.options_conf_values_id order by pd.items_name");
	    if (go_db_num_rows($items)) {
	?>
	                  <tr class="tbUPCountData">
	                    <td class="tbUPDataInside" align="center">&nbsp;<?php echo DB_TBL_ABOVE_ID; ?>&nbsp;</td>
	                    <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_ITEM; ?>&nbsp;</td>
	                    <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_OPT_VALUE; ?>&nbsp;</td>
	                  </tr>
	                  <tr>
	                    <td colspan="3"><?php echo go_black_line(); ?></td>
	                  </tr>
	<?php
	      $rows = 0;
	      while ($items_values_conf = go_db_fetch_array($items)) {
	        $rows++;
	?>
	                  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	                    <td align="center" class="smallText">&nbsp;<?php echo $items_values_conf['items_id']; ?>&nbsp;</td>
	                    <td class="smallText">&nbsp;<?php echo $items_values_conf['items_name']; ?>&nbsp;</td>
	                    <td class="smallText">&nbsp;<?php echo $items_values_conf['items_options_conf_values_name']; ?>&nbsp;<?php echo $items_values_conf['items_options_conf_values_desc']; ?></td>
			
	                  </tr>
	<?php
	      }
	?>
	                  <tr>
	                    <td colspan="3"><?php echo go_black_line(); ?></td>
	                  </tr>
	                  <tr>
	                    <td colspan="3" class="main"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>
	                  </tr>
	                  <tr>
	                    <td align="right" colspan="3" class="main"><br><?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, (isset($_GET['value_conf_page']) ? 'value_conf_page=' . $_GET['value_conf_page'] . '&' : '') . (isset($_GET['characteristic_conf_page']) ? 'characteristic_conf_page=' . $_GET['characteristic_conf_page'] : ''), 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
	                  </tr>
	<?php
	    } else {
	?>
	                  <tr>
	                    <td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>
	                  </tr>
	                  <tr>
	                    <td class="main" align="right" colspan="3"><br><?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=delete_option_conf&option_conf_id=' . $_GET['option_conf_id'], 'NONSSL') . '">'; ?><?php echo go_picture_button('button_delete.gif', ' delete '); ?></a>&nbsp;&nbsp;&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, (isset($_GET['order_by']) ? 'order_by=' . $_GET['order_by'] . '&' : '') . (isset($_GET['page']) ? 'page=' . $_GET['page'] : ''), 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
	                  </tr>
	<?php
	    }
	?>
	                </table></td>
	              </tr>
	<?php
	  } else {
	    if (isset($_GET['option_conf_order_by'])) {
	      $option_conf_order_by = $_GET['option_conf_order_by'];
	    } else {
	      $option_conf_order_by = 'items_options_conf_id';
	    }
	?>
	              <tr>
	                <td colspan="2" class="pageGeneralsign" height="80px">
	                
				<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse" bordercolor="#111111">
				<tr><td class="pageGeneralsign">
				&nbsp;<?php echo ABOVE_TITLE_OPT; ?>&nbsp;
				</td><td>
				  <p align="right">
				<form name="option_conf_order_by" action="<?php echo NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF; ?>">
				 <select name="selected" onChange="go_option()">
				 <option value="items_options_conf_id"<?php if ($option_conf_order_by == 'items_options_conf_id') { echo ' SELECTED'; } ?>><?php echo TEXT_OPTION_ID; ?></option>
				 <option value="items_options_conf_name"<?php if ($option_conf_order_by == 'items_options_conf_name') { echo ' SELECTED'; } ?>><?php echo TEXT_OPTION_NAME; ?></option>
				 </select>
				</form>  
				</td></tr>
				</table>                
	                </td>
	              </tr>
								 <tr>
	                <td colspan="2" class="smallText">
	<?php
	    $per_page = MAX_ROW_LISTS_OPTIONS;
	    $options_conf = "select * from " . DB_TBL_ITEMS_OPTIONS_CONF . " where language_id = '" . (int)$languages_id . "' order by " . $option_conf_order_by;
	    if (!isset($option_conf_page)) {
	      $option_conf_page = 1;
	    }
	    $prev_option_conf_page = $option_conf_page - 1;
	    $next_option_conf_page = $option_conf_page + 1;
	    $option_conf_query = go_db_query($options_conf);
	    $option_conf_page_start = ($per_page * $option_conf_page) - $per_page;
	    $num_rows = go_db_num_rows($option_conf_query);
	    if ($num_rows <= $per_page) {
	      $num_pages = 1;
	    } else if (($num_rows % $per_page) == 0) {
	      $num_pages = ($num_rows / $per_page);
	    } else {
	      $num_pages = ($num_rows / $per_page) + 1;
	    }
	    $num_pages = (int) $num_pages;
	    $options_conf = $options_conf . " LIMIT $option_conf_page_start, $per_page"; 
	    if ($prev_option_conf_page)  {
	      echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'option_conf_page=' . $prev_option_conf_page) . '"> &lt;&lt; </a> | ';
	    }
	    for ($i = 1; $i <= $num_pages; $i++) {
	      if ($i != $option_conf_page) {
	        echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'option_conf_page=' . $i) . '">' . $i . '</a> | ';
	      } else {
	        echo '<b><font color=red>' . $i . '</font></b> | ';
	      }
	    } 
	    if ($option_conf_page != $num_pages) {
	      echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'option_conf_page=' . $next_option_conf_page) . '"> &gt;&gt; </a>';
	    }
	?>
	                </td>
	              </tr>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	              <tr class="tbUPCountData">
	                <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_ID; ?>&nbsp;</td>
	                <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_OPT_NAME; ?>&nbsp;/&nbsp;<?php echo DB_TBL_ABOVE_OPT_TYPE; ?>&nbsp;</td>
	
	                
	              </tr>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	<?php
	    $next_id = 1;
	    $rows = 0;
	    $options_conf = go_db_query($options_conf);
	    while ($options_conf_values = go_db_fetch_array($options_conf)) { 
	      $rows++;
	?>
	              <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	<?php
	      if (($action == 'update_option_conf') && ($_GET['option_conf_id'] == $options_conf_values['items_options_conf_id'])) {
	        echo '<form name="option" action="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=update_option_conf_name', 'NONSSL') . '" method="post">';
	        $inputs = '<table border="0" cellpadding="0" cellspacing="0">';
	        $types = '<table border="0" cellpadding="0" cellspacing="0">';
	        for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	          $option_conf_name = go_db_query("select items_options_conf_name,items_type  from " . DB_TBL_ITEMS_OPTIONS_CONF . " where items_options_conf_id = '" . $options_conf_values['items_options_conf_id'] . "' and language_id = '" . $languages[$i]['id'] . "'");
	          $option_conf_name = go_db_fetch_array($option_conf_name);
	          $inputs .= '<tr><td class="smallText">' . $languages[$i]['code'] . '</td><td>:&nbsp;<input type="text" name="option_conf_name[' . $languages[$i]['id'] . ']" size="20" value="' . $option_conf_name['items_options_conf_name'] . '"></td></tr>';
		  $types .= '<tr><td class="smallText">' . $languages[$i]['code'] . '</td><td>:&nbsp;'.go_fetch_pull_down_menu("option_conf_type[" . $languages[$i]['id'] . "]",$type_array,$option_conf_name['items_type']).'</td></tr>';
	        }
	        $inputs .= '</table>';
	        $types .= '</table>';
	?>
	                <td align="center" class="smallText">&nbsp;<?php echo $options_conf_values['items_options_conf_id']; ?><input type="hidden" name="option_conf_id" value="<?php echo $options_conf_values['items_options_conf_id']; ?>">&nbsp;</td>
	                <td class="smallText">    <table border="0" cellpadding="0" cellspacing="0"><tr><td><?php echo $inputs; ?></td><td>&nbsp;/&nbsp;</td><td><?php echo $types; ?></td></tr></table>    </td>
	                </tr>
	                <tr>
	                <td colspan="2" align="center" class="smallText">&nbsp;<?php echo go_picture_submit('button_update.gif', PICTURE_UPDATE); ?>&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, '', 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', PICTURE_CANCEL); ?></a>&nbsp;</td>
	<?php
	        echo '</form>' . "\n";
	      } else {
	?>
	                <td align="center" class="smallText">&nbsp;<?php echo $options_conf_values["items_options_conf_id"]; ?>&nbsp;</td>
	                <td class="smallText">    <table border="0" cellpadding="0" cellspacing="0"><tr><td>&nbsp;<?php echo $options_conf_values["items_options_conf_name"]; ?>&nbsp;</td><td>&nbsp;/&nbsp;</td><td>&nbsp;<?php echo $options_conf_values["items_type"]; ?>&nbsp;</td></tr></table>    </td>
	                </tr>
	                <tr>
	                <td colspan="2" align="center" class="smallText">&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=update_option_conf&option_conf_id=' . $options_conf_values['items_options_conf_id'] . '&option_conf_order_by=' . $option_conf_order_by . '&option_conf_page=' . $option_conf_page, 'NONSSL') . '">'; ?><?php echo go_picture_button('button_change.gif', PICTURE_UPDATE); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=delete_item_option_conf&option_conf_id=' . $options_conf_values['items_options_conf_id'], 'NONSSL') , '">'; ?><?php echo go_picture_button('button_delete.gif', PICTURE_DELETE); ?></a>&nbsp;</td>
	<?php
	      }
	?>
	              </tr>
	<?php
	      $max_options_conf_id_query = go_db_query("select max(items_options_conf_id) + 1 as next_id from " . DB_TBL_ITEMS_OPTIONS_CONF);
	      $max_options_conf_id_values = go_db_fetch_array($max_options_conf_id_query);
	      $next_id = $max_options_conf_id_values['next_id'];
	    }
	?>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	<?php
	    if ($action != 'update_option_conf') {
	?>
	              <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	<?php
	      echo '<form name="options_conf" action="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=add_item_options_conf&option_conf_page=' . $option_conf_page, 'NONSSL') . '" method="post"><input type="hidden" name="items_options_conf_id" value="' . $next_id . '">';
	      $inputs = '<table border="0" cellpadding="0" cellspacing="0">';
	      $types = '<table border="0" cellpadding="0" cellspacing="0">';
	      for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	        $inputs .= '<tr><td class="smallText">' . $languages[$i]['code'] . '</td><td>:&nbsp;<input type="text" name="option_conf_name[' . $languages[$i]['id'] . ']" size="20"></td></tr>';
		$types .= '<tr><td class="smallText">' . $languages[$i]['code'] . '</td><td>:&nbsp;'.go_fetch_pull_down_menu("option_conf_type[" . $languages[$i]['id'] . "]",$type_array).'</td></tr>';
	      }
	      $inputs .= '</table>';
	      $types .= '</table>';
	?>
	                <td align="center" class="smallText">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
	                <td class="smallText">    <table border="0" cellpadding="0" cellspacing="0"><tr><td><?php echo $inputs; ?></td><td>&nbsp;/&nbsp;</td><td><?php echo $types; ?></td></tr></table>    </td>
	                </tr>
	                <tr>
	                <td colspan="2" align="center" class="smallText">&nbsp;<?php echo go_picture_submit('button_insert.gif', PICTURE_INSERT); ?>&nbsp;</td>
	<?php
	      echo '</form>';
	?>
	              </tr>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	<?php
	    }
	  }
	?>
	            </table></td>
	<!-- options eof //-->
	            <td valign="top">&nbsp;&nbsp;&nbsp;</td> 
	            <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
	<!-- value //-->
	<?php
	  if ($action == 'delete_option_conf_value') { 
	    $values_conf = go_db_query("select items_options_conf_values_id, items_options_conf_values_name,items_options_conf_values_desc from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where items_options_conf_values_id = '" . (int)$_GET['value_conf_id'] . "' and language_id = '" . (int)$languages_id . "'");
	    $values_conf_values = go_db_fetch_array($values_conf);
	?>
	              <tr>
	                <td colspan="3" class="pageGeneralsign">&nbsp;<?php echo $values_conf_values['items_options_conf_values_name']; ?>&nbsp;</td>
	                <td>&nbsp;<?php echo go_picture(FOLDER_RELATIV_PICTURES . 'tranparentes.gif', '', '1', '53'); ?>&nbsp;</td>
	              </tr>
	              <tr>
	                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	                  <tr>
	                    <td colspan="3"><?php echo go_black_line(); ?></td>
	                  </tr>
	<?php
	    $items = go_db_query("select p.items_id, pd.items_name, po.items_options_conf_name from " . DB_TBL_ITEMS . " p, " . DB_TBL_ITEMS_CHARACTERISTICS_CONF . " pa, " . DB_TBL_ITEMS_OPTIONS_CONF . " po, " . DB_TBL_ITEMS_DESCRIPTION . " pd where pd.items_id = p.items_id and pd.language_id = '" . (int)$languages_id . "' and po.language_id = '" . (int)$languages_id . "' and pa.items_id = p.items_id and pa.options_conf_values_id='" . (int)$_GET['value_conf_id'] . "' and po.items_options_conf_id = pa.options_conf_id order by pd.items_name");
	    if (go_db_num_rows($items)) {
	?>
	                  <tr class="tbUPCountData">
	                    <td class="tbUPDataInside" align="center">&nbsp;<?php echo DB_TBL_ABOVE_ID; ?>&nbsp;</td>
	                    <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_ITEM; ?>&nbsp;</td>
	                    <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_OPT_NAME; ?>&nbsp;</td>
	                  </tr>
	                  <tr>
	                    <td colspan="3"><?php echo go_black_line(); ?></td>
	                  </tr>
	<?php
	      while ($items_values_conf = go_db_fetch_array($items)) {
	        $rows++;
	?>
	                  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	                    <td align="center" class="smallText">&nbsp;<?php echo $items_values_conf['items_id']; ?>&nbsp;</td>
	                    <td class="smallText">&nbsp;<?php echo $items_values_conf['items_name']; ?>&nbsp;</td>
	                    <td class="smallText">&nbsp;<?php echo $items_values_conf['items_options_conf_name']; ?>&nbsp;, <?php echo $items_values_conf['items_options_conf_desc']; ?></td>
										
	                  </tr>
	<?php
	      }
	?>
	                  <tr>
	                    <td colspan="3"><?php echo go_black_line(); ?></td>
	                  </tr>
	                  <tr>
	                    <td class="main" colspan="3"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>
	                  </tr>
	                  <tr>
	                    <td class="main" align="right" colspan="3"><br><?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, (isset($_GET['value_conf_page']) ? 'value_conf_page=' . $_GET['value_conf_page'] . '&' : '') . (isset($_GET['characteristic_conf_page']) ? 'characteristic_conf_page=' . $characteristic_conf_page : ''), 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
	                  </tr>
	<?php
	    } else {
	?>
	                  <tr>
	                    <td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>
	                  </tr>
	                  <tr>
	                    <td class="main" align="right" colspan="3"><br><?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=delete_value_conf&value_conf_id=' . $_GET['value_conf_id'], 'NONSSL') . '">'; ?><?php echo go_picture_button('button_delete.gif', ' delete '); ?></a>&nbsp;&nbsp;&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, '&option_conf_page=' . $option_conf_page . (isset($_GET['value_conf_page']) ? '&value_conf_page=' . $value_conf_page : '') . (isset($_GET['characteristic_conf_page']) ? '&characteristic_conf_page=' . $characteristic_conf_page : ''), 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
	                  </tr>
	<?php
	    }
	?>
	              	</table></td>
	              </tr>
	<?php
	  } else {
	?>
	              <tr>
	                <td colspan="1" class="pageGeneralsign"  height="80px">&nbsp;<?php echo ABOVE_TITLE_VAL; ?>&nbsp;</td>
	                <td>&nbsp;<?php echo go_picture(FOLDER_RELATIV_PICTURES . 'tranparentes.gif', '', '1', '53'); ?>&nbsp;</td>
	              </tr>
	              <tr>
	                <td colspan="2" class="smallText">
	<?php
	    $per_page = MAX_ROW_LISTS_OPTIONS;
	    $values_conf = "select pov.items_options_conf_values_id, pov.items_options_conf_values_name,pov.items_options_conf_values_desc, pov2po.items_options_conf_id from ((" . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " pov) left join " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES_TO_ITEMS_OPTIONS_CONF . " pov2po on pov.items_options_conf_values_id = pov2po.items_options_conf_values_id) where pov.language_id = '" . (int)$languages_id . "' order by pov.items_options_conf_values_id";
	    if (!isset($value_conf_page)) {
	      $value_conf_page = 1;
	    }
	    $prev_value_conf_page = $value_conf_page - 1;
	    $next_value_conf_page = $value_conf_page + 1;
	    $value_conf_query = go_db_query($values_conf);
	    $value_conf_page_start = ($per_page * $value_conf_page) - $per_page;
	    $num_rows = go_db_num_rows($value_conf_query);
	    if ($num_rows <= $per_page) {
	      $num_pages = 1;
	    } else if (($num_rows % $per_page) == 0) {
	      $num_pages = ($num_rows / $per_page);
	    } else {
	      $num_pages = ($num_rows / $per_page) + 1;
	    }
	    $num_pages = (int) $num_pages;
	    $values_conf = $values_conf . " LIMIT $value_conf_page_start, $per_page"; 
	    if ($prev_value_conf_page)  {
	      echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'option_conf_order_by=' . $option_conf_order_by . '&value_conf_page=' . $prev_value_conf_page) . '"> &lt;&lt; </a> | ';
	    }
	    for ($i = 1; $i <= $num_pages; $i++) {
	      if ($i != $value_conf_page) {
	         echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, (isset($option_conf_order_by) ? 'option_conf_order_by=' . $option_conf_order_by . '&' : '') . 'value_conf_page=' . $i) . '">' . $i . '</a> | ';
	      } else {
	         echo '<b><font color=red>' . $i . '</font></b> | ';
	      }
	    } 
	    if ($value_conf_page != $num_pages) {
	      echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, (isset($option_conf_order_by) ? 'option_conf_order_by=' . $option_conf_order_by . '&' : '') . 'value_conf_page=' . $next_value_conf_page) . '"> &gt;&gt;</a> ';
	    }
	?>
	                </td>
	              </tr>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	              <tr class="tbUPCountData">
	                <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_ID; ?>&nbsp;</td>
	                <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_OPT_NAME; ?>&nbsp;<br>&nbsp;<?php echo DB_TBL_ABOVE_OPT_VALUE; ?>&nbsp;<?php echo TEXT_DESCRIPTION ?></td>
	              </tr>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	<?php
	    $next_id = 1;
	    $rows = 0;
	    $values_conf = go_db_query($values_conf);
	    while ($values_conf_values = go_db_fetch_array($values_conf)) {
		    $options_conf_name = go_options_conf_name($values_conf_values['items_options_conf_id']);
	      $values_conf_name = $values_conf_values['items_options_conf_values_name'];
				$values_conf_desc = $values_conf_values['items_options_conf_values_desc'];
	      $rows++;
	?>
	              <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	<?php
	      if (($action == 'update_option_conf_value') && ($_GET['value_conf_id'] == $values_conf_values['items_options_conf_values_id'])) {
	        echo '<form name="values_conf" action="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=update_value_conf', 'NONSSL') . '" method="post">';
	        $inputs = '<table border="0" cellpadding="0" cellspacing="0">';
	        for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	          $value_conf_name = go_db_query("select items_options_conf_values_name,items_options_conf_values_desc from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where items_options_conf_values_id = '" . (int)$values_conf_values['items_options_conf_values_id'] . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	          $value_conf_name = go_db_fetch_array($value_conf_name);
	          $inputs .= '<tr><td class="smallText">' . $languages[$i]['code'] . '</td><td>:&nbsp;<input type="text" name="value_conf_name[' . $languages[$i]['id'] . ']" size="15" value="' . $value_conf_name['items_options_conf_values_name'] . '">&nbsp;<textarea name="value_conf_desc[' . $languages[$i]['id'] . ']">'.$value_conf_name['items_options_conf_values_desc'].'</textarea></td></tr>';
	        }
	      $inputs .= '</table>';
	
	
	?>
	                <td align="center" class="smallText">&nbsp;<?php echo $values_conf_values['items_options_conf_values_id']; ?><input type="hidden" name="value_conf_id" value="<?php echo $values_conf_values['items_options_conf_values_id']; ?>">&nbsp;</td>
	                <td align="center" class="smallText">&nbsp;<?php echo "\n"; ?><select name="option_conf_id">
	<?php
	        $options_conf = go_db_query("select items_options_conf_id, items_options_conf_name from " . DB_TBL_ITEMS_OPTIONS_CONF . " where language_id = '" . (int)$languages_id . "' order by items_options_conf_name");
	        while ($options_conf_values = go_db_fetch_array($options_conf)) {
	          echo "\n" . '<option name="' . $options_conf_values['items_options_conf_name'] . '" value="' . $options_conf_values['items_options_conf_id'] . '"';
	          if ($values_conf_values['items_options_conf_id'] == $options_conf_values['items_options_conf_id']) { 
	            echo ' selected';
	          }
	          echo '>' . $options_conf_values['items_options_conf_name'] . '</option>';
	        } 
	?>
	                </select>&nbsp;</td>
	                <tr>
	                <tr>
	                <td colspan="2" class="smallText"><?php echo $inputs; ?></td>
	                <tr>
	                <tr>
	                <td colspan="2" align="center" class="smallText">&nbsp;<?php echo go_picture_submit('button_update.gif', PICTURE_UPDATE); ?>&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, '', 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', PICTURE_CANCEL); ?></a>&nbsp;</td>
	<?php
	        echo '</form>';
	      } else {
	?>
	                <td align="center" class="smallText">&nbsp;<?php echo $values_conf_values["items_options_conf_values_id"]; ?>&nbsp;</td>
	                <td align="center" class="smallText">&nbsp;<?php echo $options_conf_name; ?>&nbsp;</td>
	                <tr>
	                <tr>
	                <td colspan="2" class="smallText">&nbsp;<?php echo $values_conf_name; ?>&nbsp;,<?php echo $values_conf_desc; ?></td>
	                <tr>
	                <tr>
	                <td colspan="2" align="center" class="smallText">&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=update_option_conf_value&value_conf_id=' . $values_conf_values['items_options_conf_values_id'] . (isset($_GET['value_conf_page']) ? '&value_conf_page=' . $_GET['value_conf_page'] : ''), 'NONSSL') . '">'; ?><?php echo go_picture_button('button_change.gif', PICTURE_UPDATE); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=delete_option_conf_value&value_conf_id=' . $values_conf_values['items_options_conf_values_id'], 'NONSSL') , '">'; ?><?php echo go_picture_button('button_delete.gif', PICTURE_DELETE); ?></a>&nbsp;</td>
	<?php
	      }
	      $max_values_conf_id_query = go_db_query("select max(items_options_conf_values_id) + 1 as next_id from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES);
	      $max_values_conf_id_values = go_db_fetch_array($max_values_conf_id_query);
	      $next_id = $max_values_conf_id_values['next_id'];
	    }
	?>
	              </tr>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	<?php
	    if ($action != 'update_option_conf_value') {
	?>
	              <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	<?php
	      echo '<form name="values" action="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=add_item_option_conf_values&value_conf_page=' . $value_conf_page, 'NONSSL') . '" method="post">';
	?>
	                <td align="center" class="smallText">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
	                <td align="center" class="smallText">&nbsp;<select name="option_conf_id">
	<?php
	      $options_conf = go_db_query("select items_options_conf_id, items_options_conf_name from " . DB_TBL_ITEMS_OPTIONS_CONF . " where language_id = '" . $languages_id . "' order by items_options_conf_name");
	      while ($options_conf_values = go_db_fetch_array($options_conf)) {
	        echo '<option name="' . $options_conf_values['items_options_conf_name'] . '" value="' . $options_conf_values['items_options_conf_id'] . '">' . $options_conf_values['items_options_conf_name'] . '</option>';
	      }
	      $inputs = '<table border="0" cellpadding="0" cellspacing="0">';
	      for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	        $inputs .= '<tr><td class="smallText">' . $languages[$i]['code'] . '</td><td>:&nbsp;<input type="text" name="value_conf_name[' . $languages[$i]['id'] . ']" size="15">&nbsp;<textarea name="value_conf_desc[' . $languages[$i]['id'] . ']"></textarea></td></tr>';
	      }
	      $inputs .= '</table>';
	?>
	                </select>&nbsp;</td>
	                <tr>
	                <tr>
	                <td colspan="2" class="smallText"><input type="hidden" name="value_conf_id" value="<?php echo $next_id; ?>"><?php echo $inputs; ?></td>
	                <tr>
	                <tr>
	                <td colspan="2" align="center" class="smallText">&nbsp;<?php echo go_picture_submit('button_insert.gif', PICTURE_INSERT); ?>&nbsp;</td>
	<?php
	      echo '</form>';
	?>
	              </tr>
	              <tr>
	                <td colspan="2"><?php echo go_black_line(); ?></td>
	              </tr>
	<?php
	    }
	  }
	?>
	            </table></td>
	          </tr>
	        </table></td>
	<!-- option value eof //-->
	      </tr> 
	<!-- items_characteristics //-->  
	      <tr>
	        <td><table border="0" cellspacing="0" cellpadding="0">
	          <tr>
	            <td class="pageGeneralsign">&nbsp;<?php echo ABOVE_TITLE_ATRIB; ?>&nbsp;</td>
	            <td>&nbsp;<?php echo go_picture(FOLDER_RELATIV_PICTURES . 'tranparentes.gif', '', '1', '53'); ?>&nbsp;</td>
	          </tr>
	        </table></td>
	      </tr>
	      <tr>
	<?php
	  if ($action == 'update_characteristic_conf') {
	    $form_action = 'update_item_characteristic_conf';
	  } else {
	    $form_action = 'add_item_characteristics_conf';
	  }
	  if (!isset($characteristic_conf_page)) {
	    $characteristic_conf_page = 1;
	  }
	  $prev_characteristic_conf_page = $characteristic_conf_page - 1;
	  $next_characteristic_conf_page = $characteristic_conf_page + 1;
	?>
	        <td><form name="characteristics_conf" action="<?php echo go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=' . $form_action . '&option_conf_page=' . $option_conf_page . '&value_conf_page=' . $value_conf_page . '&characteristic_conf_page=' . $characteristic_conf_page); ?>" method="post">
	        <table border="0" cellspacing="0" cellpadding="2">
	          <tr>
	            <td colspan="5" class="smallText">
	<?php
	  $per_page = MAX_ROW_LISTS_OPTIONS;
	  $characteristics_conf = "select pa.* from ((" . DB_TBL_ITEMS_CHARACTERISTICS_CONF . " pa) left join " . DB_TBL_ITEMS_DESCRIPTION . " pd on pa.items_id = pd.items_id and pd.language_id = '" . (int)$languages_id . "')";
	  $characteristic_conf_query = go_db_query($characteristics_conf);
	  $characteristic_conf_page_start = ($per_page * $characteristic_conf_page) - $per_page;
	  $num_rows = go_db_num_rows($characteristic_conf_query);
	  if ($num_rows <= $per_page) {
	     $num_pages = 1;
	  } else if (($num_rows % $per_page) == 0) {
	     $num_pages = ($num_rows / $per_page);
	  } else {
	     $num_pages = ($num_rows / $per_page) + 1;
	  }
	  $num_pages = (int) $num_pages;
	  $characteristics_conf = $characteristics_conf . " LIMIT $characteristic_conf_page_start, $per_page"; 
	  if ($prev_characteristic_conf_page) {
	    echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'characteristic_conf_page=' . $prev_characteristic_conf_page) . '"> &lt;&lt; </a> | ';
	  }
	  for ($i = 1; $i <= $num_pages; $i++) {
	    if ($i != $characteristic_conf_page) {
	      echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'characteristic_conf_page=' . $i) . '">' . $i . '</a> | ';
	    } else {
	      echo '<b><font color="red">' . $i . '</font></b> | ';
	    }
	  } 
	  if ($characteristic_conf_page != $num_pages) {
	    echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'characteristic_conf_page=' . $next_characteristic_conf_page) . '"> &gt;&gt; </a>';
	  }
	?>
	            </td>
	          </tr>
	          <tr>
	            <td colspan="5"><?php echo go_black_line(); ?></td>
	          </tr>
	          <tr class="tbUPCountData">
	            <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_ID; ?>&nbsp;</td>
	            <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_ITEM; ?>&nbsp;</td>
		    <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_OPT_NAME_PARENT; ?>&nbsp;<br>&nbsp;<?php echo DB_TBL_ABOVE_OPT_VALUE_PARENT; ?>&nbsp;</td>
	
	            <td class="tbUPDataInside">&nbsp;<?php echo DB_TBL_ABOVE_OPT_NAME; ?>&nbsp;<br>&nbsp;<?php echo DB_TBL_ABOVE_OPT_VALUE; ?>&nbsp;</td>
	
	            <td class="tbUPDataInside" align="right">&nbsp;<?php echo DB_TBL_ABOVE_OPT_PRICE; ?>&nbsp;<br>&nbsp;<?php echo DB_TBL_ABOVE_OPT_PRICE_PREFIX; ?>&nbsp;</td>
	
	
	          </tr>
	          <tr>
	            <td colspan="5"><?php echo go_black_line(); ?></td>
	          </tr>
	<?php
	  $next_id = 1;
	  $characteristics_conf = go_db_query($characteristics_conf);
	  while ($characteristics_conf_values = go_db_fetch_array($characteristics_conf)) {
	    $items_name_only = go_get_values_from_items_description($characteristics_conf_values['items_id'], $languages_id, 'items_name');
	    $options_conf_name = go_options_conf_name($characteristics_conf_values['options_conf_id']);
			$options_conf_name_parent = go_options_conf_name($characteristics_conf_values['options_conf_parent_id']);
	    $values_conf_name = go_values_conf_name($characteristics_conf_values['options_conf_values_id']);
			$values_conf_name_parent = go_values_conf_name($characteristics_conf_values['options_conf_values_parent_id']);
	    $rows++;
	?>
	          <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	<?php
	    if (($action == 'update_characteristic_conf') && ($_GET['characteristic_conf_id'] == $characteristics_conf_values['items_characteristics_conf_id'])) {
	?>
	            <td class="smallText">&nbsp;<?php echo $characteristics_conf_values['items_characteristics_conf_id']; ?><input type="hidden" name="characteristic_conf_id" value="<?php echo $characteristics_conf_values['items_characteristics_conf_id']; ?>">&nbsp;</td>
	            <td class="smallText">&nbsp;<select name="items_id">
	<?php
	      $items = go_db_query("select p.items_id, pd.items_name from " . DB_TBL_ITEMS . " p, " . DB_TBL_ITEMS_DESCRIPTION . " pd where pd.items_id = p.items_id and pd.language_id = '" . $languages_id . "' order by pd.items_name");
	      while($items_values_conf = go_db_fetch_array($items)) {
	        if ($characteristics_conf_values['items_id'] == $items_values_conf['items_id']) {
	          echo "\n" . '<option name="' . $items_values_conf['items_name'] . '" value="' . $items_values_conf['items_id'] . '" SELECTED>' . $items_values_conf['items_name'] . '</option>';
	        } else {
	          echo "\n" . '<option name="' . $items_values_conf['items_name'] . '" value="' . $items_values_conf['items_id'] . '">' . $items_values_conf['items_name'] . '</option>';
	        }
	      } 
	?>
	            </select>&nbsp;</td>
							
							
	<!--////////////////////////////////////////////////////////////////////////////////-->				
	            <td class="smallText">&nbsp;<select name="options_conf_parent_id"><option value="0">------------</option>
	<?php
	      $options_conf_parent = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF . " where language_id = '" . $languages_id . "' order by items_options_conf_name"); 
			  while($options_conf_values_parent = go_db_fetch_array($options_conf_parent)) {
	        if ($characteristics_conf_values['options_conf_parent_id'] == $options_conf_values_parent['items_options_conf_id']) {
	          echo "\n" . '<option name="' . $options_conf_values_parent['items_options_conf_name'] . '" value="' . $options_conf_values_parent['items_options_conf_id'] . '" SELECTED>' . $options_conf_values_parent['items_options_conf_name'] . '</option>';
	        } else {
	          echo "\n" . '<option name="' . $options_conf_values_parent['items_options_conf_name'] . '" value="' . $options_conf_values_parent['items_options_conf_id'] . '">' . $options_conf_values_parent['items_options_conf_name'] . '</option>';
	        }
	      } 
	?>
	            </select>&nbsp;<br>
	            &nbsp;<select name="values_conf_parent_id"><option value="0">------------</option>
	<?php
	      $values_conf_parent = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where language_id ='" . $languages_id . "' order by items_options_conf_values_name");
	      while($values_conf_values_parent = go_db_fetch_array($values_conf_parent)) {
	        if ($characteristics_conf_values['options_conf_values_parent_id'] == $values_conf_values_parent['items_options_conf_values_id']) {
	          echo "\n" . '<option name="' . $values_conf_values_parent['items_options_conf_values_name'] . '" value="' . $values_conf_values_parent['items_options_conf_values_id'] . '" SELECTED>' . $values_conf_values_parent['items_options_conf_values_name'] . '</option>';
	        } else {
	          echo "\n" . '<option name="' . $values_conf_values_parent['items_options_conf_values_name'] . '" value="' . $values_conf_values_parent['items_options_conf_values_id'] . '">' . $values_conf_values_parent['items_options_conf_values_name'] . '</option>';
	        }
	      } 
	?>        
	            </select>&nbsp;</td>
	<!--////////////////////////////////////////////////////////////////////////////////-->			
	            <td class="smallText">&nbsp;<select name="options_conf_id">
	<?php
	      $options_conf = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF . " where language_id = '" . $languages_id . "' order by items_options_conf_name");
	      while($options_conf_values = go_db_fetch_array($options_conf)) {
	        if ($characteristics_conf_values['options_conf_id'] == $options_conf_values['items_options_conf_id']) {
	          echo "\n" . '<option name="' . $options_conf_values['items_options_conf_name'] . '" value="' . $options_conf_values['items_options_conf_id'] . '" SELECTED>' . $options_conf_values['items_options_conf_name'] . '</option>';
	        } else {
	          echo "\n" . '<option name="' . $options_conf_values['items_options_conf_name'] . '" value="' . $options_conf_values['items_options_conf_id'] . '">' . $options_conf_values['items_options_conf_name'] . '</option>';
	        }
	      } 
	?>
	            </select>&nbsp;<br>
	            &nbsp;<select name="values_conf_id">
	<?php
	      $values_conf = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where language_id ='" . $languages_id . "' order by items_options_conf_values_name");
	      while($values_conf_values = go_db_fetch_array($values_conf)) {
	        if ($characteristics_conf_values['options_conf_values_id'] == $values_conf_values['items_options_conf_values_id']) {
	          echo "\n" . '<option name="' . $values_conf_values['items_options_conf_values_name'] . '" value="' . $values_conf_values['items_options_conf_values_id'] . '" SELECTED>' . $values_conf_values['items_options_conf_values_name'] . '</option>';
	        } else {
	          echo "\n" . '<option name="' . $values_conf_values['items_options_conf_values_name'] . '" value="' . $values_conf_values['items_options_conf_values_id'] . '">' . $values_conf_values['items_options_conf_values_name'] . '</option>';
	        }
	      } 
	?>        
	            </select>&nbsp;</td>
							
							
							
							
	            <td align="right" class="smallText">&nbsp;<input type="text" name="value_conf_price" value="<?php echo $characteristics_conf_values['options_conf_values_price']; ?>" size="6">&nbsp;<br>
	            &nbsp;<input type="text" name="price_prefix" value="<?php echo $characteristics_conf_values['price_prefix']; ?>" size="2">&nbsp;</td>
	                <tr>
	                <tr>
	                <td colspan="5" align="center" class="smallText">&nbsp;<?php echo go_picture_submit('button_update.gif', PICTURE_UPDATE); ?>&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, '&characteristic_conf_page=' . $characteristic_conf_page, 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', PICTURE_CANCEL); ?></a>&nbsp;</td>
	<?php
	    } elseif (($action == 'delete_item_characteristic_conf') && ($_GET['characteristic_conf_id'] == $characteristics_conf_values['items_characteristics_conf_id'])) {
	?>
	            <td class="smallText">&nbsp;<b><?php echo $characteristics_conf_values["items_characteristics_conf_id"]; ?></b>&nbsp;</td>
	            <td class="smallText">&nbsp;<b><?php echo $items_name_only; ?></b>&nbsp;</td>
		    <td class="smallText">&nbsp;<?php echo $options_conf_name_parent; ?>&nbsp;<br>
		    &nbsp;<?php echo $values_conf_name_parent; ?>&nbsp;</td>
	            <td class="smallText">&nbsp;<b><?php echo $options_conf_name; ?></b>&nbsp;<br>
	            &nbsp;<b><?php echo $values_conf_name; ?></b>&nbsp;</td>
	            <td align="right" class="smallText">&nbsp;<b><?php echo $characteristics_conf_values["options_conf_values_price"]; ?></b>&nbsp;<br>
	            &nbsp;<b><?php echo $characteristics_conf_values["price_prefix"]; ?></b>&nbsp;</td>
	                <tr>
	                <tr>
	                <td colspan="5" align="center" class="smallText">&nbsp;<b><?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=delete_characteristic_conf&characteristic_conf_id=' . $_GET['characteristic_conf_id']) . '">'; ?><?php echo go_picture_button('button_confirm.gif', PICTURE_CONFIRM); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, '&option_conf_page=' . $option_conf_page . '&value_conf_page=' . $value_conf_page . '&characteristic_conf_page=' . $characteristic_conf_page, 'NONSSL') . '">'; ?><?php echo go_picture_button('button_cancel.gif', PICTURE_CANCEL); ?></a>&nbsp;</b></td>
	<?php
	    } else {
	?>
	            <td class="smallText">&nbsp;<?php echo $characteristics_conf_values["items_characteristics_conf_id"]; ?>&nbsp;</td>
	            <td class="smallText">&nbsp;<?php echo $items_name_only; ?>&nbsp;</td>
		    <td class="smallText">&nbsp;<?php echo $options_conf_name_parent; ?>&nbsp;<br>
		    &nbsp;<?php echo $values_conf_name_parent; ?>&nbsp;</td>
	            <td class="smallText">&nbsp;<?php echo $options_conf_name; ?>&nbsp;<br>
	            &nbsp;<?php echo $values_conf_name; ?>&nbsp;</td>
	            <td align="right" class="smallText">&nbsp;<?php echo $characteristics_conf_values["options_conf_values_price"]; ?>&nbsp;<br>
	            &nbsp;<?php echo $characteristics_conf_values["price_prefix"]; ?>&nbsp;</td>
	                <tr>
	                <tr>
	                <td colspan="5" align="center" class="smallText">&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=update_characteristic_conf&characteristic_conf_id=' . $characteristics_conf_values['items_characteristics_conf_id'] . '&characteristic_conf_page=' . $characteristic_conf_page, 'NONSSL') . '">'; ?><?php echo go_picture_button('button_change.gif', PICTURE_UPDATE); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . go_href_link(NAME_OF_FILE_ITEMS_CHARACTERISTICS_CONF, 'action=delete_item_characteristic_conf&characteristic_conf_id=' . $characteristics_conf_values['items_characteristics_conf_id'] . '&characteristic_conf_page=' . $characteristic_conf_page, 'NONSSL') , '">'; ?><?php echo go_picture_button('button_delete.gif', PICTURE_DELETE); ?></a>&nbsp;</td>
	<?php
	    }
	    $max_characteristics_conf_id_query = go_db_query("select max(items_characteristics_conf_id) + 1 as next_id from " . DB_TBL_ITEMS_CHARACTERISTICS_CONF);
	    $max_characteristics_conf_id_values = go_db_fetch_array($max_characteristics_conf_id_query);
	    $next_id = $max_characteristics_conf_id_values['next_id'];
	?>
	          </tr>
	<?php
	  }
	  if ($action != 'update_characteristic_conf') {
	?>
	          <tr>
	            <td colspan="5"><?php echo go_black_line(); ?></td>
	          </tr>
	          <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'characteristics-even' : 'characteristics-odd'); ?>">
	            <td class="smallText">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
	      	    <td class="smallText">&nbsp;<select name="items_id">
	<?php
	    $items = go_db_query("select p.items_id, pd.items_name from " . DB_TBL_ITEMS . " p, " . DB_TBL_ITEMS_DESCRIPTION . " pd where pd.items_id = p.items_id and pd.language_id = '" . $languages_id . "' order by pd.items_name");
	    while ($items_values_conf = go_db_fetch_array($items)) {
	      echo '<option name="' . $items_values_conf['items_name'] . '" value="' . $items_values_conf['items_id'] . '">' . $items_values_conf['items_name'] . '</option>';
	    } 
	?>
	            </select>&nbsp;</td>
	<!------------------------------------------------------------------------------>
	  		<td class="smallText">&nbsp;<select name="options_conf_parent_id"><option value="0">------------</option>
	<?php
	    $options_conf_parent = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF . " where language_id = '" . $languages_id . "' order by items_options_conf_name");
	    while ($options_conf_values_parent = go_db_fetch_array($options_conf_parent)) {
	      echo '<option name="' . $options_conf_values_parent['items_options_con_name'] . '" value="' . $options_conf_values_parent['items_options_conf_id'] . '">' . $options_conf_values_parent['items_options_conf_name'] . '</option>';
	    } 
	?>
	            </select>&nbsp;<br>
	            &nbsp;<select name="values_conf_parent_id"><option value="0">------------</option>
	<?php
	    $values_conf_parent = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where language_id = '" . $languages_id . "' order by items_options_conf_values_name");
	    while ($values_conf_values_parent = go_db_fetch_array($values_conf_parent)) {
	      echo '<option name="' . $values_conf_values_parent['items_options_conf_values_name'] . '" value="' . $values_conf_values_parent['items_options_conf_values_id'] . '">' . $values_conf_values_parent['items_options_conf_values_name'] . '</option>';
	    } 
	?>
	            </select>&nbsp;</td>
	<!------------------------------------------------------------------------------>						
	            <td class="smallText">&nbsp;<select name="options_conf_id">
	<?php
	    $options_conf = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF . " where language_id = '" . $languages_id . "' order by items_options_conf_name");
	    while ($options_conf_values = go_db_fetch_array($options_conf)) {
	      echo '<option name="' . $options_conf_values['items_options_con_name'] . '" value="' . $options_conf_values['items_options_conf_id'] . '">' . $options_conf_values['items_options_conf_name'] . '</option>';
	    } 
	?>
	            </select>&nbsp;
	            <br>&nbsp;<select name="values_conf_id">
	<?php
	    $values_conf = go_db_query("select * from " . DB_TBL_ITEMS_OPTIONS_CONF_VALUES . " where language_id = '" . $languages_id . "' order by items_options_conf_values_name");
	    while ($values_conf_values = go_db_fetch_array($values_conf)) {
	      echo '<option name="' . $values_conf_values['items_options_conf_values_name'] . '" value="' . $values_conf_values['items_options_conf_values_id'] . '">' . $values_conf_values['items_options_conf_values_name'] . '</option>';
	    } 
	?>
	            </select>&nbsp;</td>
	            <td align="right" class="smallText">&nbsp;<input type="text" name="value_conf_price" size="6">&nbsp;<br>
	            &nbsp;<input type="text" name="price_prefix" size="2" value="+">&nbsp;</td>
	                <tr>
	                <tr>
	                <td colspan="5" align="center" class="smallText">&nbsp;<?php echo go_picture_submit('button_insert.gif', PICTURE_INSERT); ?>&nbsp;</td>
	          </tr>
	<?php
	 
	?>
	<?php
	  }
	?>
	          <tr>
	            <td colspan="5"><?php echo go_black_line(); ?></td>
	          </tr>
	        </table></form></td>
	      </tr>
	    </table></td>
	<!-- items_characteristics_eof //-->
	  </tr>
	</table>
	<!-- body_text_eof //-->
	<!-- footer //-->
	<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?>
	<!-- footer_eof //-->
	</body>
	</html>
	<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); 
}
?>
