<?php
/*
 * Template Name: Scancube test page
 */

	// Setup globals
	// @todo: Get these out of template
	global $wp_query;
	global $wpdb;

	// Setup image width and height variables
	// @todo: Investigate if these are still needed here
	$image_width  = get_option( 'single_view_image_width' );
	$image_height = get_option( 'single_view_image_height' );
?>

<?php $categories = wp_get_object_terms( $wp_query->post->ID , 'wpsc_product_category' );
		
		
		if(count($categories) > 1 && isset($wpsc_query->query_vars['wpsc_product_category']))
				$query_data['category'] = $wpsc_query->query_vars['wpsc_product_category'];
			elseif(count($categories) > 0)
				$query_data['category'] = $categories[0]->slug;
				
						
				if( isset( $query_data['category'] ) )
			$term_data = get_term_by('slug', $query_data['category'], 'wpsc_product_category');
		else
			$term_data = get_term_by('slug', 'uncategorized', 'wpsc_product_category');
			
			
			$catname=$term_data -> name;
			$catslug=$term_data->slug;
					
 ?>

<a id="retour-icon" href="<?php echo '/boutique/'.$catslug; ?>">
								<span id="retour-au-catalogue">Retour à la <?php echo $catname; ?></span></a>
<div id="single_product_page_container">
	<?php
		// Breadcrumbs
		wpsc_output_breadcrumbs();

		// Plugin hook for adding things to the top of the products page, like the live search
		do_action( 'wpsc_top_of_products_page' );
	?>
	<span id="single_prod_choose_title" ><?php echo wpsc_the_product_title(); ?></span>
	<div class="clear"></div>
	<div class="single_product_display group">
