
<script type="text/javascript">
  
function Collapse(showHideDiv)   
{   
    jQuery("#" + showHideDiv).slideUp(1000);      
}  
  
function CollapseAll(showHideDiv)  
{  
  var elements = document.getElementsByTagName("div");  
  for (var i = 0; i < elements.length; i++)   
  {  
      var myname = elements[i].getAttribute("id");  
    if(myname != null)  
    {  
       if(myname.substr(0, 20) == "product_details_div_")  
     {  
      var linkid = myname.substr(20);  
      Collapse("product_details_div_"+ linkid);  
     }  
    }  
  }  
  
  var elem = document.getElementById(showHideDiv);  
    if(elem.style.display == "block") {  
		jQuery("#" + showHideDiv).slideUp(1000);	
    }  
    else {  
		jQuery("#" + showHideDiv).slideDown(1000);
		jQuery("#" + showHideDiv).css('display','block');	
    } 

}  

</script>
<?php
global $wp_query;

	$incat=$_SERVER["REQUEST_URI"];
	
if ($incat == '/boutique/collection-ephemere-ceramique/') {
	
	echo "<style type='text/css'>";
	echo "div.entry-content {width: 990px;}";
	echo ".product_grid_display .product_grid_item {height:310px;width:310px;margin:0 20px 30px 0;}";
	echo "</style>";
	}
if ($incat == '/boutique/collection-reguliere-ceramique/') {

	echo "<style type='text/css'>";
	echo "div.entry-content {width: 990px;}";
	echo ".product_grid_display .product_grid_item {height:220px;width:220px;background:none;margin:0 25px 25px 25px;}";
	echo ".product_grid_item .item_image {width:220px; height:220px !important; padding-bottom: 5px; margin:0px;background:url('/wp-content/themes/ceramique-de-lussan/img/reguliere_product_shadow.png') no-repeat 15px 60px;}";
	echo ".shelf-long {width:819px; margin-bottom: 20px; background:url('/wp-content/themes/ceramique-de-lussan/img/shelf-long.png') no-repeat bottom center;}";
	echo "</style>";
	}

function razmak_slike() {

$incat=$_SERVER["REQUEST_URI"];

if ($incat == '/boutique/collection-ephemere-ceramique/') {
	$razmak = 20;
	echo $razmak;
	} 
if ($incat == '/boutique/collection-reguliere-ceramique/') {
	$razmak = 20;
	echo $razmak;
	};
};

	
function height_slike() {

$incat=$_SERVER["REQUEST_URI"];

if ($incat == '/boutique/collection-ephemere-ceramique/') {
	$image_height = 250;
	echo $image_height;
	} 
if ($incat == '/boutique/collection-reguliere-ceramique/') {
	$image_height = 200;
	echo $image_height;
	};
};

function width_slike() {

$incat=$_SERVER["REQUEST_URI"];

if ($incat == '/boutique/collection-ephemere-ceramique/') {
	$image_width = 250;
	echo $image_width;
	} 
if ($incat == '/boutique/collection-reguliere-ceramique/') {
	$image_width = 200;
	echo $image_width;
	};
};

?>

