<?php
/*
  $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
  Copyright (c) 2003 osCommerce
  Released under the GNU General Public License
*/
  require('includes/application_top.php');
  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where (p.products_status = '1' or (p.products_status='0' and p.products_bundle_status='1')) and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
  $product_check = tep_db_fetch_array($product_check_query); 
  
  if ($product_check['total'] < 1) { 
    $productFamilyMasterQuery = tep_db_query("select products_family from " . TABLE_PRODUCTS . " where products_id='" . $HTTP_GET_VARS['products_id'] . "'"); 
    $productFamilyMasterArray = tep_db_fetch_array($productFamilyMasterQuery); 
   $productFamily = $productFamilyMasterArray['products_family']; 
   $productFamilyMasterQuery = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_family='" . $productFamily . "' and products_status != '0'"); 
   $productFamilyMasterArray = tep_db_fetch_array($productFamilyMasterQuery); 
   $productFamilyMasterID = $productFamilyMasterArray['products_id']; 
   if(count($productFamilyMasterArray) == "1") { 
     tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $productFamilyMasterID)); 
   } 
  } 
  else {
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: Header Tag Controller v2.5.7
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
  require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?>
  <title><?php echo TITLE; ?></title>
<?php
}
// EOF: Header Tag Controller v2.5.7
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
/* DDB - 041031 - Form Field Progress Bar */
/***********************************************
* Form Field Progress Bar- By Ron Jonk- http://www.euronet.nl/~jonkr/
* Modified by Dynamic Drive for minor changes
* Script featured/ available at Dynamic Drive- http://www.dynamicdrive.com
* Please keep this notice intact
***********************************************/
function textCounter(field,counter,maxlimit,linecounter) {
	// text width//
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        
	// trim the extra text
	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	} else { 
	// progress bar percentage
	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
	// color correction on style from CCFFF -> CC0000
	setcolor(document.getElementById(counter),percentage,"background-color");
	}
}
function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
//--></script>
<script language="javascript">
<!--
   function FormatNumber(num)
   {
     if(isNaN(num)) { num = "0"; }
     sign = (num == (num = Math.abs(num)));
     num = Math.floor(num*100+0.50000000001);
     cents = num%100;
     num = Math.floor(num/100).toString();
     if(cents<10) { cents = "0" + cents; }
     for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
     {
       num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
     }
     return (((sign)?'':'-') + num + '.' + cents);
   }
  function showPrice(form)
  {  
    var myTotalPrice = 0;
    var showUP = 0;
    var myMathProblem = "";
    myItemPrice = parseFloat(form.nuPrice.value);
    for (var i = 0; i < form.elements.length; i++)
    {
      var e = form.elements[i];
      if ( e.type == 'select-one' )
      {
        showUP = 1;
        Item = e.selectedIndex;
        myPrice = e.options[Item].text;
      myPrice = myPrice.replace(/,/, ".");
        myDollarSign = myPrice.indexOf("(",0)
        if ( myDollarSign != "-1" )
        {
          myParSign = myPrice.indexOf(")", myDollarSign);
          myAttributeString = myPrice.substring(myDollarSign+1, myParSign);
          myAttributeString = myAttributeString.replace(/'/,"");
          myAttributePrice = parseFloat(myAttributeString);
          myMathProblem = myPrice.charAt(myDollarSign - 1);
        } else { myAttributePrice = 0; }
          if (myMathProblem == "-")
          {
            myTotalPrice = myTotalPrice - myAttributePrice;
          } else {
            myTotalPrice = myTotalPrice + myAttributePrice;
          }
      }
    }  
    if ( showUP )
    {
        myTotalPrice = FormatNumber(myTotalPrice + myItemPrice);
        document.getElementById("productNEWprice").innerHTML = "Preis inkl. Optionen " + myTotalPrice + " EUR" + " inkl. 19%MwST. zzgl.Versandkosten";
    }
  }  
//-->
</script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onload="showPrice(cart_quantity)">

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    <td width="<?php echo BOX_WIDTH_LEFT_IS; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH_LEFT_IS; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php
   if ($product_check['total'] >= 1) {
	   if (ALLOW_BUTTON_NEXT_PREV == 'true')
      include (DIR_WS_INCLUDES . 'products_next_previous.php');
   }
   ?>

<?php
  if ($product_check['total'] < 1) {
?>
      <tr>
        <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="Contents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  } else {
    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, pd.products_spec, pd.products_musthave, pd.products_extraimage, pd.products_manual, pd.products_extra1, pd.products_moreinfo, p.products_model, p.products_quantity, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, pd.products_url, p.products_price, p.products_fsk_18, p.products_fsk_18_hidden, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_discount, p.products_bundle from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where (p.products_status = '1' or (p.products_status='0' and p.products_bundle_status='1')) and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);
    tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
      $products_price = '<s>' . $currencies->display_price2($product_info['products_price'], 
tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . 
$currencies->display_price2($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';$nuPrice = $currencies->display_price2($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
    } else {
      $products_price = $currencies->display_price2($product_info['products_price'],
tep_get_tax_rate($product_info['products_tax_class_id']));
$nuPrice = $products_price;
}
$nuPrice =str_replace(",", "", $nuPrice);

    if (tep_not_null($product_info['products_model'])) {
      $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
    } else {
      $products_name = $product_info['products_name'];
    }
//FSK 18
//Check ob Product FSK18 und versteckt ist
if (($product_info['products_fsk_18_hidden'] == 1) && ($customer['customers_fsk_18'] != 1)){
?>
      <tr>
        <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_FSK_FOUND))); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="Contents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  } else {