<?php
		/**
		 * Start the product loop here.
		 * This is single products view, so there should be only one
		 */

		while ( wpsc_have_products() ) : wpsc_the_product(); ?>
		
					<div class="imagecol">
						<?php if ( wpsc_the_product_thumbnail() ) : ?>
								<a rel="<?php echo wpsc_the_product_title(); ?>" class="MagicZoom" href="<?php echo wpsc_the_product_image(); ?>"> 
									
									<?php echo get_the_post_thumbnail(wpsc_the_product_id(),'medium',array('alt' => wpsc_the_product_title(),'title' => wpsc_the_product_title() ));?>
								</a>
								<div id="additional_images" style="width:400px; clear:both;">
								<ul>		
					<?php /* Get current product image attachments, exclude the featured image */
					
					$args = array(
						'post_type' => 'attachment',
						'numberposts' => null,
						'post_status' => null,
						'post_parent' => $post->ID,
						'exclude'     => get_post_thumbnail_id()
					); 
					$attachments = get_posts($args);
					
					if ($attachments) {
						foreach ($attachments as $attachment) {
							echo "<li><a rel='lightbox' href='";
							echo wp_get_attachment_url( $attachment->ID);
							echo "'>";
							echo wp_get_attachment_image($attachment->ID, array(108,108));
							echo "</a></li>";
							//print_R (wp_get_attachment_image_src( $attachment->ID));
						}
					} ?></ul></div>
						<?php else: ?>
									<a href="<?php echo wpsc_the_product_permalink(); ?>">
									<img class="no-image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="No Image" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo WPSC_CORE_THEME_URL; ?>wpsc-images/noimage.png" width="<?php echo get_option('product_image_width'); ?>" height="<?php echo get_option('product_image_height'); ?>" />
									</a>
						<?php endif; ?>
					</div><!--close imagecol-->

					<div class="productcol">			
						<?php do_action('wpsc_product_before_description', wpsc_the_product_id(), $wp_query->post); ?>
						<div class="product_description">
							Description: <div class="p-inside-is-inline"><?php echo wpsc_the_product_description(); ?></div>
							<div class="clear"></div>
							<br>
							Modèle: <span id="choosen_modele">
							<?php get_post_meta($post->ID, iwb_product_model, true );
							echo get_the_title(get_post_meta( $post->ID, iwb_product_model, true ) ); ?>
							</span>
							<!--<br>
							Taille: <span id="choosen_size"><font color="#ff0000">'il vous plaît choisir la taille</font></span>
							<br>-->
							<div class="clear"></div>
							<span class="line-height-30">Couleur:</span> 
							<!--
							<a href="#" onclick="return false;" class="color-texture"></a>
							-->
							<span id="choosen_color" class="line-height-30">
							<?php 	
								echo get_the_title( get_post_meta( $post->ID, product_color, true ) );

							?>
							</span>

							<style>
							.color-texture{
								display: block;
								float: left;
						      	height: 30px;
						      	width: 30px;
						      	margin-right: 10px;
						      	-webkit-border-radius: 15px;
						      	-moz-border-radius: 15px;
						      	border-radius: 15px;
						      	overflow: hidden;
						      	border: 1px solid #eee;
						      	background: url(<?php print $texture_bg[0]; ?>) repeat left top;
					      	}
					      	.line-height-30{
					      		display: block;
					      		float: left;
					      		height: 30px;
					      		line-height: 30px;
					      		margin-right: 10px;
					      	}
					      	.p-inside-is-inline,
					      	.p-inside-is-inline p{
					      		display: inline;
					      	}
					      	</style>

					      	<div class="clear"></div>
						</div><!--close product_description -->
						<?php do_action( 'wpsc_product_addons', wpsc_the_product_id() ); ?>		
						<?php if ( wpsc_the_product_additional_description() ) : ?>
							<div class="single_additional_description">
								<p><?php echo wpsc_the_product_additional_description(); ?></p>
							</div><!--close single_additional_description-->
						<?php endif; ?>		
						<?php do_action( 'wpsc_product_addon_after_descr', wpsc_the_product_id() ); ?>
						<?php
						/**
						 * Custom meta HTML and loop
						 */
						?><?php /* ?>
                        <?php if (wpsc_have_custom_meta()) : ?>
						<div class="custom_meta">
							<?php while ( wpsc_have_custom_meta() ) : wpsc_the_custom_meta(); ?>
								<?php if (stripos(wpsc_custom_meta_name(),'g:') !== FALSE) continue; ?>
								<strong><?php echo wpsc_custom_meta_name(); ?>: </strong><?php echo wpsc_custom_meta_value(); ?><br />
							<?php endwhile; ?>
						</div><!--close custom_meta-->
                        <?php endif; ?>
						<?php */ ?>
						<?php
						/**
						 * Form data
						 */
						?>
						
						<form class="product_form" enctype="multipart/form-data" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="1" id="product_<?php echo wpsc_the_product_id(); ?>">
							<?php do_action ( 'wpsc_product_form_fields_begin' ); ?>
							<?php if ( wpsc_product_has_personal_text() ) : ?>
								<fieldset class="custom_text">
									<legend><?php _e( 'Personalize Your Product', 'wpsc' ); ?></legend>
									<p><?php _e( 'Complete this form to include a personalized message with your purchase.', 'wpsc' ); ?></p>
									<textarea cols='55' rows='5' name="custom_text"></textarea>
								</fieldset>
							<?php endif; ?>
						
							<?php if ( wpsc_product_has_supplied_file() ) : ?>

								<fieldset class="custom_file">
									<legend><?php _e( 'Upload a File', 'wpsc' ); ?></legend>
									<p><?php _e( 'Select a file from your computer to include with this purchase.', 'wpsc' ); ?></p>
									<input type="file" name="custom_file" />
								</fieldset>
							<?php endif; ?>	
						<?php /** the variation group HTML and loop */?>
						
                        <?php if (wpsc_have_variation_groups()) { ?>
						<div id="varijacije">
                        <fieldset id="choose_size"><legend style="font-weight: normal !important;"><?php _e('Cliquez sur une taille pour en connaître le prix:', 'wpsc'); ?></legend>
						<div class="wpsc_variation_forms">
                        	<table>
							<?php while (wpsc_have_variation_groups()) : wpsc_the_variation_group(); ?>
								<tr><td class="col1"><label for="<?php echo wpsc_vargrp_form_id(); ?>"><?php echo wpsc_the_vargrp_name(); ?>:</label></td>
								<?php /** the variation HTML and loop */?>
								<td class="col2">
								
								<?php 
									$IDproizvoda = wpsc_the_product_id();
																
									$results = $wpdb->get_results("SELECT * FROM `{$wpdb->posts}` WHERE post_parent='{$IDproizvoda}' AND post_type='wpsc-product'");
									
									$arrayvarijacija = array();
									
									foreach ($results as $result):  
										$noviarray = array(); 
											foreach($result as $item): 
												array_push($noviarray, $item);
											endforeach;
										array_push($arrayvarijacija, $noviarray[0]);
										unset($noviarray);
									 endforeach;  
									
									sort ($arrayvarijacija);
									
									foreach ($arrayvarijacija as $IDvarijacije):
										
										$meta_varijacije = get_post_meta($IDvarijacije, '_wpsc_product_metadata', true);
										$visina_varijacije = $meta_varijacije[dimensions][height];	
										
										$arraykombinovani [$IDvarijacije] = $visina_varijacije;
										
									endforeach;
									
									$varIDUnique = '$varIDUnique'.$IDproizvoda;
									$$varIDUnique = $wpdb->get_results("SELECT object_id FROM wpcdl_term_relationships WHERE term_taxonomy_id = '37'");
									foreach ($$varIDUnique as $varID):
										if (array_key_exists($varID->object_id, $arraykombinovani)) {
											$unique_height = '$unique_height'.$IDproizvoda;
											$$unique_height = $arraykombinovani [$varID->object_id];
										}	
									endforeach;
									
									$varIDTGrand = '$varIDTGrand'.$IDproizvoda;
									$$varIDTGrand = $wpdb->get_results("SELECT object_id FROM wpcdl_term_relationships WHERE term_taxonomy_id = '36'");
									foreach ($$varIDTGrand as $varID):
										if (array_key_exists($varID->object_id, $arraykombinovani)) {
											$tgrand_height = '$tgrand_height'.$IDproizvoda;
											$$tgrand_height = $arraykombinovani [$varID->object_id];
										}	
									endforeach;
									
									$varIDGrand = '$varIDGrand'.$IDproizvoda;
									$$varIDGrand = $wpdb->get_results("SELECT object_id FROM wpcdl_term_relationships WHERE term_taxonomy_id = '9'");
									foreach ($$varIDGrand as $varID):
									if (array_key_exists($varID->object_id, $arraykombinovani)) {
											$grand_height = '$grand_height'.$IDproizvoda;
											$$grand_height = $arraykombinovani [$varID->object_id];
										}	
									endforeach;
									
									$varIDMoyen = '$varIDMoyen'.$IDproizvoda;
									$$varIDMoyen = $wpdb->get_results("SELECT object_id FROM wpcdl_term_relationships WHERE term_taxonomy_id = '8'");
									foreach ($$varIDMoyen as $varID):
									if (array_key_exists($varID->object_id, $arraykombinovani)) {
											$moyen_height = '$moyen_height'.$IDproizvoda;
											$$moyen_height = $arraykombinovani [$varID->object_id];
										}	
									endforeach;
									
									$varIDPetit = '$varIDPetit'.$IDproizvoda;
									$$varIDPetit = $wpdb->get_results("SELECT object_id FROM wpcdl_term_relationships WHERE term_taxonomy_id = '7'");
									foreach ($$varIDPetit as $varID):
									if (array_key_exists($varID->object_id, $arraykombinovani)) {
											$petit_height = '$petit_height'.$IDproizvoda;
											$$petit_height = $arraykombinovani [$varID->object_id];
										}	
									endforeach;
									unset ($varIDUnique);
									unset ($varIDTgrand);
									unset ($varIDGrand);
									unset ($varIDMoyen);
									unset ($varIDMoyen);
									unset ($varIDPetit);
									unset ($arrayvarijacija);
									unset ($arraykombinovani);
									
									?>
								
								<?php while (wpsc_have_variations()) : wpsc_the_variation(); ?>
									<?php if (wpsc_the_variation_id() == 0) {
									} else { ?>									
									<label class="<?php echo wpsc_the_variation_name(); ?>" for="<?php echo wpsc_the_variation_name(); ?>_<?php echo wpsc_the_product_id(); ?>_<?php echo wpsc_the_variation_id(); ?>" 
									
									<?php if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Petit') { ?> style="background-image:url('/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/small_gray.png')  !important;cursor: default;"> <?php }
									else  if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Moyen') { ?> style="background-image:url('/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/medium_gray.png')  !important;cursor: default;"> <?php }
									else  if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Grand') { ?> style="background-image:url('/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/big_gray.png')  !important;cursor: default;"><?php } 
									else  if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'TGrand') { ?> style="background-image:url('/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/tresgrand_gray.png')  !important;cursor: default;"><?php } 
									else  if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Unique') { ?> style="background-image:url('/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/unique_gray.png')  !important;cursor: default;"><?php } else {;?>><?php };?>
									
									<?php if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Petit'){ 
									echo ('<div class="mystock" style="color:#ffffff !important; padding-top: 22px;"></div>');
									echo ('<div class="petitname" style="padding-top: 16px;">'.wpsc_the_variation_name().'</div><div class="petitsize">'.$$petit_height.'cm</div><br>');
									
									} else if (!wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Petit') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 22px;"></div>');
									echo '<br><div class="petitnameinstock">'.wpsc_the_variation_name().'</div><div class="petitsize">'.$$petit_height.'cm</div>';
									
									} ?>

									<?php if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Moyen'){ 
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 33px;padding-bottom: 7px;"></div>');
									echo ('<div class="moyenname">'.wpsc_the_variation_name().'</div><div class="moyensize">'.$$moyen_height.'cm</div><br>');
									
									} else if (!wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Moyen') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 33px;padding-bottom: 7px;"></div>');
									echo '<div class="moyennameinstock">'.wpsc_the_variation_name().'</div><div class="moyensize">'.$$moyen_height.'cm</div><br>';
									
									} ?>
									

									<?php if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Grand') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 40px;padding-bottom: 14px;"></div>');
									echo ('<div class="grandname">'.wpsc_the_variation_name().'</div><div class="grandsize">'.$$grand_height.'cm</div><br>'); 
									
									} else if (!wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Grand') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 40px;padding-bottom: 14px;"></div>');
									echo ('<div class="grandnameinstock">'.wpsc_the_variation_name().'</div><div class="grandsize">'.$$grand_height.'cm</div><br>');
									
									}
									?>
									
									<?php if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'TGrand') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 40px;padding-bottom: 14px;"></div>');
									echo ('<div class="tgrandname">Très Grand</div><div class="tgrandsize">'.$$tgrand_height.'cm</div><br>'); 
									
									} else if (!wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'TGrand') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 40px;padding-bottom: 14px;"></div>');
									echo ('<div class="tgrandnameinstock">Très Grand</div><div class="tgrandsize">'.$$tgrand_height.'cm</div><br>');
									
									}
									?>
									
									<?php if (wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Unique') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 40px;padding-bottom: 14px;"></div>');
									echo ('<div class="uniquename">Unique</div><div class="uniquesize">'.$$unique_height.'cm</div><br>'); 
									
									} else if (!wpsc_the_variation_out_of_stock() && wpsc_the_variation_name() == 'Unique') {
									echo ('<div class="mystock" style="color:#ffffff !important;padding-top: 40px;padding-bottom: 14px;"></div>');
									echo ('<div class="uniquenameinstock">Unique</div><div class="uniquesize">'.$$unique_height.'cm</div><br>');
									
									}
									?>
									
									
									</label>

									
									
									<input class="<?php echo wpsc_the_variation_name(); ?>" id="<?php echo wpsc_the_variation_name(); ?>_<?php echo wpsc_the_variation_id(); ?>" type="radio" name="size" value="<?php echo wpsc_the_variation_id(); ?>"
									<?php echo wpsc_the_variation_out_of_stock(); ?>></option>
									<input id="hiddenprice_<?php echo wpsc_the_variation_id(); ?>" type="hidden" name="hiddenprice_<?php echo wpsc_the_variation_id(); ?>" value="
									<?php 
									echo wpsc_the_variation_price();
									// $oldvarprice= wpsc_the_variation_price();
									
									// $number = floatval(str_replace(',', '.', str_replace('.', '', $oldvarprice)));
									
									// $newvarprice= wpsc_wp_wholesale_price($number);
									// echo $newvarprice.' €';
									 ?>">
									
									<?php } ?>
								<?php endwhile; ?>
								
								<!--Used to send the wpsc_vargrp_id to cart-->
								<input type="hidden" name="variation[<?php echo wpsc_vargrp_id(); ?>]" value="">
								</td></tr> 
								<script type="text/javascript">
										jQuery(document).ready( function () {
											jQuery('label').click(function(){
											jQuery("#rolovano").css('display','block');
											jQuery('input[type=radio]').attr('checked', false);
											jQuery(this).next('input[type=radio]').attr('checked', true);
											var $odabrano = '';
											var $odabrano = jQuery(':checked').val(); 
											var $cenavarijacije = 'hiddenprice_'+$odabrano+'"]';
											var $temphp=jQuery('input[name="'+$cenavarijacije).val();
											jQuery('span#product_price_<?php echo wpsc_the_product_id(); ?>').html($temphp); 
											jQuery('input[name="variation[<?php echo wpsc_vargrp_id(); ?>]"]').val($odabrano);  
											});
										});

									</script>
							<?php endwhile; ?>
                            </table>
							
						</div><!--close wpsc_variation_forms-->
                        </fieldset>
						</div>
						<?php } ?>
						<?php /** the variation group HTML and loop ends here */?>
							<?php
							/**
							 * Quantity options - MUST be enabled in Admin Settings
							 */
							?>
							
							
