
function configurable_product_select(matrix_array, color_array, size_array, image_path, product_id) {
   this.matrix_clicked = function(size, color, object) {

      var tr = object.parentNode.parentNode.childNodes;
      var td = null;
      var object_price_top = document.getElementById('product-price-'+product_id);
      var object_price_bottom = document.getElementById('product-price-'+product_id+'_clone');
      var object_color = document.getElementById('attribute76');
      var object_size = document.getElementById('attribute496');
      var object_image = document.getElementById('shippinglight');
      var object_image_text = document.getElementById('shippinglight_text');
      var object_msg_cart = document.getElementById('message_in_red');
	  var object_size_top = document.getElementById('size_top');
	  var object_color_top = document.getElementById('color_top');
	  var object_hide = document.getElementById('hide');
	  var object_cart_control = document.getElementById('cart_control');
	  var object_product_sku = document.getElementById('product-sku');


      var old_object;
      for(var i=1; i<tr.length; i++) {
         td = tr[i].childNodes;
         for(var j=0; j<td.length-1; j++) {
            if(td[j].className=="selected") {
               old_object=td[j];
            }
            if(td[j].className!="not_available") {
               td[j].className="";
            } else {
               td[j].className="not_available";
            }
         }
      }
      try {
         object_cart_control.style.display="block";
	 object_hide.style.display="inline";
	 object_size_top.innerHTML="<b>Gr&ouml;&szlig;e: </b>"+size_array[size];
	 object_color_top.innerHTML="<b>Farbe: </b>"+color_array[color];
         object_price_top.innerHTML=matrix_array[color][size]['price'];
         object_price_bottom.innerHTML=matrix_array[color][size]['price'];
	 object_product_sku.innerHTML="<br /><br /><b>Artikelnr.:</b> "+matrix_array[color][size]['sku'];
         object_color.value=color;
         object_size.value=size;
         object.className="selected";
         object_msg_cart.style.display="none";
         if(document.getElementById('old-price-'+product_id)){
            document.getElementById('old-price-'+product_id).innerHTML = matrix_array[color][size]['oldprice'];
         }
         if(document.getElementById('old-price-'+product_id+'_clone')){
            document.getElementById('old-price-'+product_id+'_clone').innerHTML = matrix_array[color][size]['oldprice'];
         }
         
         var qty = matrix_array[color][size]['qty'];
         var bco = matrix_array[color][size]['backorders'];
         if(qty==0 && bco==0) {
            object_image.src=image_path+"images/shippinglight_red.png";
            object_image_text.innerHTML="ausverkauft";
         } else if(qty>0) {
            object_image.src=image_path+"images/shippinglight_green.png";
            object_image_text.innerHTML="sofort lieferbar";
         } else {
            object_image.src=image_path+"images/shippinglight_yellow.png";
            object_image_text.innerHTML="lieferbar in 4 - 15 Tagen";
         }
      } catch(e) {
         try { old_object.className = "selected"; } catch(e) {}
         //alert(e.toString());
         //object_color.value="";
         //object_size.value="";
      }
      
   }
}