//FSK EOF
?>
<?
    $mopics_image_width = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_WIDTH:'');
    $mopics_image_height = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_HEIGHT:'');

    if (MOPICS_SHOW_ALL_ON_PRODUCT_INFO=='true') {

      $mopics_output = '';
      $mo_row = 1;
      $mo_col = 1;

      $mopics_images = array();
      if (tep_not_null($product_info['products_image']) && MOPICS_GROUP_WITH_PARENT == 'true') { $mopics_images[] = $product_info['products_image']; }
      for ( $mo_item=1; $mo_item<7; $mo_item++ ) {
        if (tep_not_null($product_info['products_subimage'.$mo_item])) { $mopics_images[] = $product_info['products_subimage'.$mo_item]; }
      }
      $mopics_count = sizeof($mopics_images);

      if (tep_not_null($product_info['products_image'])) { $mopics_output .= '<table border="0" cellspacing="0" cellpadding="6" align="'.MOPICS_TABLE_ALIGNMENT.'">'."\n"; }

      for ( $mo_item=0; $mo_item<$mopics_count; $mo_item++ ) {

        if ($mo_row<(MOPICS_NUMBER_OF_ROWS+1)) {
    	  if ($mo_col==1) {$mopics_output.='<tr>';}

          $mopics_output .= '              <td align="center" class="smallText"><script language="javascript"><!--
                document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.(MOPICS_GROUP_WITH_PARENT=='true'?$mo_item:($mo_item+1))).'\\\')">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'&&$mo_item==0&&MOPICS_GROUP_WITH_PARENT=='true'?'':$mopics_image_width), (MOPICS_RESTRICT_PARENT=='false'&&$mo_item==0&&MOPICS_GROUP_WITH_PARENT=='true'?'':$mopics_image_height), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');
                //--></script><noscript>
                  <a href="' . tep_href_link(DIR_WS_IMAGES . $mopics_images[$mo_item]) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], $product_info['products_name'], $mopics_image_width, $mopics_image_height, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>
                  </noscript></td>'."\n";

    	  if ($mo_col==MOPICS_NUMBER_OF_COLS) { $mo_col=1; $mo_row++; $mopics_output.='</tr>'."\n"; } else { $mo_col++; }
        }
	
      }
  
      if ($mo_col!=1){ while (($mo_col++)<(MOPICS_NUMBER_OF_COLS+1)) { $mopics_output.='<td>&nbsp;</td>'."\n"; } }

      if (tep_not_null($product_info['products_image'])) { $mopics_output .= '</table>'."\n"; }

    }