<div id="rolovano" style="display:none;" >
							<div id="kolicina">
							<div class="plus_kolicina">+</div>
							<?php if(wpsc_has_multi_adding()): ?>
                            	
								<div class="wpsc_quantity_update">
								<input type="text" id="wpsc_quantity_update_<?php echo wpsc_the_product_id(); ?>" name="wpsc_quantity_update" size="2" value="1" />
								<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
								<input type="hidden" name="wpsc_update_quantity" value="true" />
                                </div><!--close wpsc_quantity_update-->
                               
							<?php endif ;?>
							<div class="minus_kolicina">-</div>
							</div>
							
							<input type="hidden" value="add_to_cart" name="wpsc_ajax_action" />
							<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="product_id" />					
							<?php if( wpsc_product_is_customisable() ) : ?>
								<input type="hidden" value="true" name="is_customisable"/>
							<?php endif; ?>
					
							<?php
							/**
							 * Cart Options
							 */
							?>

							<?php if((get_option('hide_addtocart_button') == 0) &&  (get_option('addtocart_or_buynow') !='1')) : ?>
								<?php if(wpsc_product_has_stock()) : ?>
									<div class="wpsc_buy_button_container">
											<?php if(wpsc_product_external_link(wpsc_the_product_id()) != '') : ?>
											<?php $action = wpsc_product_external_link( wpsc_the_product_id() ); ?>
											<input class="wpsc_buy_button" type="submit" value="<?php echo wpsc_product_external_link_text( wpsc_the_product_id(), __( 'Buy Now', 'wpsc' ) ); ?>" onclick="return gotoexternallink('<?php echo $action; ?>', '<?php echo wpsc_product_external_link_target( wpsc_the_product_id() ); ?>')">
											<?php else: ?>
										<input type="submit" value="<?php _e('Add To Cart', 'wpsc'); ?>" name="Buy" class="wpsc_buy_button" id="product_<?php echo wpsc_the_product_id(); ?>_submit_button"/>
											<?php endif; ?>
										<div class="wpsc_loading_animation">
											<img title="Loading" alt="Loading" src="<?php echo wpsc_loading_animation_url(); ?>" />
											<?php _e('Updating cart...', 'wpsc'); ?>
										</div><!--close wpsc_loading_animation-->