<?php 
	global $wpdb;
	$kategorije = $wpdb->get_results( "SELECT wpcdl_terms.term_id, wpcdl_terms.name 
            FROM wpcdl_terms,wpcdl_term_taxonomy 
            WHERE wpcdl_terms.term_id = wpcdl_term_taxonomy.term_id 
            AND wpcdl_term_taxonomy.taxonomy = 'wpsc_product_category'");

	$variacije = $wpdb->get_results("SELECT * 
            FROM wpcdl_terms,wpcdl_term_taxonomy 
            WHERE wpcdl_terms.term_id = wpcdl_term_taxonomy.term_id 
            AND wpcdl_term_taxonomy.taxonomy = 'wpsc-variation' 
            AND wpcdl_term_taxonomy.parent != '0'");
        
	$boje = $wpdb->get_results("SELECT * 
            FROM wpcdl_colors 
            ORDER BY name ASC");
        
        $petit_id = $wpdb->get_var("SELECT term_id FROM wpcdl_terms WHERE name='petit'");
        $moyen_id = $wpdb->get_var("SELECT term_id FROM wpcdl_terms WHERE name='moyen'");
        $grand_id = $wpdb->get_var("SELECT term_id FROM wpcdl_terms WHERE name='grand'");
        $unique_id = $wpdb->get_var("SELECT term_id FROM wpcdl_terms WHERE name='unique'");
	$tgrand_id = $wpdb->get_var("SELECT term_id FROM wpcdl_terms WHERE name='tgrand'");

?>


<div style="width:845px; height:30px; margin-bottom: 30px;">
	<form id="filter_form" action="#" method="post" name="filter">

		<!-- FILTER FOR MODEL -->

		<div class="model-select-meta-box">

        	<a href="#" class="model-select-caption">Modèle</a>

        	<ul id="model-select-ul" style="display: none; z-index: 999;">
        		<div id="model-select-ul-inner" >

        			<?php

        			// Save original loop for later
					$original_post = $post;
					$post = null;

        			// Get selected model
        			$product_models = ( isset( $_POST['model'] ) && $_POST['model'] != '' ) ? $_POST['model'] : '';
                                $iwb_product_model = explode(',', $product_models);

        			// Loop trough all model
        			$iwb_model_loop_args = array(
					  'post_type' => 'iwb-model',
					  'posts_per_page' => '-1'
					  );

        			$iwb_model_loop = get_posts( $iwb_model_loop_args );

        			foreach( $iwb_model_loop as $post ) : setup_postdata($post);
		
						echo '<li class="model"><a href="#" ' . ( in_array($post->ID, $iwb_product_model) ? 'class= "selected"' : 'class=""' ) . ' val="';
						echo $post->ID;
						echo '" title="';
						echo $post->post_title;
						echo '">';
						
                        ?>
						<span style="text-align: left;"><?php echo ( trim( strip_tags( $post->post_title ) ) ); ?></span></a></li>
                    <?php
					endforeach;


					echo "<div style='clear: both; height: 0; content: " . '"."' . "; visibility: hidden; display: block;'></div>";
  
  					echo '<input type="hidden" id="model" name="model" value="' . $product_models . '">';
					
					// Reset loop now back to original post
					$post = null;
					$post = $original_post;
					wp_reset_postdata();

					?>

        		</div>
        	</ul>
       	</div>


            <!-- FILTER FOR COLOR -->
            
        <div class="color-select-meta-box">

        	<a href="#" class="color-select-caption">Couleurs de fond</a>

        	<ul id="color-select-ul" style="display: none; z-index: 999;">
        		<div id="color-select-ul-inner" >
        			<?php

        			// Save original loop for later
					$original_post = $post;
					$post = null;

        			// Get selected color
        			$product_color = ( isset( $_POST['boja'] ) && $_POST['boja'] != '' ) ? $_POST['boja'] : '';

        			// Loop trough all colors
        			$loop_args = array(
					  'post_type' => 'color',
					  );

        			$color_loop = get_posts( $loop_args );
					
					$col_loop_pos = 1;
        			foreach ( $color_loop as $post ) :
					  setup_postdata( $post );

						//$texture_bg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail');
					  
					    echo '<li ' . ( ( $post->ID == $product_color ) ? 'class= "selected"' : '' ) . '><a href="#" ' . ( ( $post->ID == $product_color ) ? 'class= "selected"' : '' ) . ' val="';
					    echo $post->ID;
					    echo '" title="';
					    echo $post->post_title;
					    echo '">';
					    /*echo get_the_post_thumbnail($post->ID, 'colorpick', array(
								'title'	=> trim(strip_tags( $post->post_title )),
							)); */
					    echo '<div>' .$post->post_title. '</div>';
						echo '</a>';
					    echo '</li>';
					    if( $col_loop_pos == 3){
					    	echo '<div class="clear"></div>';
					    	$col_loop_pos = 1;
					    }else{
					    	$col_loop_pos++;
					    }
					endforeach;

					echo "<div style='clear: both; height: 0; content: " . '"."' . "; visibility: hidden; display: block;'></div>";
  
  					echo '<input type="hidden" id="boja" name="boja" value="' . $product_color . '">';
					
					// Reset loop now back to original post
					$post = null;
					$post = $original_post;
					wp_reset_postdata();

					?>

        		</div>
        	</ul>
       	</div>

		<!-- FILTER FOR SIZE -->

		<div class="size-select-meta-box">

        	<a href="#" class="size-select-caption">Taille</a>

        	<ul id="size-select-ul" style="display: none; z-index: 999;">
        		<div id="size-select-ul-inner" >
                            <?php $str_product_size = ( isset( $_POST['velicina'] ) && $_POST['velicina'] != '' ) ? $_POST['velicina'] : ''; 
                            $product_size = explode(',', $str_product_size);
                            ?>
                            <li class="size"><a href="#" <?php echo (in_array($petit_id, $product_size))? 'class="selected"':'';  ?> val="<?php echo $petit_id; ?>" title="Petit"><span style="text-align: left;"><img src="<?php bloginfo('template_directory'); ?>/img/petit.png" alt="Petit" /></span><span style="text-align: left;">Petit</span></a></li>
                            <li class="size"><a href="#" <?php echo (in_array($moyen_id, $product_size))? 'class="selected"':'';  ?> val="<?php echo $moyen_id; ?>" title="Moyen"><span style="text-align: left;"><img src="<?php bloginfo('template_directory'); ?>/img/moyen.png" alt="Moyen" /></span><span style="text-align: left;">Moyen</span></a></li>
                            <li class="size"><a href="#" <?php echo (in_array($grand_id, $product_size))? 'class="selected"':'';  ?> val="<?php echo $grand_id; ?>" title="Grand"><span style="text-align: left;"><img src="<?php bloginfo('template_directory'); ?>/img/grand.png" alt="Grand" /></span><span style="text-align: left;">Grand</span></a></li>
                            <li class="size"><a href="#" <?php echo (in_array($tgrand_id, $product_size))? 'class="selected"':'';  ?> val="<?php echo $tgrand_id; ?>" title="Tres Grand"><span style="text-align: left;"><img src="<?php bloginfo('template_directory'); ?>/img/tgrand.png" alt="Tres Grand" /></span><span style="text-align: left;">Tres Grand</span></a></li>
                            <li class="size"><a href="#" <?php echo (in_array($unique_id, $product_size))? 'class="selected"':'';  ?> val="<?php echo $unique_id; ?>" title="Unique"><span style="text-align: left;"><img src="<?php bloginfo('template_directory'); ?>/img/grand.png" alt="Unique" /></span><span style="text-align: left;">Unique</span></a></li>
                            <input type="hidden" id="velicina" name="velicina" value="<?php echo $str_product_size; ?>">
        		</div>
        	</ul>
       	</div>

		<input name="FilterTriger" type="hidden" id="FilterTriger" value="1" />
	</form>
</div>

<div id="grid_view_products_page_container">
<?php wpsc_output_breadcrumbs(); ?>
	
	<?php do_action('wpsc_top_of_products_page'); // Plugin hook for adding things to the top of the products page, like the live search ?>
	
	<?php if(wpsc_display_categories()): ?>
	  <?php if(get_option('wpsc_category_grid_view') == 1) :?>
			<div class="wpsc_categories wpsc_category_grid group">
				<?php wpsc_start_category_query(array('category_group'=> 1, 'show_thumbnails'=> 1)); ?>
					<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_grid_item  <?php wpsc_print_category_classes_section(); ?>" title="<?php wpsc_print_category_name();?>">
						<?php wpsc_print_category_image(45, 45); ?>
					</a>
					<?php wpsc_print_subcategory("", ""); ?>
				<?php wpsc_end_category_query(); ?>
				
			</div><!--close wpsc_categories-->
	  <?php else:?>
			<ul class="wpsc_categories">
				<?php wpsc_start_category_query(array('category_group'=> 1, 'show_thumbnails'=> get_option('show_category_thumbnails'))); ?>
						<li>
							<?php wpsc_print_category_image(32, 32); ?>
							
							<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link  <?php wpsc_print_category_classes_section(); ?>"><?php wpsc_print_category_name();?></a>
							<?php if(get_option('wpsc_category_description')) :?>
								<?php wpsc_print_category_description("<div class='wpsc_subcategory'>", "</div>"); ?>				
							<?php endif;?>
							
							<?php wpsc_print_subcategory("<ul>", "</ul>"); ?>
						</li>
				<?php wpsc_end_category_query(); ?>
			</ul>
		<?php endif; ?>
	<?php endif; ?>

	<?php if(wpsc_display_products()): ?>
	<?php if(wpsc_is_in_category()) : ?>
		<div class="wpsc_category_details">
			<?php if(get_option('show_category_thumbnails') && wpsc_category_image()) : ?>
				<img src="<?php echo wpsc_category_image(); ?>" alt="<?php echo wpsc_category_name(); ?>" title="<?php echo wpsc_category_name(); ?>" />
			<?php endif; ?>
			
			<?php if(get_option('wpsc_category_description') &&  wpsc_category_description()) : ?>
				<?php echo wpsc_category_description(); ?>
			<?php endif; ?>
		</div><!--close wpsc_category_details-->
	<?php endif; ?>
	
	
	<?php if(wpsc_has_pages_top()) : ?>
			<div class="wpsc_page_numbers_top group">
				<?php wpsc_pagination(); ?>
			</div><!--close wpsc_page_numbers_top-->
	<?php endif; ?>		
		

	<?php 
	// REAL ITEM POSITION ON SHELF
	$real_shelf_pos = 0;
	$prev_pos = -1;
	$prev_pos_close_shelf = -1;
	?>

		<div class="product_grid_display group">
		<?php while (wpsc_have_products()) :  wpsc_the_product(); ?>

		<?php if ($incat == '/boutique/collection-reguliere-ceramique/'): 
				if( $real_shelf_pos != $prev_pos ){

					// avoid that items that already opened shelf don't open it again...
					$prev_pos = $real_shelf_pos;

					$trenutni = $real_shelf_pos;
					if ( $real_shelf_pos == 0 || ( ( $real_shelf_pos % 3 ) == 0 ) ):	
						echo '<div class="shelf-long">'; 
					endif;
				}

			endif;

		?>
			
			
			<?php
			//FILTER HACK
			if(isset($_POST['FilterTriger']))
			{
//                            echo $_POST['model'].'-'. $_POST['boja'].'-'. $_POST['velicina'];
                            $gm_model = explode(',', $_POST['model']);
                            $gm_boja = explode(',', $_POST['boja']);
                            $gm_velicina = explode(',', $_POST['velicina']);
//                            var_dump($gm_velicina);
				if(count($gm_model)==1 && strlen($gm_model[0])==0)
				{
					$filter_cat = 1;
				}
				else
				{
					$current_model = get_post_meta(wpsc_the_product_id(), 'iwb_product_model', true);
					if(in_array($current_model,$gm_model))
					{
						$filter_cat = 1;
					}
					else
					{
						$filter_cat = 0;
					}
				}
			
				if($_POST['boja'] == '')
				{
					$filter_color = 1;
				}
				else
				{
					$meta_vrednosti = get_post_meta(wpsc_the_product_id(), 'product_color', true);
					if($meta_vrednosti == $_POST['boja'])
					{
						$filter_color = 1;
					}
					else
					{
						$filter_color = 0;
					}
				}
				
				
				if(count($gm_velicina)==1 && strlen($gm_velicina[0])==0)
				{
					$filter_size = 1;
				}
				else
				{
					$upit_has_size = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `wpcdl_term_relationships` WHERE term_taxonomy_id IN (".implode(',',$gm_velicina).") AND object_id = ".wpsc_the_product_id()));
					if($upit_has_size > 0)
					{
						$filter_size = 1;
					}
					else
					{
						$filter_size = 0;
					}
				}
				
			}
			else
			{
				$filter_cat = 1;
				$filter_size = 1;
				$filter_color = 1;
			}
			
			$idjevi_proizvoda[] = '';
			
			if($filter_cat == 1 && $filter_size == 1 && $filter_color == 1)
			{
				$upit_has_variacije = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM wpcdl_term_relationships INNER JOIN wpcdl_term_taxonomy ON wpcdl_term_relationships.term_taxonomy_id = wpcdl_term_taxonomy.term_id WHERE wpcdl_term_taxonomy.taxonomy =  'wpsc-variation' AND wpcdl_term_relationships.object_id =".wpsc_the_product_id()));
 				
				if($upit_has_variacije > 0)
				{
					$upit_variacije_proizvoda = 'SELECT * FROM wpcdl_posts WHERE post_parent = '.wpsc_the_product_id().' AND post_type = "wpsc-product"';
					$variacije_proizvoda = $wpdb->get_results($upit_variacije_proizvoda);
					foreach($variacije_proizvoda as $variacija_proizvoda)
					{
						$upit_petit = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM wpcdl_term_relationships INNER JOIN wpcdl_terms ON wpcdl_term_relationships.term_taxonomy_id = wpcdl_terms.term_id WHERE wpcdl_term_relationships.object_id = ".$variacija_proizvoda->ID." AND wpcdl_terms.slug = 'taille-petit'" ));
						if($upit_petit > 0)
						{
							$temp_array['petit'] = get_post_meta($variacija_proizvoda->ID, '_wpsc_stock', true);
						}
						
						$upit_moyen = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM wpcdl_term_relationships INNER JOIN wpcdl_terms ON wpcdl_term_relationships.term_taxonomy_id = wpcdl_terms.term_id WHERE wpcdl_term_relationships.object_id = ".$variacija_proizvoda->ID." AND wpcdl_terms.slug = 'taille-moyen'"));
						if($upit_moyen > 0)
						{
							$temp_array['moyen'] = get_post_meta($variacija_proizvoda->ID, '_wpsc_stock', true);
						}
						
						$upit_grand = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM wpcdl_term_relationships INNER JOIN wpcdl_terms ON wpcdl_term_relationships.term_taxonomy_id = wpcdl_terms.term_id WHERE wpcdl_term_relationships.object_id = ".$variacija_proizvoda->ID." AND wpcdl_terms.slug = 'taille-grand'"));
						if($upit_grand > 0)
						{
							$temp_array['grand'] = get_post_meta($variacija_proizvoda->ID, '_wpsc_stock', true);
						}
					}
					if(!isset($temp_array['petit']))
					{
						$temp_array['petit'] = 0;
					}
					if(!isset($temp_array['moyen']))
					{
						$temp_array['moyen'] = 0;
					}
					if(!isset($temp_array['grand']))
					{
						$temp_array['grand'] = 0;
					}
				}
				else
				{
					$temp_array['petit'] = 0;
					$temp_array['moyen'] = 0;
					$temp_array['grand'] = 0;
				}
			
				$temp_array['id'] = wpsc_the_product_id();
				$temp_array['image'] = wpsc_the_product_image();
				$temp_array['name'] = wpsc_the_product_title();
				$temp_array['description'] = wpsc_the_product_description();
				$temp_array['url'] = wpsc_the_product_permalink();
				$temp_array['price'] = wpsc_the_product_price();
				
				array_push($idjevi_proizvoda, $temp_array);
			?>
			
			<div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>" style="float: left;">
				  
				<?php if(wpsc_the_product_thumbnail()) :?> 	   
					<div class="item_image" >
						<a href="javascript:CollapseAll('product_details_div_<?php echo wpsc_the_product_id();?>');">
						
							<?php 
								if ($incat == '/boutique/collection-reguliere-ceramique/'){
								echo get_the_post_thumbnail(wpsc_the_product_id(),array(220, 220),array('alt' => wpsc_the_product_title(),'title' => wpsc_the_product_title() ));
								};
								if ($incat == '/boutique/collection-ephemere-ceramique/'){
								echo get_the_post_thumbnail(wpsc_the_product_id(),'ephemere-thumb',array('alt' => wpsc_the_product_title(),'title' => wpsc_the_product_title() ));
								};
							?>
						
						</a>
					</div><!--close imte_image-->
				<?php else: ?> 
					<div class="item_no_image">
									<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>
					</div><!--close item_no_image-->
				<?php endif; ?> 
				<div id="original_info<?php echo wpsc_the_product_id(); ?>" style="float:right;width:500px;text-align:left;">
				<?php if(wpsc_product_on_special()) : ?><span class="sale"><?php _e('Sale', 'wpsc'); ?></span><?php endif; ?>	
				<?php if(get_option('show_images_only') != 1): ?>
					<div class="grid_product_info">
						<h2><?php echo wpsc_the_product_title(); ?></h2>
							
						<?php if((wpsc_the_product_description() != '') && (get_option('display_description') == 1)): ?>
							<div class="grid_description"><?php echo wpsc_the_product_description(); ?></div>
						<?php endif; ?>
                        	
					</div><!--close grid_product_info-->
					<div class="grid_more_info<?php echo wpsc_the_product_id(); ?>">
						<form class="product_form"  enctype="multipart/form-data" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_<?php echo wpsc_the_product_id(); ?>" >
							<?php do_action ( 'wpsc_product_form_fields_begin' ); ?>
							<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(get_option('display_variations') == 1) : ?>
					<?php /** the variation group HTML and loop */?>
						
                        <?php if (wpsc_have_variation_groups()) { ?>
						<div id="varijacije" class="varijacije<?php echo wpsc_the_product_id(); ?>" style="margin-bottom: 80px;">
                        <fieldset id="choose_size"><legend style="font-weight: normal !important;"><?php _e('Cliquer sur une taille pour en connaitre 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_product_id(); ?>_<?php echo wpsc_the_variation_id(); ?>" type="radio" name="size_<?php echo wpsc_the_product_id(); ?>" value="<?php echo wpsc_the_variation_id(); ?>"
									<?php echo wpsc_the_variation_out_of_stock(); ?>>
									<input id="hiddenprice_<?php echo wpsc_the_product_id(); ?>" type="hidden" name="hiddenprice_<?php echo wpsc_the_product_id(); ?>_<?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('input[name="size_<?php echo wpsc_the_product_id(); ?>"]').click(function(){
											jQuery("#rolovano_<?php echo wpsc_the_product_id(); ?>").slideDown('medium');
											var $odabrano = '';
											var $odabrano = jQuery('input[name="size_<?php echo wpsc_the_product_id(); ?>"]: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);  
											});
										});

									</script>
								
							<?php endwhile; ?>
                            </table>
						</div><!--close wpsc_variation_forms-->
                        </fieldset>
						</div>
						<?php } ?>
						<?php /** the variation group HTML and loop ends here */?>
						<?php endif ?>
							
						<?php if(get_option('display_moredetails') == 1) : ?>
							<div id="more_details<?php echo wpsc_the_product_id(); ?>" style="float: left;display: inline;margin-top: 7px;margin-right: 20px;"><a href="<?php echo wpsc_the_product_permalink(); ?>" class="more_details">+ de détails</a></div>
						<?php endif; ?> 
							
					<div id="rolovano_<?php echo wpsc_the_product_id(); ?>" style="float: left;display: inline;">
							<?php if((get_option('display_addtocart') == 1) && (get_option('addtocart_or_buynow') !='1')) :?> 	   
								<?php if(wpsc_product_has_stock()) : ?>
									<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 else : ?>
									<p class="soldout"><?php _e('Sorry, sold out!', 'wpsc'); ?></p>
								<?php endif ; ?>
							<?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-->
										
										<script type="text/javascript">
										jQuery(document).ready( function () {	
											jQuery(".item_image").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","none");
												jQuery("#from<?php echo wpsc_the_product_id(); ?>").css("display","block");
												jQuery("#from<?php echo wpsc_the_product_id(); ?>").css("margin-top","-43px");
												
												if (jQuery("div.varijacije<?php echo wpsc_the_product_id(); ?>").html() == null){
													jQuery(".price_container<?php echo wpsc_the_product_id(); ?> div.grid_product_price_container").css('margin-top','30px');
													jQuery(".price_container<?php echo wpsc_the_product_id(); ?> div.grid_product_price_container").css('right','275px');
													jQuery("#from<?php echo wpsc_the_product_id(); ?>").css('display','none');
													jQuery(".price_container<?php echo wpsc_the_product_id(); ?> p.pricedisplay").css('margin-top','-3px');
													jQuery('#more_details<?php echo wpsc_the_product_id(); ?>').css('margin-top','50px');
													jQuery('#rolovano_<?php echo wpsc_the_product_id(); ?>').css('margin-top','43px');
												};
											});
										
											

											if (jQuery("div.varijacije<?php echo wpsc_the_product_id(); ?>").length > 0){
											  
											var postoji_selektovana = 0;	
										
											jQuery('input[name="size_<?php echo wpsc_the_product_id(); ?>"]:checked').each(function(){
												postoji_selektovana = 1;
											});
											
											if(postoji_selektovana == 0){
												jQuery("#rolovano_<?php echo wpsc_the_product_id(); ?>").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("input.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("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery(".price_container<?php echo wpsc_the_product_id(); ?> p.pricedisplay").css('margin-top','-3px');
												
											});
											jQuery("input.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("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery(".price_container<?php echo wpsc_the_product_id(); ?> p.pricedisplay").css('margin-top','-3px');
											});
											jQuery("input.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("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery(".price_container<?php echo wpsc_the_product_id(); ?> p.pricedisplay").css('margin-top','-3px');
											});
											jQuery("input.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("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery(".price_container<?php echo wpsc_the_product_id(); ?> p.pricedisplay").css('margin-top','-3px');
											});
											jQuery("input.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("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery("#from<?php echo wpsc_the_product_id(); ?>").css("display","none");
												jQuery(".price_container<?php echo wpsc_the_product_id(); ?> p.pricedisplay").css('margin-top','-3px');
											});
											}
											
										});	
										</script>
					</div><!--close rolovano-->
					
						<?php do_action ( 'wpsc_product_form_fields_end' ); ?>
                    </form>           
					<div class="price_container<?php echo wpsc_the_product_id(); ?>"> 
							<?php if(wpsc_product_on_special()) : ?>
										<p class="pricedisplay <?php echo wpsc_the_product_id(); ?>"><?php _e('Old Price', 'wpsc'); ?>:<span class="oldprice"><?php echo wpsc_product_normal_price(); ?></span></p>
									<?php endif; ?>
									<div class="grid_product_price_container"><p class="pricedisplay"><span id="from<?php echo wpsc_the_product_id(); ?>"><?php _e('À partir de', 'wpsc'); ?>:<br></span><span id='product_price_<?php echo wpsc_the_product_id(); ?>' class="currentprice pricedisplay"><?php echo wpsc_the_product_price(); ?></span></p>
									<?php /*?><?php if(wpsc_show_pnp()) : ?>
										<p class="pricedisplay"><?php _e('Shipping', 'wpsc'); ?>:<span class="pp_price"><?php echo wpsc_product_postage_and_packaging(); ?></span></p>
									<?php endif; ?>	 <?php */?></div>
							</div><!--close price_container-->
					</div><!--close grid_more_info-->
					
					<?php if((get_option('display_addtocart') == 1) && (get_option('addtocart_or_buynow') == '1')) :?> 	  
						<?php echo wpsc_buy_now_button(wpsc_the_product_id()); ?>
					<?php endif ; ?>
					
				<?php endif; ?> 
				</div>
			</div><!--close product_grid_item-->
			<?php
			//FILTER END IF
			
						$real_shelf_pos++;

			
			}
			?>
			

			
			<?php
			if ($incat == '/boutique/collection-ephemere-ceramique/') {
			$gnpr=3;
			} else {
			$gnpr=3;}
			//if(($gnpr > 0) && ( ((($wp_query->current_post +1) % $gnpr) == 0)  || ($wp_query->post_count == ($wp_query->current_post + 1)) ) ) :

						if(($gnpr > 0) && $real_shelf_pos > 0 && ((($real_shelf_pos) % $gnpr) == 0)  && ( $real_shelf_pos != $prev_pos_close_shelf ) ) :

			$prev_pos_close_shelf = $real_shelf_pos;
			
			if ($incat == '/boutique/collection-reguliere-ceramique/'): 
				echo '<div class="clear"></div></div> <!-- .shelf-long-->'; 
			endif;

			

			?>

			
			
			  <div class="grid_view_clearboth"></div>
			  <?php
			  	foreach($idjevi_proizvoda as $ajdi)
				{
					if(isset($ajdi['id']))
					{
						if($ajdi['petit'] > 0)
						{
							$img_petit_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/small_black.png';
						}
						else
						{
							$img_petit_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/small_gray.png';
						}
						if($ajdi['moyen'] > 0)
						{
							$img_moyen_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/medium_black.png';
						}
						else
						{
							$img_moyen_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/medium_gray.png';
						}
						
						if($ajdi['grand'] > 0)
						{
							$img_grand_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/big_black.png';
						}
						else
						{
							$img_grand_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/big_gray.png';
						}
						?>
						<div id="product_details_div_<?php echo $ajdi['id']; ?>" style='width:100%; float: left; display:none; margin-bottom:30px;'>
							<img style="width:<?php echo get_option('single_view_image_width'); ?>px;height:<?php echo get_option('single_view_image_height'); ?>px; float:left;" class="product_image" id="product_image_<?php echo $ajdi['id']; ?>" alt="<?php echo $ajdi['name']; ?>" src="<?php echo $ajdi['image']; ?>"/>
							<a href="javascript:CollapseAll();" style="color: #000000; float: right; margin-right: 20px; text-decoration: none;">x</a>
							<?php /*?><div style="float:right; width: 430px; padding-left:20px;" align="left">
								<h2><?php echo $ajdi['name']; ?></h2>
								<div class="product_description">
									<?php echo $ajdi['description']; ?>
								</div>
								<h2><?php echo $ajdi['price']; ?></h2>
								
								<div style="width:100%; height:77px; margin-bottom:20px;" >
									<img style="width:50px;height:50px; float:left; margin-top:27px;" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); echo $img_petit_src; ?>"/>
									<img style="width:64px;height:64px; float:left; margin-top:13px;" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); echo $img_moyen_src; ?>"/>
									<img style="width:77px;height:77px; float:left;" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); echo $img_grand_src; ?>"/>
								</div>
								
								<a href="<?php echo $ajdi['url']; ?>">
									<img style="width:76px;height:24px" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); ?>/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/btn-more.png"/>
								</a>
							</div><?php */?>
						</div>
						<script type="text/javascript">
							jQuery('#original_info<?php echo $ajdi['id']; ?>').appendTo('#product_details_div_<?php echo $ajdi['id']; ?>');
							//jQuery('#original_info<?php echo $ajdi['id']; ?>').css('display','block');
						</script>
						<?php
					}
				}
				unset($idjevi_proizvoda);
				
			  ?>
			<?php endif ; ?>
			

		<?php endwhile; ?>
		
		<?php
			if(count($idjevi_proizvoda)>0)
			{
				
				// First closing the shelf
				if ($incat == '/boutique/collection-reguliere-ceramique/'):
					echo '<div class="clear"></div></div> <!-- .shelf-long-->';
				endif;

				
				foreach($idjevi_proizvoda as $ajdi)
				{
					if(isset($ajdi['id']))
					{
						if($ajdi['petit'] > 0)
						{
							$img_petit_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/small_black.png';
						}
						else
						{
							$img_petit_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/small_gray.png';
						}
						if($ajdi['moyen'] > 0)
						{
							$img_moyen_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/medium_black.png';
						}
						else
						{
							$img_moyen_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/medium_gray.png';
						}
						
						if($ajdi['grand'] > 0)
						{
							$img_grand_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/big_black.png';
						}
						else
						{
							$img_grand_src = '/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/big_gray.png';
						}
						?>
						<div id="product_details_div_<?php echo $ajdi['id']; ?>" style='width:100%; float: left; display:none; margin-bottom:30px;'>
							<img style="width:<?php echo get_option('single_view_image_width'); ?>px;height:<?php echo get_option('single_view_image_height'); ?>px; float:left;" class="product_image" id="product_image_<?php echo $ajdi['id']; ?>" alt="<?php echo $ajdi['name']; ?>" src="<?php echo $ajdi['image']; ?>"/>
							<a href="javascript:CollapseAll();" style="color: #000000; float: right; margin-right: 20px; text-decoration: none;">x</a>
							<?php /*?><div style="float:right; width: 430px; padding-left:20px;" align="left">
								<h2><?php echo $ajdi['name']; ?></h2>
								<div class="product_description">
									<?php echo $ajdi['description']; ?>
								</div>
								<h2><?php echo $ajdi['price']; ?></h2>
								
								<div style="width:100%; height:77px; margin-bottom:20px;" >
									<img style="width:50px;height:50px; float:left; margin-top:27px;" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); echo $img_petit_src; ?>"/>
									<img style="width:64px;height:64px; float:left; margin-top:13px;" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); echo $img_moyen_src; ?>"/>
									<img style="width:77px;height:77px; float:left;" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); echo $img_grand_src; ?>"/>
								</div>
								
								<a href="<?php echo $ajdi['url']; ?>">
									<img style="width:76px;height:24px" alt="<?php echo $ajdi['name']; ?>" src="<?php bloginfo('url'); ?>/wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-images/btn-more.png"/>
								</a>
							</div><?php */ ?>	
						</div>
					<script type="text/javascript">
							jQuery('#original_info<?php echo $ajdi['id']; ?>').appendTo('#product_details_div_<?php echo $ajdi['id']; ?>');
							//jQuery('#original_info<?php echo $ajdi['id']; ?>').css('display','block');
					</script>
					<?php
					}
				}
				unset($idjevi_proizvoda);
			}
		?>	
		<?php if(wpsc_product_count() == 0):?>
			<p><?php  _e('There are no products in this group.', 'wpsc'); ?></p>
		<?php endif ; ?>
		

	</div><!--close product_grid_display-->
	<div style="clear:both;"></div>	
		<?php if(wpsc_has_pages_bottom()) : ?>
			<div class="wpsc_page_numbers_bottom group">
				<?php wpsc_pagination(); ?>
			</div><!--close wpsc_page_numbers_bottom-->
		<?php endif; ?>
	<?php endif; ?>
	
    <?php do_action( 'wpsc_theme_footer' ); ?> 	