// EOF: More Pics 6
	
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left"<h1><font color=#000000><font size=4><b><?php echo $products_name; ?></font></h1></td>
            <!-- //Base Price Change //-->
            <td class="pageHeading" align="right" valign="top"><?php
          $family_query = tep_db_query("select products_family from " . TABLE_PRODUCTS . " where products_id='" . $HTTP_GET_VARS['products_id'] . "'");
$results = tep_db_fetch_array($family_query);
if ($results['products_family'] != '') {
	echo 'ab ';
	}
        echo tep_get_products_display_price($product_info['products_id']) . tep_get_products_display_price($product_info['products_id'], true); ?></td>
</td>
          </tr>
        </table></td>
      </tr>
<input type="hidden" name="nuPrice" value="<?php echo str_replace("€","",$nuPrice); ?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td class="main">
<!-- //FSK 18 //--->
<table border="0" cellspacing="0" cellpadding="2" align="right">
<tr>
<td align="center" class="smallText">
<?php
//// WENN PRODUKT FSK18
if ($product_info['products_fsk_18'] == 1) {
echo '<a href="' . tep_href_link(FILENAME_FSK_18, '' , NONSSL) . '">' . tep_image_button('fsk18.gif', '') . '</a>&nbsp;&nbsp;';

//// WENN KUNDE IST REGISTRIERT
	if (tep_session_is_registered('customer_id')) {
//// WENN PRODUKT FSK18 UND KUNDE IST FREIGESCHALTET
		if (($product_info['products_fsk_18'] == 1) && ($customer['customers_fsk_18'] == 1)){
			if (tep_not_null($product_info['products_image']) && MOPICS_GROUP_WITH_PARENT == 'false') {
			?>
			<script language="javascript"><!--
			document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
			//--></script>
			<noscript>
			<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
      <?php // EOF: More Pics 6 ?>
			</noscript>
			<?php
			}
//// ANSONSTEN PRODUKT FSK18 UND KUNDE NICHT FREIGESCHALTET
		} else {
		?>
			<script language="javascript"><!--
			document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
			//--></script>
			<noscript>
			<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
			</noscript>
		<?php
		}
	}
//// WENN PRODUKT NICHT FSK 18
} else {
?>
			<script language="javascript"><!--
			document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
			//--></script>
			<noscript>
			<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
			</noscript>
<?php
}
// BOF: More Pics 6
	if (MOPICS_TABLE_LOCATION=='above') {
	  echo '          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="center" class="smallText">'.$mopics_output.'</td>
            </tr>
          </table>
		  &nbsp;<br>'."\n";
	} else if (MOPICS_TABLE_LOCATION=='sides') {
	  echo $mopics_output;
	}
// EOF: More Pics 6
?>
</td>
</tr>
</table>
<!-- //FSK 18 EOF //--->
<?php // #################### START Qauntity images and text unlimited ############# ?>
<table border="<?php echo CENTER_SHOP_AMPELWITH; ?>" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="<?php echo CENTER_SHOP_AMPELRAHMEN; ?> width="110" id="AutoNumber1">
  <tr>
<td width="110" BGCOLOR="<?php echo CENTER_SHOP_AMPELCOLOR; ?>">
    <p align="center" class="main"><font color="#FBF8F8">
        </font><?php
		if (SHOW_STOCK == 'true')
 if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
 $avail = sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available']));
  } else {
	  if (SHOW_STOCK == 'true')
   if ($product_info['products_quantity']<=0){
    $avail = tep_image(DIR_WS_ICONS . 'ampel_rot.gif', '', '21', '24', 'align="absmiddle"');
   } else {
    $prod_quantity = tep_get_products_stock($product_info['products_id']);
    switch ($prod_quantity) {
         case 1: $avail = tep_image(DIR_WS_ICONS . 'ampel_gelb.gif', '', '21', '24', 'align="absmiddle"');
         break;
         case 2: $avail = tep_image(DIR_WS_ICONS . 'ampel_gelb.gif', '', '21', '24', 'align="absmiddle"');
         break;
         default: $avail = tep_image(DIR_WS_ICONS . 'ampel_gruen.gif', '', '21', '24', 'align="absmiddle"');
    }
    }
 }
