<?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 gro�e 
  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
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php 
$javascript = "
<script>
function check_empty(text) {
	return (text.length > 0); 
}
</script>
";
$formbeginn = '<form name="cart_quantity" action="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_39], go_get_all_get_parameter(array('action')) . 'action=add_item') . '"<-ONSUBMIT-> method="post">';
$text_query = go_db_query("SELECT * FROM item_template where aktiviert = '1' AND template_id = '1'");
$werte = go_db_fetch_array($text_query);
$template_inhalt = $werte["template_inhalt"];
$template_inhalt = $javascript.$template_inhalt;
$uvp_anzeigen = $werte["uvp_anzeigen"];
$items_name2_anzeigen = $werte["items_name2_anzeigen"];
$text_uvp = $werte["text_uvp"];
$text_price = $werte["text_price"];
$anzahl_select = $werte["anzahl_select"];

?>

<?php
$date_availability = 'AND (to_days(items_date_available_end) IS NULL OR (to_days(items_date_available_end) IS NOT NULL AND to_days(now()) <= to_days(items_date_available_end)))';
if ($item_check['total'] < 1) {
	$formbeginn = preg_replace('/<-ONSUBMIT->/', '', $formbeginn);
	?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php new infoBox(array(array('text' => TEXT_ITEM_NOT_FOUND))); ?></td>
      </tr>
      <tr>
        <td><?php echo go_fetch_dividing_up('tranparentes.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoFrameInsides">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo go_fetch_dividing_up('tranparentes.gif', '10', '1'); ?></td>
                <td align="right"><?php echo '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_29]) . '">' . go_picture_button('button_continue.gif', PICTURE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo go_fetch_dividing_up('tranparentes.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table>
    <?php
} else {
	$formbeginn = preg_replace('/<-ONSUBMIT->/', '', $formbeginn);
	$item_info_query = go_db_query("select p.items_id, p.herstellernummer, p.items_ship_price, p.items_ship_price_two, pd.items_name, pd.items_name2, pd.bezeichnung1, pd.inhalt1, pd.bezeichnung2, pd.inhalt2, pd.bezeichnung3, pd.inhalt3, pd.bezeichnung4, pd.inhalt4, pd.bezeichnung5, pd.inhalt5, pd.bezeichnung6, pd.inhalt6, pd.items_description, p.items_model, p.items_quantity, p.items_picture, p.items_bpicture, pd.items_url, p.items_price,items_price_option, p.items_price_uvp, p.items_tax_class_id, p.items_date_added, p.items_date_available, p.items_date_available_end, p.producers_id from " . DB_TBL_ITEMS . " p, " . DB_TBL_ITEMS_DESCRIPTION . " pd where p.items_status = '1' and p.items_id = '" . (int)$_GET['items_id'] . "' and pd.items_id = p.items_id and pd.language_id = '" . (int)$languages_id . "' $date_availability ");
	$item_info = go_db_fetch_array($item_info_query);

	go_db_query("update " . DB_TBL_ITEMS_DESCRIPTION . " set items_viewed = items_viewed+1 where items_id = '" . (int)$_GET['items_id'] . "' and language_id = '" . (int)$languages_id . "'");
	if ($new_price = go_get_items_special_price($item_info['items_id'])) { 
		global $attendee_id;
		$attendee_group_query = go_db_query("select attendees_group_id from " . DB_TBL_ATTENDEES . " where attendees_id =  '" . $attendee_id . "'");
		$attendee_group = go_db_fetch_array($attendee_group_query);
		$sattendee_group_price_query = go_db_query("select attendees_group_price from " . DB_TBL_ITEMS_GROUPS . " where items_id = '" . (int)$_GET['items_id']. "' and attendees_group_id =  '" . $attendee_group['attendees_group_id'] . "'");
		if ($sattendee_group_price = go_db_fetch_array($sattendee_group_price_query))
			$item_info['items_price']= $sattendee_group_price['attendees_group_price'];
		$items_price = '<s>' . $currencies->display_price($item_info['items_price'], go_get_tax_rate($item_info['items_tax_class_id'])) .$items_price_option_text. '<input type="hidden" name="immeter" value="'.$getImMeter.'"><input type="hidden" name="inmeter_breite" value="'.$getInMeter_breite.'"></s> <span class="itemSpecialPrice">' . $currencies->display_price($new_price, go_get_tax_rate($item_info['items_tax_class_id'])) . '</span>';
	} else {
		if ($item_info['items_price']=="123456.7890"){
			$preistext = QUERYTEXT1 . $item_info['items_name'] . QUERYTEXT2 . $item_info['items_model'] . QUERYTEXT3 ;
			$preistext = urlencode($preistext);
			$items_price = PRICE_ON_DEMAND_TEXT1 . "<a href=\"" . $GLOBALS[CONFIG_NAME_FILE][main_bigware_8] . "?enquiry=$preistext\">".PRICE_ON_DEMAND_TEXT2."</a>";
			$auf_anfrage = 1;
		}
		else{ 
			global $attendee_id;
			$attendee_group_query = go_db_query("select attendees_group_id from " . DB_TBL_ATTENDEES . " where attendees_id =  '" . $attendee_id . "'");
			$attendee_group = go_db_fetch_array($attendee_group_query);
			$attendee_group_price_query = go_db_query("select attendees_group_price from " . DB_TBL_ITEMS_GROUPS . " where items_id = '" . (int)$_GET['items_id'] . "' and attendees_group_id =  '" . $attendee_group['attendees_group_id'] . "'");
			if ( $attendee_group['attendees_group_id'] != 0) {
				if ($attendee_group_price = go_db_fetch_array($attendee_group_price_query)) {
					$items_price = "";
					$items_price = $currencies->display_price($attendee_group_price['attendees_group_price'], go_get_tax_rate($item_info['items_tax_class_id'])).$items_price_option_text.'<input type="hidden" name="immeter" value="'.$getImMeter.'"><input type="hidden" name="inmeter_breite" value="'.$getInMeter_breite.'">';
				} else {
					$items_price = $currencies->display_price($item_info['items_price'], go_get_tax_rate($item_info['items_tax_class_id'])).$items_price_option_text.'<input type="hidden" name="immeter" value="'.$getImMeter.'"><input type="hidden" name="inmeter_breite" value="'.$getInMeter_breite.'">';
				}
			} else {

				$items_price = $currencies->display_price($item_info['items_price'], go_get_tax_rate($item_info['items_tax_class_id'])).$items_price_option_text.'<input type="hidden" name="immeter" value="'.$getImMeter.'"><input type="hidden" name="inmeter_breite" value="'.$getInMeter_breite.'">'; 
			}	
		}
	}

	$items_price_konfigurator = go_add_tax($item_info['items_price'],go_get_tax_rate($item_info['items_tax_class_id']));
	
	$items_price_uvp = $currencies->display_price($item_info['items_price_uvp'], '');
	$items_herstellernummer = $item_info['herstellernummer'];
	$template_inhalt = preg_replace('/<-items_herstellernummer->/', $items_herstellernummer, $template_inhalt);  
	$template_inhalt = preg_replace('/&lt;-items_herstellernummer-&gt;/', $items_herstellernummer, $template_inhalt);    
	if (go_not_null($item_info['items_model'])) { 
		$synonym_query = go_db_query("select synonym_for_model from import_comsa where import_id = '1'");
		$synonym = go_db_fetch_array($synonym_query);        	

		if ($synonym['synonym_for_model'] == $item_info['syn']){
			$item_info_neu = $item_info['items_model'];
			$item_info_neu = preg_replace('/A/i', '1', $item_info_neu);
			$item_info_neu = preg_replace('/B/i', '2', $item_info_neu);
			$item_info_neu = preg_replace('/C/i', '3', $item_info_neu);
			$item_info_neu = preg_replace('/D/i', '4', $item_info_neu);
			$item_info_neu = preg_replace('/E/i', '5', $item_info_neu);
			$item_info_neu = preg_replace('/F/i', '6', $item_info_neu);
			$item_info_neu = preg_replace('/G/i', '7', $item_info_neu);
			$item_info_neu = preg_replace('/H/i', '8', $item_info_neu);
			$item_info_neu = preg_replace('/I/i', '9', $item_info_neu);
			$item_info_neu = preg_replace('/J/i', '0', $item_info_neu);   
			$item_info_neu = preg_replace('/K/i', '1', $item_info_neu);
			$item_info_neu = preg_replace('/L/i', '2', $item_info_neu);
			$item_info_neu = preg_replace('/M/i', '3', $item_info_neu);
			$item_info_neu = preg_replace('/N/i', '0', $item_info_neu);
			$item_info_neu = preg_replace('/O/i', '4', $item_info_neu);
			$item_info_neu = preg_replace('/P/i', '5', $item_info_neu);
			$item_info_neu = preg_replace('/Q/i', '6', $item_info_neu);
			$item_info_neu = preg_replace('/R/i', '7', $item_info_neu);
			$item_info_neu = preg_replace('/S/i', '8', $item_info_neu);
			$item_info_neu = preg_replace('/T/i', '9', $item_info_neu);
			$item_info_neu = preg_replace('/U/i', '0', $item_info_neu);  
			$item_info_neu = preg_replace('/V/i', '1', $item_info_neu);
			$item_info_neu = preg_replace('/W/i', '2', $item_info_neu);
			$item_info_neu = preg_replace('/X/i', '3', $item_info_neu);
			$item_info_neu = preg_replace('/Y/i', '4', $item_info_neu);   
			$item_info_neu = preg_replace('/Z/i', '5', $item_info_neu);
			$item_info_neu = preg_replace('/-/i', '6', $item_info_neu);
			$item_info_neu = preg_replace('/_/i', '7', $item_info_neu);

		}
		else{
			$item_info_neu = $item_info['items_model'];
		} 
		if ($items_name2_anzeigen == "ja"){
			$anzeigen_produkt2 = '<br><span class="smallText">' . $item_info['items_name2'] . '</span>';
		}
		$items_name = $item_info['items_name'] . '' . $anzeigen_produkt2 . '<br><span class="smallText">[' . $item_info_neu  . ']</span>';
	} else {
		if ($items_name2_anzeigen == "ja"){
			$anzeigen_produkt2 = '<br><span class="smallText">' . $item_info['items_name2'] . '</span>';
		}
		$items_name = $item_info['items_name'] . $anzeigen_produkt2;
	}
	if ($auf_anfrage != 1){    
		if ($uvp_anzeigen == "ja"){
			$items_price = $text_price . '<br>' . $items_price;
			if ($items_price_uvp > 0){
				$items_price .= '<br><span class="smallText">' . $text_uvp . '<br>' . $items_price_uvp . '</span>';
			}
		}
	}
	$template_inhalt = preg_replace('/<-items_name->/', $items_name, $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-items_name-&gt;/', $items_name, $template_inhalt);  
	if (PRICES_LOGGED_IN == 'false') {
		$item_price_d = $items_price;
		$showbutton = false;
	}
	if ((PRICES_LOGGED_IN == 'true') && (!go_session_is_registered('attendee_id'))) {
		$item_price_d = ('<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_40], '','SSL') . '">'  . PRICES_LOGGED_IN_SUBMIT . '</a>&nbsp;' );
	}  else  {
		$showbutton = true;
		$item_price_d = $items_price;                           
	}
	$template_inhalt = preg_replace('/<-items_price->/', $item_price_d, $template_inhalt); 
	$template_inhalt = preg_replace('/&lt;-items_price-&gt;/', $item_price_d, $template_inhalt);  
	$template_inhalt = preg_replace('/<-bezeichnung1->/', $item_info['bezeichnung1'], $template_inhalt);  
	$template_inhalt = preg_replace('/&lt;-bezeichnung1-&gt;/', $item_info['bezeichnung1'], $template_inhalt);
	$template_inhalt = preg_replace('/<-items_quantity->/', $item_info['items_quantity'], $template_inhalt);  
	$template_inhalt = preg_replace('/&lt;-items_quantity-&gt;/', $item_info['items_quantity'], $template_inhalt);
	$template_inhalt = preg_replace('/<-inhalt1->/', $item_info['inhalt1'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-inhalt1-&gt;/', $item_info['inhalt1'], $template_inhalt);
	$template_inhalt = preg_replace('/<-bezeichnung2->/', $item_info['bezeichnung2'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-bezeichnung2-&gt;/', $item_info['bezeichnung2'], $template_inhalt);
	$template_inhalt = preg_replace('/<-inhalt2->/', $item_info['inhalt2'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-inhalt2-&gt;/', $item_info['inhalt2'], $template_inhalt);
	$template_inhalt = preg_replace('/<-bezeichnung3->/', $item_info['bezeichnung3'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-bezeichnung3-&gt;/', $item_info['bezeichnung3'], $template_inhalt);
	$template_inhalt = preg_replace('/<-inhalt3->/', $item_info['inhalt3'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-inhalt3-&gt;/', $item_info['inhalt3'], $template_inhalt);
	$template_inhalt = preg_replace('/<-bezeichnung4->/', $item_info['bezeichnung4'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-bezeichnung4-&gt;/', $item_info['bezeichnung4'], $template_inhalt);
	$template_inhalt = preg_replace('/<-inhalt4->/', $item_info['inhalt4'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-inhalt4-&gt;/', $item_info['inhalt4'], $template_inhalt);
	$template_inhalt = preg_replace('/<-bezeichnung5->/', $item_info['bezeichnung5'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-bezeichnung5-&gt;/', $item_info['bezeichnung5'], $template_inhalt);
	$template_inhalt = preg_replace('/<-inhalt5->/', $item_info['inhalt5'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-inhalt5-&gt;/', $item_info['inhalt5'], $template_inhalt);
	$template_inhalt = preg_replace('/<-bezeichnung6->/', $item_info['bezeichnung6'], $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-bezeichnung6-&gt;/', $item_info['bezeichnung6'], $template_inhalt);
	$template_inhalt = preg_replace('/<-inhalt6->/', $item_info['inhalt6'], $template_inhalt);  
	$template_inhalt = preg_replace('/&lt;-inhalt6-&gt;/', $item_info['inhalt6'], $template_inhalt);     
	$items_characteristics_query = go_db_query("select count(*) as total from " . DB_TBL_ITEMS_OPTIONS_CONF . " popt, " . DB_TBL_ITEMS_CHARACTERISTICS_CONF . " patrib where patrib.items_id='" . (int)$_GET['items_id'] . "' and patrib.options_conf_id = popt.items_options_conf_id and popt.language_id = '" . (int)$languages_id . "'");
	$items_characteristics = go_db_fetch_array($items_characteristics_query);
	if ($items_characteristics['total'] > 0) {
		if (go_not_null(TEXT_ITEM_OPTIONS)) { 
			$template_inhalt = preg_replace('/<-items_options_ueberschrift->/', TEXT_ITEM_OPTIONS, $template_inhalt);  
			$template_inhalt = preg_replace('/&lt;-items_options_ueberschrift-&gt;/', TEXT_ITEM_OPTIONS, $template_inhalt);            
		}
		else{
			$template_inhalt = preg_replace('/<-items_options_ueberschrift->/', "", $template_inhalt); 
			$template_inhalt = preg_replace('/&lt;-items_options_ueberschrift-&gt;/', "", $template_inhalt); 

		} 
		$konfigurator=go_display_konfigurator($items_id,$array_selected_konfigurator_values,$items_price_konfigurator);
		$template_inhalt = preg_replace('/<-items_options_name->/', "", $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_options_name-&gt;/', "", $template_inhalt);
		$template_inhalt = preg_replace('/<-items_options_select->/', $konfigurator, $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_options_select-&gt;/', $konfigurator, $template_inhalt);


	}
	else{
		$template_inhalt = preg_replace('/<-items_options_name->/', "", $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_options_name-&gt;/', "", $template_inhalt);
		$template_inhalt = preg_replace('/<-items_options_select->/', "", $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_options_select-&gt;/', "", $template_inhalt);
		$template_inhalt = preg_replace('/<-items_options_ueberschrift->/', "", $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_options_ueberschrift-&gt;/', "", $template_inhalt);
	}
	$reviews_query = go_db_query("select count(*) as count from " . DB_TBL_REVIEWS . " where items_id = '" . (int)$_GET['items_id'] . "'");
	$reviews = go_db_fetch_array($reviews_query);
	if ($reviews['count'] > 0) {
		$template_inhalt = preg_replace('/<-aktuelle_meinung->/', TEXT_CURRENT_REVIEWS . ' ' . $reviews['count'], $template_inhalt); 
		$template_inhalt = preg_replace('/&lt;-aktuelle_meinung-&gt;/', TEXT_CURRENT_REVIEWS . ' ' . $reviews['count'], $template_inhalt); 
	}
	else{
		$template_inhalt = preg_replace('/<-aktuelle_meinung->/', "", $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-aktuelle_meinung-&gt;/', "", $template_inhalt); 
	}
	if (go_not_null($item_info['items_url'])) {
		$template_inhalt = preg_replace('/<-item_url->/', sprintf(TEXT_MORE_INFORMATION, go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_63], 'action=url&goto=' . urlencode($item_info['items_url']), 'NONSSL', true, false)), $template_inhalt); 
		$template_inhalt = preg_replace('/&lt;-item_url-&gt;/', sprintf(TEXT_MORE_INFORMATION, go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_63], 'action=url&goto=' . urlencode($item_info['items_url']), 'NONSSL', true, false)), $template_inhalt);     	
	}
	else{
		$template_inhalt = preg_replace('/<-item_url->/', "", $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-item_url-&gt;/', "", $template_inhalt);    
	}


// Erweiterung Bert Bestandsanzeige ;
	$prod_quantity = go_get_items_stock($_GET['items_id']);

// ist die Bestandsanzeige per Ampel eingeschaltet ?
            if (STOCK_LIMIT_LEVEL == 'true' ) {

// wenn ja 

// die Einstellungen f�r die gelbe und orange Ampel aus der DB holen 
$orange_light_query = go_db_query("SELECT * FROM " . DB_TBL_LIMIT_LEVEL_CONFIG . " WHERE set_it_up_key = 'SHOW_ORANGE_TRAFFIC_LIGHT' ");
$orange_light_sql = go_db_fetch_array($orange_light_query);
$orange_light = $orange_light_sql["set_it_up_value"];

$yellow_light_query = go_db_query("SELECT * FROM " . DB_TBL_LIMIT_LEVEL_CONFIG . " WHERE set_it_up_key = 'SHOW_YELLOW_TRAFFIC_LIGHT' ");
$yellow_light_sql = go_db_fetch_array($yellow_light_query);
$yellow_light = $yellow_light_sql["set_it_up_value"];

// wenn Artikelbestand weniger "1" ist die Ampel "ROT" 
                if ($prod_quantity < 1){
		  				  $ampel = '<img src="' . FOLDER_RELATIV_PIC_SYSTEM_TEMPLATES . 'ampel_rot.gif" border="0" title="Artikel zur Zeit nicht verf�gbar">';
                }
// wenn Artikelbestand weniger oder gleich "ORANGE" 
                elseif ($prod_quantity <= $orange_light){
		  				  $ampel = '<img src="' . FOLDER_RELATIV_PIC_SYSTEM_TEMPLATES . 'ampel_orange.gif" border="0" title="Artikel nur noch sehr begrenzt verf�gbar">';
                }
// wenn Artikelbestand weniger oder gleich "GELB" 
                elseif ($prod_quantity <= $yellow_light){
		  				  $ampel = '<img src="' . FOLDER_RELATIV_PIC_SYSTEM_TEMPLATES . 'ampel_gelb.gif" border="0" title="Artikel begrenzt verf�gbar">';
                }
// wenn Artikelbestand mehr als "GELB" ist die Ampel gr�n 
                elseif ($prod_quantity > $yellow_light){
		  				  $ampel = '<img src="' . FOLDER_RELATIV_PIC_SYSTEM_TEMPLATES . 'ampel_gruen.gif" border="0" title="Artikel ausreichend verf�gbar">';
                }
            }
            else {

// Ampelanzeige ist ausgeschaltet 
              	if ($prod_quantity < 1){
            		$ampel = '<img src="' . FOLDER_RELATIV_PIC_SYSTEM_TEMPLATES . 'rote_ampel.jpg" border="0">';	
              	}
              	else{
            		$ampel = '<img src="' . FOLDER_RELATIV_PIC_SYSTEM_TEMPLATES . 'gruene_ampel.jpg" border="0">';
              	} 
            }
// Ende ;

	$template_inhalt = preg_replace('/<-ampel->/', $ampel, $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-ampel-&gt;/', $ampel, $template_inhalt); 
	$query = "SELECT * FROM rahmen WHERE id = '1'";
	$result = go_db_QUERY($query);
	$number = go_db_NUMROWS($result);
	$rahmennummer = mysqli_result($result,0,"rahmennummer");
	if ($rahmennummer != 3){
$frame_f�r_schleife1 = <<<EOT
<table cellspacing = 0 cellpadding = 0 border = 0>
<tr><td width="1">
  <img border="0" src="picture/rahmen/oben_links$rahmennummer.gif"></td>
  <td background="picture/rahmen/oben_linie$rahmennummer.gif" width="1">
  <img border="0" src="picture/rahmen/oben_linie$rahmennummer.gif"></td><td width="1">
  <img border="0" src="picture/rahmen/oben_rechts$rahmennummer.gif"></td></tr>
<tr><td background="picture/rahmen/links_linie$rahmennummer.gif" width="1">
  <img border="0" src="picture/rahmen/links_linie$rahmennummer.gif"></td>
  <td bgcolor="#FFFFFF" align="center">
EOT;
$endeframe_f�r_schleife = <<<EOT
  </td>
  <td background="picture/rahmen/rechts_linie$rahmennummer.gif" width="1">
  <img border="0" src="picture/rahmen/rechts_linie$rahmennummer.gif"></td></tr>
<tr><td width="1">
  <img border="0" src="picture/rahmen/unten_links$rahmennummer.gif"></td>
  <td background="picture/rahmen/unten_linie$rahmennummer.gif" width="1">
  <img border="0" src="picture/rahmen/unten_linie$rahmennummer.gif"></td><td width="1">
  <img border="0" src="picture/rahmen/unten_rechts$rahmennummer.gif"></td></tr>
</TABLE> 
EOT;
}

	if (go_not_null($item_info['items_picture'])) {
		$template_inhalt = preg_replace('/<-items_picture->/', $picture_frame['begin_frame'] . make_picture_popup($item_info['items_id'], $item_info['items_picture'], $item_info['items_name'], TEXT_CLICK_TO_ENLARGE, '2') . $picture_frame['end_frame'], $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_picture-&gt;/', $picture_frame['begin_frame'] . make_picture_popup($item_info['items_id'], $item_info['items_picture'], $item_info['items_name'], TEXT_CLICK_TO_ENLARGE, '2') . $picture_frame['end_frame'], $template_inhalt);
	}
	else{
		$template_inhalt = preg_replace('/<-items_picture->/', "", $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_picture-&gt;/', "", $template_inhalt);    
	}

	if (go_not_null($item_info['items_bpicture'])) {
		$template_inhalt = preg_replace('/<-items_bpicture->/', go_picture(FOLDER_RELATIV_PICTURES . $item_info['items_bpicture'], $item_info['items_name'], '', '', 'hspace="5" vspace="5"'), $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-items_bpicture-&gt;/', go_picture(FOLDER_RELATIV_PICTURES . $item_info['items_bpicture'], $item_info['items_name'], '', '', 'hspace="5" vspace="5"'), $template_inhalt);
	}
	else{
		$template_inhalt = preg_replace('/<-items_bpicture->/', "", $template_inhalt); 
		$template_inhalt = preg_replace('/&lt;-items_bpicture-&gt;/', "", $template_inhalt);    
	}


#$pictures_link1 = '<a href="javascript:popupWindow(\\\'' . go_href_link($GLOBALS[CONFIG_NAME_FILE][popup_picture], 'bigID=' . $item_info['items_id']) . '\\\')">' . go_picture(FOLDER_RELATIV_PICTURES . $item_info['items_picture'], addslashes($item_info['items_name']), SMALL_PICTURE_WIDTH, SMALL_PICTURE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';
#$pictures_link2 = '<a href="' . go_href_link(FOLDER_RELATIV_PICTURES . $item_info['items_picture']) . '" target="_blank">' . go_picture(FOLDER_RELATIV_PICTURES . $item_info['items_picture'], $item_info['items_name'], SMALL_PICTURE_WIDTH, SMALL_PICTURE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';
#$eot_items_picture = <<<EOT
#$frame_f�r_schleife1            
#<script language="javascript"><!--
#document.write('$pictures_link1');
#//--></script>
#<noscript>
#$pictures_link
#</noscript>
#$endeframe_f�r_schleife 
#EOT;
#    if (go_not_null($item_info['items_picture'])) {
#$template_inhalt = preg_replace('/<-items_picture->/', $eot_items_picture, $template_inhalt);
#$template_inhalt = preg_replace('/&lt;-items_picture-&gt;/', $eot_items_picture, $template_inhalt);
#}
#    else{
#$template_inhalt = preg_replace('/<-items_picture->/', "", $template_inhalt);
#$template_inhalt = preg_replace('/&lt;-items_picture-&gt;/', "", $template_inhalt);    
#    }
#    if (go_not_null($item_info['items_bpicture'])) {
#$template_inhalt = preg_replace('/<-items_bpicture->/', go_picture(FOLDER_RELATIV_PICTURES . $item_info['items_bpicture'], $item_info['items_name'], '', '', 'hspace="5" vspace="5"'), $template_inhalt);
#$template_inhalt = preg_replace('/&lt;-items_bpicture-&gt;/', go_picture(FOLDER_RELATIV_PICTURES . $item_info['items_bpicture'], $item_info['items_name'], '', '', 'hspace="5" vspace="5"'), $template_inhalt);
#}
#    else{
#$template_inhalt = preg_replace('/<-items_bpicture->/', "", $template_inhalt); 
#$template_inhalt = preg_replace('/&lt;-items_bpicture-&gt;/', "", $template_inhalt);    
#    } 
    if ($item_info['items_date_available'] > date('Y-m-d H:i:s')) {
$template_inhalt = preg_replace('/<-items_datum->/', sprintf(TEXT_DATE_AVAILABLE, go_date_long($item_info['items_date_available'])), $template_inhalt);
$template_inhalt = preg_replace('/&lt;-items_datum-&gt;/', sprintf(TEXT_DATE_AVAILABLE, go_date_long($item_info['items_date_available'])), $template_inhalt);
    } else {
$template_inhalt = preg_replace('/<-items_datum->/', sprintf(TEXT_DATE_ADDED, go_date_long($item_info['items_date_added'])), $template_inhalt);
$template_inhalt = preg_replace('/&lt;-items_datum-&gt;/', sprintf(TEXT_DATE_ADDED, go_date_long($item_info['items_date_added'])), $template_inhalt);
}
if ($item_info['items_ship_price'] > 0){
define('TEXT_SHIP_PRICE', VERSANDPREIS_FOR_THIS . ' ' . $currencies->display_price($item_info['items_ship_price'], ''));
$template_inhalt = preg_replace('/<-items_individueller_versandpreis->/', sprintf(TEXT_SHIP_PRICE, ($item_info['items_ship_price'])), $template_inhalt);
$template_inhalt = preg_replace('/&lt;-items_individueller_versandpreis-&gt;/', sprintf(TEXT_SHIP_PRICE, ($item_info['items_ship_price'])), $template_inhalt);
}
else{
$template_inhalt = preg_replace('/<-items_individueller_versandpreis->/', '', $template_inhalt);
$template_inhalt = preg_replace('/&lt;-items_individueller_versandpreis-&gt;/', '', $template_inhalt);
}
if ($item_info['items_ship_price_two'] > 0){	
define('TEXT_SHIP_PRICE_TWO', VERSANDPREIS_FOR_THIS_SECOND . ' ' . $currencies->display_price($item_info['items_ship_price_two'], ''));
$template_inhalt = preg_replace('/<-items_individueller_versandpreis_zwei->/', sprintf(TEXT_SHIP_PRICE_TWO, ($item_info['items_ship_price_two'])), $template_inhalt);
$template_inhalt = preg_replace('/&lt;-items_individueller_versandpreis_zwei-&gt;/', sprintf(TEXT_SHIP_PRICE_TWO, ($item_info['items_ship_price_two'])), $template_inhalt);
}
else{
$template_inhalt = preg_replace('/<-items_individueller_versandpreis_zwei->/', '', $template_inhalt);
$template_inhalt = preg_replace('/&lt;-items_individueller_versandpreis_zwei-&gt;/', '', $template_inhalt);
}
for ($i=0; $i<$anzahl_select; $i++) {
$qty_array[] = array('id' => $i+1, 'text' => $i+1);
}
$template_inhalt = preg_replace('/<-bewerten_button->/', '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_35], go_get_all_get_parameter()) . '">' . go_picture_button('button_reviews.gif', PICTURE_BUTTON_REVIEWS) . '</a>', $template_inhalt);
$template_inhalt = preg_replace('/&lt;-bewerten_button-&gt;/', '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_35], go_get_all_get_parameter()) . '">' . go_picture_button('button_reviews.gif', PICTURE_BUTTON_REVIEWS) . '</a>', $template_inhalt);
if ($auf_anfrage == 1){
    $template_inhalt = preg_replace('/<-kaufen_button->/', '<a href="' . $GLOBALS[CONFIG_NAME_FILE][main_bigware_8] . '?enquiry=' . $preistext . '">' . go_picture_button('button_fragen_now.gif', PICTURE_BUTTON_BUY_NOW) . '</a>', $template_inhalt);
    $template_inhalt = preg_replace('/&lt;-kaufen_button-&gt;/', '<a href="' . $GLOBALS[CONFIG_NAME_FILE][main_bigware_8] . '?enquiry=' . $preistext . '">' . go_picture_button('button_fragen_now.gif', PICTURE_BUTTON_BUY_NOW) . '</a>', $template_inhalt);
}
else{ 
if (PRICES_LOGGED_IN == 'false')
       $submit_button = go_picture_submit('button_in_cart.gif', PICTURE_BUTTON_IN_CART);
       $submit_item_quant = go_fetch_pull_down_menu('cart_quantity', $qty_array, 1); 
if ( (PRICES_LOGGED_IN == 'true') && (!go_session_is_registered('attendee_id'))) {
      $submit_button = '<a href="' . go_href_link($GLOBALS[CONFIG_NAME_FILE][main_bigware_40], '','SSL') . '">'  . PRICES_LOGGED_IN_SUBMIT . '</a>&nbsp;';
      $submit_item_quant = ''; 
         }  else {
      $submit_button = go_picture_submit('button_in_cart.gif', PICTURE_BUTTON_IN_CART);
      $submit_item_quant = go_fetch_pull_down_menu('cart_quantity', $qty_array, 1); 
                     } 
$submit_button = '<input type="hidden" name="items_id" value="' . $item_info['items_id'] . '">' . $submit_button; 
	if ((STOCK_ALLOW_CHECKOUT == 'false')&&(go_get_items_stock($item_info['items_id']) < 1)) {
		$template_inhalt = preg_replace('/<-kaufen_button->/','<font color="#FF0000">' . THIS_ITEM_NOT_THERE . '</font>' , $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-kaufen_button-&gt;/','<font color="#FF0000">' . THIS_ITEM_NOT_THERE . '</font>' , $template_inhalt);
	}
	else{
		$template_inhalt = preg_replace('/<-kaufen_button->/',$submit_button , $template_inhalt);
		$template_inhalt = preg_replace('/&lt;-kaufen_button-&gt;/',$submit_button , $template_inhalt);
	}
}  
$hidden_characteristics = go_display_hidden_konfigurator($items_id,$array_selected_konfigurator_values);
if ($getPriceOption == 'U lfdm'){
	$template_inhalt = preg_replace('/<-anzahl_select->/', $formbeginn.go_fetch_pull_down_menu('quantity', $qty_array, 1,'onChange=changeQuadraturU(form.elements[\'laenge\'].value,form.elements[\'breite\'].value,this.options[selectedIndex].value,this.form)').$hidden_characteristics, $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-anzahl_select-&gt;/', $formbeginn.go_fetch_pull_down_menu('quantity', $qty_array, 1,'onChange=changeQuadraturU(form.elements[\'laenge\'].value,form.elements[\'breite\'].value,this.options[selectedIndex].value,this.form)').$hidden_characteristics, $template_inhalt);	
}
else{
	$template_inhalt = preg_replace('/<-anzahl_select->/',$formbeginn. go_fetch_pull_down_menu('quantity', $qty_array, 1,'onChange=changeQuadratur(form.elements[\'laenge\'].value,form.elements[\'breite\'].value,this.options[selectedIndex].value,this.form)').$hidden_characteristics, $template_inhalt);
	$template_inhalt = preg_replace('/&lt;-anzahl_select-&gt;/',$formbeginn. go_fetch_pull_down_menu('quantity', $qty_array, 1,'onChange=changeQuadratur(form.elements[\'laenge\'].value,form.elements[\'breite\'].value,this.options[selectedIndex].value,this.form)').$hidden_characteristics, $template_inhalt);
}
if ($showLaengeBreite) {
	
	if (file_exists(FOLDER_ABSOLUT_CATALOG . 'modules/lfdm_qm_qmm_Ulfdm')) {
		require(FOLDER_ABSOLUT_CATALOG . 'modules/lfdm_qm_qmm_Ulfdm/content/main_bigware_34.tpl.php');
	}
}
else {
$template_inhalt = preg_replace('/<-laenge->/', '', $template_inhalt);
$template_inhalt = preg_replace('/&lt;-laenge-&gt;/', '', $template_inhalt);
$template_inhalt = preg_replace('/<-breite->/', '', $template_inhalt);
$template_inhalt = preg_replace('/&lt;-breite-&gt;/', '', $template_inhalt);
$template_inhalt = preg_replace('/<-quadratur->/', '', $template_inhalt);
$template_inhalt = preg_replace('/&lt;-quadratur-&gt;/', '', $template_inhalt);
}


// Loopthrough0

			if (file_exists(FOLDER_ABSOLUT_CATALOG . 'modules/extra_costumer_input_for_items')) {
         require(FOLDER_ABSOLUT_CATALOG . 'modules/extra_costumer_input_for_items/content/main_bigware_34.tpl.php');
       }
			if (file_exists(FOLDER_ABSOLUT_CATALOG . 'modules/masseinheitenartikel')) {
         require(FOLDER_ABSOLUT_CATALOG . 'modules/masseinheitenartikel/content/main_bigware_34.tpl.php');
       }

       $description = stripslashes($item_info['items_description']);
       if (substr($description,0,11) == "page_insert")
	 { 
          $explode_description = explode(chr(40).chr(41),$description);
          $index = (int)$_GET['page_index'];
	    if (count($explode_description) < 2){
	       $template_inhalt = preg_replace('/<-description->/', $description, $template_inhalt);
	       $template_inhalt = preg_replace('/&lt;-description-&gt;/', $description, $template_inhalt);
          }
          else
	    {
             if ($index >= count($explode_description))
		 { 
			$index = 1;
		 } 
		 if ($index < 1)
	                $index = 1;
	                $file = fopen ("$explode_description[$index]", "r");
			if (!$file) {
			    $line = "<p>" . FILE_NOT_OPEN . "\n";
			    exit;
			}
			while (!feof ($file)) {
		    $line .= fgets ($file, 4096);
			}
			$template_inhalt = preg_replace('/<-description->/', $line, $template_inhalt);
			$template_inhalt = preg_replace('/&lt;-description-&gt;/', $line, $template_inhalt);
			fclose($file);
		 
	    }
	 }
       else
          $template_inhalt = preg_replace('/<-description->/', stripslashes($item_info['items_description']), $template_inhalt);
          $template_inhalt = preg_replace('/&lt;-description-&gt;/', stripslashes($item_info['items_description']), $template_inhalt);
echo $template_inhalt;
?>
<br><br>
<?php 
   if ( (USE_CACHE == 'true') && !SID) { 
   	echo go_cache_also_purchased(3600);
	echo "<br>";
     include(FOLDER_RELATIV_MODULES . $GLOBALS[CONFIG_NAME_FILE][xsell_items]);
} else {
	
     include(FOLDER_RELATIV_MODULES . $GLOBALS[CONFIG_NAME_FILE][xsell_items]);
	echo "<br>";
     include(FOLDER_RELATIV_MODULES . $GLOBALS[CONFIG_NAME_FILE][also_purchased_items]);
    }
}
?>
</form>