</div><!--close grid_view_products_page_container-->

<style>
  
  .color-select-meta-box,
  .size-select-meta-box,
  .model-select-meta-box{
  	  display: inline-block;
      position: relative;
      background: #fff;
      width: 222px;
  }
  
  .color-select-meta-box:hover .color-select-meta-box ul,
  .size-select-meta-box:hover .size-select-meta-box ul,
  .model-select-meta-box:hover .model-select-meta-box ul{
      display: block;
  }
  
  .color-select-caption,
  .size-select-caption,
  .model-select-caption{
      display: block;
      width: 220px;
      height: 25px;
      text-align: center;
      background: #fefefe;
      color: #333;
      font-size: 12px;
      font-family: Georgia, serif;
      font-style: italic;
      color: #333 !important;
      line-height: 25px;
      border: 1px solid #ccc;
      text-decoration: none;
      background: url(<?php echo bloginfo('template_directory'); ?>/img/filter_arrow_down.png) center center no-repeat;
  }
  
  .color-select-meta-box ul,
  .size-select-meta-box ul,
  .model-select-meta-box ul{
      display: none;
      position: absolute;
      top: 25px;
      left: 0;
      width: 220px;
      margin: 0;
      padding: 0;
      background: #fff;
      border: 1px solid #ccc;
      list-style: none;
      font-size: 12px;

  }
  
  #color-select-ul-inner,
  #size-select-ul-inner,
  #model-select-ul-inner{
      padding: 5px;
  }
  
  .color-select-meta-box ul li{
      display: block;  
  }
  
  .color-select-meta-box ul li:hover,
  .color-select-meta-box ul li.selected{
	  cursor: default;
  }
  
  .color-select-meta-box ul li:hover a{
     border: 1px solid #ccc;
  }
  
  .color-select-meta-box ul li a{
    display: block;
    padding: 3px;
	color: #555;
	text-decoration: none;
	border: 1px solid #fff;
	text-align: left;
  }

	
	.size-select-meta-box ul li{
			display: block;  
	}
	
	.size-select-meta-box ul li:hover a,
	.size-select-meta-box ul li:hover a.selected{
			border: 1px solid #ccc;
	}
	
	.size-select-meta-box ul li a{
			display: table;
			width: 100%;
			overflow: hidden;
			text-align: center;
			border: 1px solid #fff;
			color: #555;
			text-decoration: none;
	}
        
        .size-select-meta-box ul li a span{
			display: table-cell;
			width: 50%;
			vertical-align: middle;
			text-align: center;
			color: #555;
			text-decoration: none;
	}

	
	.model-select-meta-box ul li{
			display: block;  
	}
	
	.model-select-meta-box ul li:hover a,
	.model-select-meta-box ul li:hover a.selected{
			border: 1px solid #ccc;
	}
	
	.model-select-meta-box ul li a{
			display: block;
			padding: 3px;
			overflow: hidden;
			text-align: center;
			border: 1px solid #fff;
			color: #555;
			text-decoration: none;
	}
	.model-select-meta-box ul li a span{
			display: table-cell;
			width: 50%;
			vertical-align: middle;
			text-align: center;
			color: #555;
			text-decoration: none;
	}


  
  </style>
  <script type="text/javascript">

  var $j = jQuery.noConflict();

  $j(function(){
      	$j(".color-select-meta-box").click(function(event){
        	event.preventDefault();
        	$j("#color-select-ul").toggle('slow');
     	});
        
        $j(".color-select-meta-box").hover(
                function(){
        	$j("#color-select-ul").slideDown('slow');
                },
                function(){
        	$j("#color-select-ul").delay(2000).slideUp('slow');
                }
        );

      	$j(".color-select-meta-box ul a").click(function(){
        	var val = $j(this).attr('val');
        	var name = $j(this).attr('title');
        	$j(this).toggleClass('selected');
        	if ( $j(this).parent().parent().find("input[type='hidden']").attr('value') == val ){
        		$j(this).parent().parent().find("input[type='hidden']").attr('value','');
        	}else{
        		$j(this).parent().parent().find("input[type='hidden']").attr('value',val);
        	}
  		$j('#filter_form').submit();

      	});


                
        $j(".model-select-meta-box").hover(
                function(){
        	$j("#model-select-ul").slideDown('slow');
                },
                function(){
        	$j("#model-select-ul").delay(2000).slideUp('slow');
                }
        );

		$j(".model a").click(function(){
                        var lista=new Array();
                        $ar_li = $j(".model");
			$j("#model-select-selected").html(name);
                        $j(this).toggleClass('selected');
                        $j.each($ar_li, function(){
                            if($j("a", this).hasClass("selected")){
                                lista.push($j("a", this).attr('val'));
                            }
                        });
                        $j(this).parent().parent().find("input[type='hidden']").attr('value',lista);
			$j('#filter_form').submit();
		});
 

        $j(".size-select-meta-box").hover(
                function(){
        	$j("#size-select-ul").slideDown('slow');
                },
                function(){
        	$j("#size-select-ul").delay(2000).slideUp('slow');
                }
        );
            
		$j(".size a").click(function(){
                        var lista=new Array();
                        $ar_li = $j(".size");
			var name = $j(this).attr('title');
			$j("#size-select-selected").html(name);
                        $j(this).toggleClass('selected');
                        $j.each($ar_li, function(){
                        if($j("a", this).hasClass("selected")){
                                lista.push($j("a", this).attr('val'));
                            }
                        });
                        $j(this).parent().parent().find("input[type='hidden']").attr('value',lista);
			$j('#filter_form').submit();
		});


  });

  </script>