$a = $avail;
if (SHOW_STOCK == 'true')
 echo '<b>'. TEXT_QUANTITY_LIST .'</b><br>&nbsp;';
?>
<script language="javascript">
<!--
document.write('<?php echo '<a href="popup_lager.php" target="_blank">'. $a . '</a><br>'; ?>');
//-->
</script>
<noscript>
<?php echo '<a href="popup_lager.php" target="_blank">'. $a . '</a>';?>
</noscript>
<?php
if (SHOW_STOCK == 'true')
if ($product_info['products_quantity'] > 0) { ?>
<b><?php echo $product_info['products_quantity']; ?> <?php echo TEXT_PRODUCT_IN_STOCK; ?></b>
	<?php } else { ?>
<b><?php echo TEXT_PRODCUT_OUT_OF_STOCK; ?></b></font>: (<?php echo $product_info['products_quantity']; ?>)
<?php } ?>
</center>
</td>

<?php
if (ALLOW_ASK_QUESTION == 'true') {
echo '<span class="main"><a href="' . tep_href_link(FILENAME_ASK_QUESTION, 'products_id=' . $product_info['products_id']) . '">' . tep_image(DIR_WS_IMAGES.'') . ' ' . TEXT_FRAGEN_ZUM_PRODUKT . '</a></span>'; } else {
}
?>



<?php
if (ALLOW_DRUCKANSICHT == 'true') {
 echo '<BR><span class="main"><a href="' . tep_href_link(FILENAME_PRODUCT_PRINT, 'products_id=' . $product_info['products_id']) .'" target="_BLANK">' . tep_image(DIR_WS_IMAGES.'') . ' ' . TEXT_DRUCKANSICHT .'</a></span> ';
}
?>

<?php
if (SHOW_PDF_DATA == 'true') {
echo '<BR><span class="main"><a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info['products_id']) .'" target="_blank">' . tep_image(DIR_WS_IMAGES.'') . ' ' . TEXT_PDF_DATENBLATT .'</a></span>';
}
?>
</tr>
</table>
<?php // #################### START Qauntity images and text unlimited ############# ?>
<p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
    $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
    $products_attributes = tep_db_fetch_array($products_attributes_query);
    if ($products_attributes['total'] > 0) {
?>
          <table border="0" cellspacing="0" cellpadding="2">
            <tr>
              <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
            </tr>
<?php
			//clr 030714 update query to pull option_type
      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
				//clr 030714 add case statement to check option type
        switch ($products_options_name['products_options_type']) {
          case PRODUCTS_OPTIONS_TYPE_TEXT:
            //CLR 030714 Add logic for text option
            $products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
            $products_attribs_array = tep_db_fetch_array($products_attribs_query);
            $tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'] ;
            if ($products_attribs_array['options_values_price'] != '0') {
              $tmp_html .= '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')';
            }
?>
            <tr>
              <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
              <td class="main"><?php echo $tmp_html;  ?></td>
            </tr>
<?php
            break;
			
          case PRODUCTS_OPTIONS_TYPE_TEXTAREA:
            //CLR 030714 Add logic for text option
            $products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
            $products_attribs_array = tep_db_fetch_array($products_attribs_query);
		$tmp_html = '<textarea onKeyDown="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
								   onKeyUp="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
								   onFocus="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
								   wrap="soft" 
								   name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
								   rows=5 
								   id="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
								   value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . '"></textarea>
						<div id="progressbar' . $products_options_name['products_options_id'] . '" class="progress"></div>
						<script>textCounter(document.getElementById("id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"),"progressbar' . $products_options_name['products_options_id'] . '",' . $products_options_name['products_options_length'] . ')</script>';?>	<!-- DDB - 041031 - Form Field Progress Bar //-->
            <tr>
<?php
            if ($products_attribs_array['options_values_price'] != '0') {
?>
              <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ' ' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ')'; ?></td>
<?php       } else {
?>
              <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ')'; ?></td>
<?php        }
?>
              <td class="main"><?php echo $tmp_html;  ?></td>
            </tr>
<?php
            break;
			
          case PRODUCTS_OPTIONS_TYPE_RADIO:
            //CLR 030714 Add logic for radio buttons
            $tmp_html = '<table>';
            $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");
            $checked = true;
            while ($products_options_array = tep_db_fetch_array($products_options_query)) {
              $tmp_html .= '<tr><td class="main">';
              $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
              $checked = false;
              $tmp_html .= $products_options_array['products_options_values_name'] ;
              $tmp_html .=$products_options_name['products_options_comment'] ;
              if ($products_options_array['options_values_price'] != '0') {
                $tmp_html .= '(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')&nbsp';
              }
              $tmp_html .= '</tr></td>';
            }
            $tmp_html .= '</table>';
