<!-- indi:content_item -->

{assign var=item_debug value=false}
{assign var=item_has_variants value=false}

{assign var=preis_praefix value=""}
{assign var=new_price value=""}
{if $shopArticle->schema_data->selectable_attribute_1 || $shopArticle->schema_data->selectable_attribute_2}
	{assign var=preis_praefix value="ab"}
	{foreach from=$shopArticle->schema_data_attributes item=attribute}
		{if $shopArticle->schema_data->selectable_attribute_1 == $attribute.number}
			{assign var=att_name_1 value="`$attribute.name`"}
			{assign var=att_unit_1 value="`$attribute.unit`"}
		{/if}
	{/foreach}

	{foreach from=$shopArticle->schema_data_attributes item=attribute}
		{if $shopArticle->schema_data->selectable_attribute_2 == $attribute.number}
			{assign var=att_name_2 value="`$attribute.name`"}
			{assign var=att_unit_2 value="`$attribute.unit`"}
		{/if}
	{/foreach}
{/if}

<div class="content_item {if $shopArticle->files|@count < 2}one_image{/if}">
	<div id="item_content1">
		<div id="back_button">{$template_text.item_details.button_back}</div>
		<div class="title_wrapper">
			<div class="item_title">
				<h1>
					{if !$user_lang || $user_lang == $system_configuration.default_system_language || !$shopArticle->name}
						{$shopArticle->name}
					{else}
						{$shopArticle->name_en}
					{/if}
					{if $shopArticle->manufacturer_data->name}
						| <span class="manufacturer_name">
							von  {$shopArticle->manufacturer_data->name}
						</span>
					{/if}
				</h1>
			</div>
			{if $shopArticle->number}
				<span class="item_number">
					{$template_text.item_details.item_number} 
					{if $shopArticle->attribute_7 && $shopArticle->number != $shopArticle->attribute_7}
						<span class="item_number_number">{$shopArticle->attribute_7}
							&nbsp;&nbsp;&nbsp;<span style="font-weight:normal;">({$template_text.item_details.old_item_number_title} {$shopArticle->number})</span>
					{else}
						<span class="item_number_number">{$shopArticle->number}
					{/if}
					</span>
					
				</span>
			{/if}
		</div>


		<div class="image_wrapper">
			{if isset($shopArticle->files[0]) && $shopArticle->files[0]->file_name}
				<div id="image_detailed_container_outer">
					<div id="image_detailed_container_middle">
						<div id="image_detailed_container_inner">
							{foreach item=file from=$shopArticle->files}
								<a title="{$file->alt}" class="detailImage" href="{$SHOP_DIR}images/article/{$file->file_name}" rel="lightbox-big" title="{$shopArticle->name}" style="background-image: url({$SHOP_DIR}images/article/details_{$file->file_name})"></a>
							{/foreach}
						</div>
					</div>

					<a href="#zurueck" id="image_detailed_backward" title="Zurück"></a>
					<a href="#vor" id="image_detailed_forward" title="Vor"></a>
				</div>
			{/if}
			{if $shopArticle->files|@count > 1}
				<div id="item_thumb_slider_wrapper">
					<div id="item_thumbs_title">Weitere Artikelbilder</div>
					<div id="thumbContainer">
						<div id="thumbScrollContainer" style="width:{if $shopArticle->files|@count > 3}{$shopArticle->files|@count|ceil*141}{else}423{/if}px;">
							{foreach item=file name=loop_thumbs from=$shopArticle->files}
								<a class="thumbimage" href="{$SHOP_DIR}images/article/{$file->file_name}" rel="lightbox-small" title="{$file->alt}" style="background-image: url({$SHOP_DIR}images/article/thumb_{$file->file_name});"></a>
								{if !$smarty.foreach.loop_thumbs.last}<div class="last_thumb_image"></div>{/if}
							{/foreach}
							<br class="clear_left" />
						</div>
					</div>
					{if $shopArticle->files|@count > 3}
						<input id="thumbSlideLeft" class="thumbSlider" type="button" value="" />
						<input id="thumbSlideRight" class="thumbSlider" type="button" value="" />
					{/if}
				</div>
			{/if}
		</div>
		<form method="post" id="item_buy_form">
			<div class="item_box_right_wrapper">

				{if $shopArticle->schema_data->selectable_attribute_1 || $shopArticle->schema_data->selectable_attribute_2 || $item_debug}
					{assign var=item_has_variants value=true}

					<div id="manufacturer_wrapper">
						<div class="title_manufacturer">Auswahl der Artikelvariante</div>
						<!-- Variant selection -->
						<div class="variants_box">
							{assign var=new_price value=""}
							{if $shopArticle->schema_data->selectable_attribute_1 || $shopArticle->schema_data->selectable_attribute_2}
								<div class="item_variant_box">
									<div class="box_title">
										<span class="button_name">Bitte w&auml;hlen Sie eine passende Variante</span>
									</div>
									<div class="widget_menu_arrow"></div>
								</div>
								<div class="variant_selection_box">
									{foreach item=item name=cartLoop from=$shopArticle->variant_structure}
                                                                            {if $item->id != $shopArticle->id}
										{if !$new_price || $new_price > $item.shop_price_1}
											{assign var=new_price value=$item.shop_price_1}
										{/if}
										{if $shopArticle->id == $item.id}
											{assign var=preis_praefix value=""}
										{/if}


										{if $item.short_uri}
											{assign var=useUri value="`$item.short_uri`.html"}
										{else}
											{assign var=useUri value="/index.php?item_id=`$item.id`"}
										{/if}

										<a href="{$useUri}" title="{$item.name}">
											<div class="variant_item">
												<span class="item_name">{$item.name}</span>
												<span class="item_number">{$item.number}</span>

												<span class="item_vdata">
													{if $shopArticle->schema_data->selectable_attribute_1}
														{$att_name_1}: {$item.data->attribute_1} {$att_unit_1}<br>
													{/if}
													{if $shopArticle->schema_data->selectable_attribute_2}
														{$att_name_2}: {$item.data->attribute_2} {$att_unit_2}<br>
													{/if}
												</span>

												<div class="variant_item_image" style="background:#ffffff url({$SHOP_DIR}/images/article/thumb_{if $item.default_image_file_name}{$item.default_image_file_name}{else}default_image.png{/if}) center center no-repeat;"></div>

												<span class="item_price">
													{if $item.price_type != 0}
														{if $item.sample_price}
															{$item.sample_price|number_format:"2":",":"."} &euro; / {$shopArticle->sample_unit}
														{else}
															{$item.shop_price_1|number_format:"2":",":"."} &euro;
														{/if}
													{/if}
												</span>
											</div>
										</a>
                                                                                {/if}
									{/foreach}
								</div>
							{/if}			
						</div>
					</div>
				{/if}		

				{if $shopArticle->shop_bargain_price_1 > 0 || $item_debug}
					<div id="spezial_price_icon"></div>
				{/if}

				{if ($shopArticle->graduated_prices|is_array && $shopArticle->graduated_prices || $item_debug)}
					{assign var=itemHasGraduatedPrices value=true}
				{else}
					{assign var=itemHasGraduatedPrices value=false}
				{/if}

				<div id="price_box_wrapper" class="price_box_wrapper {if $item_has_variants}price_box_wrapper_with_variants{/if} {if $itemHasGraduatedPrices}price_box_wrapper_with_graduated_prices{/if}">
					<div class="title_price">{$template_text.default.price}</div>

					<div class="register_buy">
						<div class="shippable_wrapper">
							<div>
								<span class="shippable_state">
									{if $shopArticle->inventory > 0}
										{if $shopArticle->shippable_inventory == 0}
											<span class="notAvailable">&bull; Artikel nicht lieferbar</span>
										{elseif $shopArticle->shippable_inventory == 1}
											&bull; {*Artikel lieferbar*}{if $shopArticle->attribute_14 == ''}{$template_text.item_details.item_state_available}{else}{$shopArticle->attribute_14}{/if}
										{elseif $shopArticle->shippable_inventory == 3}
											&bull; Artikel Lieferzeit unbekannt
										{elseif $shopArticle->shippable_inventory == 4}
											&bull; Bestellartikel (Lieferzeit 2-3 Tage)
										{elseif $shopArticle->shippable_inventory == 5}
											&bull; Bestellartikel (Lieferzeit 14 Tage)
										{/if}
									{else}
										{if $shopArticle->shippable == 0}
											<span class="notAvailable">&bull; Artikel nicht lieferbar</span>
										{elseif $shopArticle->shippable == 1}
											&bull; {*Artikel lieferbar*}{if $shopArticle->attribute_14 == ''}{$template_text.item_details.item_state_available}{else}{$shopArticle->attribute_14}{/if}
										{elseif $shopArticle->shippable == 2 && $shopArticle->available_from && $shopArticle->available_till != '0000-00-00'}
											<span class="availableInRange">&bull; Artikel lieferbar vom {$shopArticle->available_from|date_format:"%d.%m.%Y"} bis {$shopArticle->available_till|date_format:"%d.%m.%Y"}</span>
										{elseif $shopArticle->shippable == 2 && $shopArticle->available_from}
											<span class="availableInRange">&bull; Artikel lieferbar ab {$shopArticle->available_from|date_format:"%d.%m.%Y"}</span>
										{elseif $shopArticle->shippable == 3}
											<span class="availableInRange">&bull; Lieferzeit unbekannt</span>
										{elseif $shopArticle->shippable == 4}
											&bull; Bestellartikel (Lieferzeit 2-3 Tage)
										{elseif $shopArticle->shippable == 5}
											&bull; Bestellartikel (Lieferzeit 14 Tage)
										{/if}
									{/if}
								</span>
								<br>

								{if $shopArticle->inventory > 0 || $item_debug}
									<span class="shippable_text">
										Auf Lager
									</span>
									<br>
								{/if}

								{if $shopArticle->min_quantity && $shopArticle->min_quantity > 1 || $item_debug}
									<span class="min_quantity">
										Mindestabnahmemenge: {$shopArticle->min_quantity}
										Einheit{if $shopArticle->min_quantity != 1}en{/if}
									</span>
								{/if}
							</div>
						</div>


						<!-- content_item/graduated_prices.tpl begin --> 
						{if $itemHasGraduatedPrices && $shopArticle->price_type == "1"}
							<div id="graduated_price_wrapper">
								<div class="graduated_price_title_wrapper">
									<div id="graduated_price_title">Staffelpreise</div>
									<div class="graduated_price_title_arrow"></div>
								</div>

								<div id="graduated_price_content">
									<table class="graduatedPrices" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td>
												&nbsp;ab <strong>1</strong>
												{if $shopArticle->price_je_vpe}
													VPE | {$shopArticle->vpe_amount} {$shopArticle->vpe_unit}
												{else}
													{*St.*}{$shopArticle->attribute_10}
												{/if}
											</td>
											{if $shopArticle->shop_bargain_price_1 > 0 || $item_debug}
												<td class="bargain_price_old">
													&nbsp;
												</td>
												<td class="bargain_price_new">
													{if !$no_prices || $item_debug}
														{$shopArticle->shop_bargain_price_1|number_format:"2":",":"."} &euro; / {if $shopArticle->price_je_vpe}VPE{else}{*St.*}{$shopArticle->attribute_10}{/if}
														{if $shopArticle->sample_price && $shopArticle->sample_unit && $shopArticle->sample_price > 0 || $item_debug}
															<br /><span class="bargain_sample_price">Preis/{$shopArticle->sample_unit} = {$shopArticle->sample_price|number_format:"2":",":"."} &euro;</span>
														{/if}
													{else}
														{*Preis nach Login!*}
													{/if}
												</td>
											{else}
												<td></td>
												<td class="price_normal">
													{if !$no_prices || $item_debug}
														{$shopArticle->shop_price_1|number_format:"2":",":"."} &euro; / {if $shopArticle->price_je_vpe}VPE{else}{*St.*}{$shopArticle->attribute_10}{/if}
														{if $shopArticle->sample_price && $shopArticle->sample_unit && $shopArticle->sample_price > 0 || $item_debug}
															<br /><span class="normal_sample_price">Preis/{$shopArticle->sample_unit} = {$shopArticle->sample_price|number_format:"2":",":"."} &euro;</span>
														{/if}
													{else}
														{*Preis nach Login!*}
													{/if}
												</td>
											{/if}
											<td class="price_center">
												{if $shopArticle->shippable != 0 || $item_debug}
													<input class="graduatedCart" rel="1" bargain_price="{$shopArticle->shop_bargain_price_1|number_format:"2":",":"."}" price="{$shopArticle->shop_price_1|number_format:"2":",":"."}" sample_price="{$shopArticle->sample_price|number_format:"2":",":"."}" type="button" value="" />

												{/if}
											</td>
										</tr>

										{foreach item=gradPrice name=price_loop key=quantity from=$shopArticle->graduated_prices}
											{if $quantity > 0}
												{if $smarty.foreach.price_loop.iteration == 11}
													{break}
												{/if}
												<tr>
													<td>
														&nbsp;ab <strong>{$quantity}</strong>
														{if $shopArticle->price_je_vpe}
															VPE | {$shopArticle->vpe_amount * $quantity} {$shopArticle->vpe_unit}												
														{else}
															{*St.*}{$shopArticle->attribute_10}
														{/if}
													</td>
													{if $gradPrice.bargain > 0 || $item_debug}
														<td class="bargain_price_old">
															&nbsp;
															{*
															{if !$no_prices || $item_debug}
																{$gradPrice.price|number_format:"2":",":"."} &euro; / {if $shopArticle->price_je_vpe}VPE{else}St.{/if}
															{else}
																Preis nach Login!
															{/if}
															*}
														</td>
														<td class="bargain_price_new">
															{if !$no_prices || $item_debug}
																{$gradPrice.bargain|number_format:"2":",":"."} &euro; / {if $shopArticle->price_je_vpe}VPE{else}{*St.*}{$shopArticle->attribute_10}{/if}
																{if $shopArticle->sample_price && $shopArticle->sample_unit && $shopArticle->sample_price > 0 || $item_debug}
																	<br /><span class="bargain_sample_price">Preis/{$shopArticle->sample_unit} = {$gradPrice.samplePrice|number_format:"2":",":"."} &euro;</span>
																{/if}
															{else}
																{*Preis nach Login!*}
															{/if}
														</td>
													{else}
														<td></td>
														<td class="price_normal">
															{if !$no_prices || $item_debug}
																{$gradPrice.price|number_format:"2":",":"."} &euro; / {if $shopArticle->price_je_vpe}VPE{else}{*St.*}{$shopArticle->attribute_10}{/if}
																{if $shopArticle->sample_price && $shopArticle->sample_unit && $shopArticle->sample_price > 0 || $item_debug}
																	<br /><span class="normal_sample_price">Preis/{$shopArticle->sample_unit} = {$gradPrice.samplePrice|number_format:"2":",":"."} &euro;</span>
																{/if}
															{else}
																{*Preis nach Login!*}
															{/if}
														</td>
													{/if}
													<td class="price_center">
														{if $shopArticle->shippable != 0 || $item_debug}
															{*<input type="hidden" value="{$quantity}" name="amount" />*}
															<input class="graduatedCart" rel="{$quantity}" bargain_price="{$gradPrice.bargain|number_format:"2":",":"."}" price="{$gradPrice.price|number_format:"2":",":"."}" sample_price="{$gradPrice.samplePrice|number_format:"2":",":"."}" type="button" value="" />

														{/if}
													</td>
												</tr>
{*												{if !$smarty.foreach.price_loop.last}
													<tr>
														<td class="last_price" colspan="9"></td>
													</tr>
												{/if}
*}											{/if}
										{/foreach}
									</table>
									
									<div class="price_infotext">
										{include 'content_item/item_pricetext.tpl'}
									</div>
								</div>
							</div>
						{/if}
						<!-- content_item/graduated_prices.tpl end --> 



						<div id="error_message_one">
							<div class="close_message_box">x</div>
							<div class="content">Mindestabnahmemenge von {$shopArticle->min_quantity} St&uuml;ck nicht erreicht!</div>
						</div>

						<div id="error_message_two">
							<div class="close_message_box">x</div>
							<div class="content">Sie haben eine ung&uuml;ltige St&uuml;ckzahl eingegeben! Die Abnahmest&uuml;ckzahl ist in {$shopArticle->buy_quantity}er Schritten gestaffelt!</div>
						</div>


						<div class="priceInfoBox">
							{if !$no_prices}

								{if $shopArticle->price_type == "1"}
									{if $shopArticle->shop_bargain_price_1 > 0 || $item_debug}
										<span class="old_price">
											{*{$preis_praefix} {$shopArticle->shop_price_1|number_format:"2":",":"."} &euro;*}
										</span>
										<span class="price">{if $preis_praefix}<span class="item_vpe">{$shopArticle->attribute_10}</span>{$preis_praefix} {$new_price|number_format:"2":",":"."} &euro;{else}<span class="item_vpe">{$shopArticle->attribute_10}</span>{$shopArticle->shop_bargain_price_1|number_format:"2":",":"."} &euro;{/if}</span>
									{else}
										<span class="old_price"></span>
										<span class="price">{if $preis_praefix}{$preis_praefix} {$new_price|number_format:"2":",":"."} &euro;{else}<span class="item_vpe">{$shopArticle->attribute_10}</span> {$shopArticle->shop_price_1|number_format:"2":",":"."} &euro;{/if}</span>
									{/if}
									<div class="price_text">
                                                                       
                                                                                                    {include 'content_item/item_pricetext.tpl'}
									</div>

									{if $shopArticle->shippable != 0 && (!$shopArticle->schema_data->selectable_attribute_1 || ($shopArticle->schema_data->selectable_attribute_1 && $shopArticle->parent_id))}
                                                                                <input class="amountbox" type="text" value="{if $shopArticle->min_quantity && $shopArticle->min_quantity > 1}{$shopArticle->min_quantity}{else}1{/if}" name="amount" />
										<div class="item_factor">Anzahl - {$shopArticle->attribute_10}</div>
                                                                                <input class="cartbutton" id="item_cart_button" type="button"  value="In den Warenkorb legen" />
										<input type="hidden" name="buy_quantity" id="input_buy_quantity" value="{$shopArticle->buy_quantity}" />
										<input type="hidden" name="min_quantity" id="input_min_quantity" value="{$shopArticle->min_quantity}" />
									{/if}


									<!-- klarna installments --> 
									{if $klarna_installments}
										<div id="klarna_installments_wrapper">
											<h4>Zahlung in Raten</h4>

											<img id="item_klarna_logo" src="{$THEME_DIR}/media/images/klarna_small_130px.png" alt="klarna logo" />

											<p id="installment_text">Die monatliche Rate
												<span id="klarna_installment_rate_target">
													ab
													<span id="installment_currency">&euro;</span>
													{foreach $klarna_installments as $installment}
														<span id="klarna_{$installment.months}_months" class="installment_value" {if !$installment@first}style="display:none;"{/if}>{$installment.monthly_costs|number_format:2:',':" "}</span>
													{/foreach}
												</span>
											</p>
											<br>
											<a id="more_klarna_info" href="">Lesen Sie mehr!</a>
										</div>
									{/if}
								{else if $shopArticle->price_type == "0"}
									<span class="price"><span class="price_auf_anfrage">Preis auf Anfrage</span></span>
								{/if}
							{else}
								{*<span class="price price_after_login">Preis nach Login</span>*}
							{/if}

						</div>

					</div>

					<div class="item_banner"></div>
				</div>
			</div>
		</form>

		<div class="button_box_wrapper">
			<form method="post">
				<input type="hidden" name="memorize" value="true" />
				<input type="submit" class="remember_button" value="{$template_text.item_details.button_remember}" name="remember_button" />
			</form>
			<div title="Print" class="print_button">{$template_text.item_details.button_print}</div>
		</div>

	</div><!-- end content 1 -->

	<div id="item_content2">
		
		{include file="item_description.tpl"}
		
		{*{include file="{$FULL_PARENT_THEME_DIR}/templates/content_item/item_real_friends.tpl"}
		<br /><br />*
		{*{if $system_configuration.item_customer_opinion == 1}
		{include file="{$FULL_PARENT_THEME_DIR}/templates/content_item/item_opinion.tpl"}
		{/if}*}
		<script type="text/javascript">
			var ItemsMax = 0;
		</script>
		<br /><br /><br />	 
	</div>

</div>
{*
<div id="klarna_payment_info_popup" style="display: none; background-color: rgb(255, 255, 255); border: 1px solid black; width: 500px; position: absolute; top: 1px; z-index: 99999; padding: 10px;">
<iframe id="klarna_iframe" frameborder="0" style="border: 0pt none; width: 500px; height: 660px;" src="https://online.klarna.com/account_de.yaws?eid=13862"></iframe>
<a title="close" class="close" href="#" style="color: rgb(0, 0, 0);">Schliessen</a>
</div>
*}		
<script type="text/javascript" src="/libs/star-rating/jquery.MetaData.js"></script>
<script type="text/javascript" src="/libs/star-rating/jquery.rating.js"></script>
<script src="{$PARENT_THEME_DIR}/media/js/content_item.js?v=99455468"></script>

<script type="text/javascript">
			var variants = [];
			var var2 = [];
	{foreach from=$shopArticle->variant_structure item=variant}
			var2['{$variant.variant_key1_md5}'] = {
				'id': '{$variant.id}',
				'attr2': '{$variant.variant_key2_md5}'
			};

			variants.push({
				'id': '{$variant.id}',
				'attr1': '{$variant.variant_key1_md5}',
				'attr2': '{$variant.variant_key2_md5}'
			});
	{/foreach}

			$('#graduated_price_content').slideToggle(0);
                                                
</script>


<br /><br />