</div>
									</div><!--close wpsc_buy_button_container-->
								<?php else : ?>
									<p class="soldout"><?php _e('This product has sold out.', 'wpsc'); ?></p>
								<?php endif ; ?>
							<?php endif ; ?>
							<?php do_action ( 'wpsc_product_form_fields_end' ); ?>
						</form><!--close product_form-->
						<div class="wpsc_product_price">
								<?php if(wpsc_show_stock_availability()): ?>
									<?php if(wpsc_product_has_stock()) : ?>
										<div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="in_stock"><?php _e('Product in stock', 'wpsc'); ?></div>
									<?php else: ?>
										<div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="out_of_stock"><?php _e('Product not in stock', 'wpsc'); ?></div>
									<?php endif; ?>
								<?php endif; ?>	
								<?php if(wpsc_product_is_donation()) : ?>
									<label for="donation_price_<?php echo wpsc_the_product_id(); ?>"><?php _e('Donation', 'wpsc'); ?>: </label>
									<input type="text" id="donation_price_<?php echo wpsc_the_product_id(); ?>" name="donation_price" value="<?php echo wpsc_calculate_price(wpsc_the_product_id()); ?>" size="6" />
								<?php else : ?>
									<?php if(wpsc_product_on_special()) : ?>
										<p class="pricedisplay <?php echo wpsc_the_product_id(); ?>"><?php _e('Old Price', 'wpsc'); ?>: <span class="oldprice" id="old_product_price_<?php echo wpsc_the_product_id(); ?>"><?php echo wpsc_product_normal_price(); ?></span></p>
									<?php endif; ?>
									<p class="pricedisplay <?php echo wpsc_the_product_id(); ?>"><?php _e('À partir de', 'wpsc');?>:<div id="single_product_price_container"><span id='product_price_<?php echo wpsc_the_product_id(); ?>' class="currentprice pricedisplay"><?php echo wpsc_the_product_price(); ?></span></div></p>
									<?php if(wpsc_product_on_special()) : ?>
										<p class="pricedisplay product_<?php echo wpsc_the_product_id(); ?>"><?php _e('You save', 'wpsc'); ?>: <span class="yousave" id="yousave_<?php echo wpsc_the_product_id(); ?>"><?php echo wpsc_currency_display(wpsc_you_save('type=amount'), array('html' => false)); ?>! (<?php echo wpsc_you_save(); ?>%)</span></p>
									<?php endif; ?>
									 <!-- multi currency code -->
                                    <?php if(wpsc_product_has_multicurrency()) : ?>
	                                    <?php echo wpsc_display_product_multicurrency(); ?>
                                    <?php endif; ?>
									<?php if(wpsc_show_pnp()) : ?>
										<?php /*<p class="pricedisplay"><?php _e('Shipping', 'wpsc'); ?>:<span class="pp_price"><?php echo wpsc_product_postage_and_packaging(); ?></span></p><?php */?>
									<?php endif; ?>							
								<?php endif; ?>
							</div><!--close wpsc_product_price-->
						<?php
							if ( (get_option( 'hide_addtocart_button' ) == 0 ) && ( get_option( 'addtocart_or_buynow' ) == '1' ) )
								echo wpsc_buy_now_button( wpsc_the_product_id() );
					
							echo wpsc_product_rater();

							echo wpsc_also_bought( wpsc_the_product_id() );
						
						if(wpsc_show_fb_like()): ?>
	                        <div class="FB_like">
	                        <iframe src="https://www.facebook.com/plugins/like.php?href=<?php echo wpsc_the_product_permalink(); ?>&amp;layout=standard&amp;show_faces=true&amp;width=435&amp;action=like&amp;font=arial&amp;colorscheme=light" frameborder="0"></iframe>
	                        </div><!--close FB_like-->
                        <?php endif; ?>
					</div><!--close productcol-->
					<div style="clear:both;"></div>
		<div id="underdesccol" style="width:400px; float:right;border-top: 1px solid #333; text-align:left;padding-top:20px;">
							<!--sharethis-->
							<?php if ( get_option( 'wpsc_share_this' ) == 1 ): ?>
							<div class="st_sharethis" displayText="Partager ce produit"></div>
							<?php endif; ?>
							<!--end sharethis-->
							<input type="hidden" value="add_to_cart" name="wpsc_ajax_action" />
							<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="product_id" />					
							<?php if( wpsc_product_is_customisable() ) : ?>
								<input type="hidden" value="true" name="is_customisable"/>
							<?php endif; ?>
							
		</div>
					<form onsubmit="submitform(this);return false;" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_extra_<?php echo wpsc_the_product_id(); ?>">
						<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="prodid"/>
						<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="item"/>
					</form>
					
		</div><!--close single_product_display-->
		<?php if (MRP_show_related_posts()) {
		MRP_show_related_posts();
		};?>
		<?php echo wpsc_product_comments(); ?>
		<div style="clear:both;"></div>