?>
            <tr>
              <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
              <td class="main"><?php echo $tmp_html;  ?></td>
            </tr>
<?php
            break;
          case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
            //CLR 030714 Add logic for checkboxes
            $products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
            $products_attribs_array = tep_db_fetch_array($products_attribs_query);
            echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">';
            echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);
            echo $products_options_name['products_options_comment'] ;
            if ($products_attribs_array['options_values_price'] != '0') {
              echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')&nbsp';
            }
            echo '</td></tr>';
            break;
          default:
            //clr 030714 default is select list
            //clr 030714 reset selected_attribute variable
            $selected_attribute = false;
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort");
        while ($products_options = tep_db_fetch_array($products_options_query)) {
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          if ($products_options['options_values_price'] != '0') {
        $products_options_array[sizeof($products_options_array)-1]['text'] .= ' ('

        . $products_options['price_prefix']

        . $currencies->display_price2(

	    $products_options['options_values_price'],

            tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
    }

        }
        if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
          $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
        } else {
          $selected_attribute = false;
        }
?>
            <tr>
              <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
              <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute, "onChange='showPrice(this.form);'") . $products_options_name['products_options_comment'];  ?></td>
             <tr>
</tr>
<?php
        }  //clr 030714 end switch
      } //clr 030714 end while
?>
          </table>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td class="smallText"><b><div id="productNEWprice"></div></td></tr>
<?php
    }
// BOF: More Pics 6
	if (MOPICS_TABLE_LOCATION=='below') {
	  echo '&nbsp;<br>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="center" class="smallText">'.$mopics_output.'</td>
            </tr>
          </table>'."\n";
	}
// EOF: More Pics 6
?>
    </td>
      </tr>
<?php
    $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
    $reviews = tep_db_fetch_array($reviews_query);
    if ($reviews['count'] > 0) {
?>

      <tr>
        <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
    }
// Simple Price Break
    if (tep_not_null($product_info['products_discount'])) {
	  if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {
	    $first = true;
		$last = false;
		$tab_aff = array();
		echo '<tr><td><table><tr><td>';
		$info_box_contents = array();
    	$info_box_contents[] = array('text' => '<span class="productSpecialPrice">' . TEXT_HEAD_REDUC_QTY . '</span>' );
        if( $tranche = explode( ',', $product_info['products_discount'] ) ) {
		  $index = 0;
	      foreach( $tranche as $cle => $trn )
	        if( $qty_px = explode( ':', $trn ) ) {
			  $tab_aff[$index][0] = $qty_px[0];
			  $tab_aff[$index][1] = $qty_px[1];
			  $index++;
	        }
		  $new_price = tep_get_products_special_price($product_info['products_id']);
		  for( $i=0; $i<$index; $i++) {
			if( $new_price > $tab_aff[$i][1] || $new_price==0 ) $products_price = $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));
			else $products_price = '<s>' . $currencies->display_price($tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

		    if( $i==0 ) {
			  if ( $new_price )	$products_price_1 = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
              else $products_price_1 = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
			  $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1  );
			  if( isset($tab_aff[$i+1][0]) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price );
			  else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
			}  
			elseif ( $i == ($index-1) ) $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX_LAST, $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_price );
			else $info_box_contents[] = array('align' => 'center', 'text' => sprintf( TEXT_QTY_PRIX, $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_price  );
		  }	
	    }
		new infoBox($info_box_contents);
		echo '</td></tr></table></td></tr>';
	  }
?>
       </td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
    }
// Simple Price Break

    if (tep_not_null($product_info['products_url'])) {
?>
      <tr>
        <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
    }
    if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
      <tr>
        <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
      </tr>
<?php
    } else {
?>
      <tr>
        <td align="center" class="smallText"><?php
if (SHOW_PRODUCT_ADDED == 'true')
echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
      </tr>
<?php
    }
?>

      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="Contents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<?php
     $back = sizeof($navigation->path)-2;
     if (isset($navigation->path[$back])) {
?>
    <td class="main" align="left"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
<?php
   }
?>
<td class="main" align="center"><?php
if (SHOW_REVIEW_BUTTON == 'true')
echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a></td><td><a href="' . tep_href_link(FILENAME_PREISALARM, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_image_button('button_preisalarm.gif', IMAGE_BUTTON_PREISALARM) . '</a>'; ?></td>
<?php

?>
               <?php  
$currentid = $HTTP_GET_VARS['products_id'];
$family_query = tep_db_query("select products_family from " . TABLE_PRODUCTS . " where products_id='" . $HTTP_GET_VARS['products_id'] . "'");
$results = tep_db_fetch_array($family_query);
?>
                <td class="main" align="right">
<?php
//  FSK 18
if ($product_info['products_fsk_18'] == 1) {
	if (tep_session_is_registered('customer_id')) {
		if ($customer['customers_fsk_18'] == 1) {
			if ($results['products_family']=== '')
			if (ALLOW_BUTTON_IN_CART == 'true')
			echo 'Menge: ' . tep_draw_input_field('quantity', '1', 'SIZE=5 maxlength=6') . tep_draw_separator('pixel_trans.gif', '5', '1') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle');
		} else {
			echo '<br><b>' . CUSTOMER_FSK_TEXT . '</b>';
		}
	}
} else {
	if ($results['products_family']=== '')
	if (ALLOW_BUTTON_IN_CART == 'true')
	echo 'Menge: ' . tep_draw_input_field('quantity', '1', 'SIZE=5 maxlength=6') . tep_draw_separator('pixel_trans.gif', '5', '1') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle');
}
  }
//  FSK 18 EOF
	?>
</td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
	  <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td>
<?php
$currentid = $HTTP_GET_VARS['products_id'];
$family_query = tep_db_query("select products_family from " . TABLE_PRODUCTS . " where products_id='" . $HTTP_GET_VARS['products_id'] . "'");
$results = tep_db_fetch_array($family_query);
if ($results['products_family'] != '') {
      include(DIR_WS_MODULES . FILENAME_FAMILY_PRODUCTS);
}
?>
</td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td>
<?php
//added for cross -sell
   if ( (USE_CACHE == 'true') && !SID) {
    echo tep_cache_also_purchased(3600);
     include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);
   } else {
     include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);
      include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
    }
   }
//FSK18
}
//FSK 18 EOF
// BOF: This is the buy_two_module and if there is a wording in the beginning of the produkt model text then

// this will not appear because it makes no sense to bundle a bundle and so on...

if (BUY_TWO_YES_NO == 'yes') {

 

if (ereg('^'.BUY_TWO_BUNDLE_MODEL_NAMING.'_', $product_info['products_model'])) {

//        echo 'TEST this is a bundle';

       } else {

 

                        include(DIR_WS_MODULES . 'buy_two_module.php');

                       

       }

} else {

}

// buy_two_module EOF


?>
        </td>
      </tr>
<center>
<tr>
<td class="bigText">
<?php 
  $search_string_array = explode(" ",$product_info['products_name']);
  foreach($search_string_array AS $search_entry) {
    if(strlen($search_entry) > 3) {
      $search_entry = ereg_replace("[^a-z0-9]", "", strtolower($search_entry));
      $search_string .= '<a href="'.tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT,'keywords='.$search_entry).'">'.$search_entry.'</a>&nbsp;';
    }
  }
  echo 'Suchen Sie auch nach: '.$search_string;
?>
</td>
</tr>
</center>
    </table></form></td>
<!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH_RIGHT_IS; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH_RIGHT_IS; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