<?php endwhile;

    do_action( 'wpsc_theme_footer' ); ?> 	

</div><!--close single_product_page_container-->
<script type="text/javascript">
		jQuery(document).ready( function () {
			
			
			
			var postoji_selektovana = 0;	
		
			jQuery(':checked').each(function(){
				postoji_selektovana = 1;
			});
			if(postoji_selektovana == 0){
				jQuery("#rolovano").hide('');			
			}
			jQuery(".Moyen").hover(
				function(){
				jQuery(this).css("background-color","#ccc");
				},
				function(){
				jQuery(this).css("background-color","");
				}
			);	
			jQuery(".Petit").hover(
				function(){
				jQuery(this).css("background-color","#ccc");
				},
				function(){
				jQuery(this).css("background-color","");
				}
			);
			jQuery(".Grand").hover(
				function(){
				jQuery(this).css("background-color","#ccc");
				},
				function(){
				jQuery(this).css("background-color","");
				}
			);
			jQuery(".TGrand").hover(
				function(){
				jQuery(this).css("background-color","#ccc");
				},
				function(){
				jQuery(this).css("background-color","");
				}
			);
			jQuery(".Unique").hover(
				function(){
				jQuery(this).css("background-color","#ccc");
				},
				function(){
				jQuery(this).css("background-color","");
				}
			);
			jQuery("label.Petit").click(function(){
				jQuery(".petitnameinstock").css("border","1px solid black");
				jQuery(".moyennameinstock").css("border","none");
				jQuery(".grandnameinstock").css("border","none");
				jQuery(".tgrandnameinstock").css("border","none");
				jQuery(".uniquenameinstock").css("border","none");
				jQuery("p.pricedisplay").text('');
				jQuery(".pricedisplay").css('margin-top','24px');
			});
			jQuery("label.Moyen").click(function(){
				jQuery(".petitnameinstock").css("border","none");
				jQuery(".moyennameinstock").css("border","1px solid black");
				jQuery(".grandnameinstock").css("border","none");
				jQuery(".tgrandnameinstock").css("border","none");
				jQuery(".uniquenameinstock").css("border","none");
				jQuery("p.pricedisplay").text('');
				jQuery(".pricedisplay").css('margin-top','24px');
			});
			jQuery("label.Grand").click(function(){
				jQuery(".petitnameinstock").css("border","none");
				jQuery(".moyennameinstock").css("border","none");
				jQuery(".grandnameinstock").css("border","1px solid black");
				jQuery(".tgrandnameinstock").css("border","none");
				jQuery(".uniquenameinstock").css("border","none");
				jQuery("p.pricedisplay").text('');
				jQuery(".pricedisplay").css('margin-top','24px');
			});
			jQuery("label.TGrand").click(function(){
				jQuery(".petitnameinstock").css("border","none");
				jQuery(".moyennameinstock").css("border","none");
				jQuery(".grandnameinstock").css("border","none");
				jQuery(".tgrandnameinstock").css("border","1px solid black");
				jQuery(".uniquenameinstock").css("border","none");
				jQuery("p.pricedisplay").text('');
				jQuery(".pricedisplay").css('margin-top','24px');
			});
			jQuery("label.Unique").click(function(){
				jQuery(".petitnameinstock").css("border","none");
				jQuery(".moyennameinstock").css("border","none");
				jQuery(".grandnameinstock").css("border","none");
				jQuery(".tgrandnameinstock").css("border","none");
				jQuery(".uniquenameinstock").css("border","1px solid black");
				jQuery("p.pricedisplay").text('');
				jQuery(".pricedisplay").css('margin-top','24px');
			});
			// jQuery('label').click(function(){
			
			// jQuery("#rolovano").css('display','block');
			
			// var $odabrano = '';
			// var $odabrano = jQuery('input[name="size_]:checked').val(); 
			// var $cenavarijacije = 'hiddenprice_<?php echo wpsc_the_product_id(); ?>_'+$odabrano+'"]';
			// var $temphp=jQuery('input[name="'+$cenavarijacije).val();
			// jQuery('span#product_price_<?php echo wpsc_the_product_id(); ?>').html($temphp); 
			// jQuery('input[name="variation[<?php echo wpsc_vargrp_id(); ?>]"]').val($odabrano);

			// var $odabrano = jQuery('input[name="size"]:checked').val(); 
			// var $temphp="input#hiddenprice_"+$odabrano;
			// var $hiddenprice = jQuery($temphp).val();
			
			// jQuery('span#product_price_<?php echo wpsc_the_product_id(); ?>').html($hiddenprice); 
			// jQuery('input[name="variation[<?php echo wpsc_vargrp_id(); ?>]"]').val($odabrano);  
			// });
			
			jQuery('.plus_kolicina').click(function(){

				var nova_kol = parseInt(jQuery('input[name="wpsc_quantity_update"]').val())+1;
				jQuery('input[name="wpsc_quantity_update"]').val(nova_kol);
			});
			
			jQuery('.minus_kolicina').click(function(){

				var nova_kol = parseInt(jQuery('input[name="wpsc_quantity_update"]').val())-1;
				jQuery('input[name="wpsc_quantity_update"]').val(nova_kol);
			});
			
			jQuery('span.chicklets').css('background','##A6A2A1');
			jQuery('span.chicklets').delay(5000).text('Partager ce produit');
			
			});
</script>
