function variantChange()
{
	 var variantName = '';
	 if (!aVariantNameList) return true;
	 
	 for (idVariant in aVariantNameList)
	 {
	    elm = document.getElementById('item_variant_'+idVariant+'_value');
	    if (!elm) continue;
	    
	    if (elm.checked === true) variantName += aVariantNameList[idVariant];
	 }
	
	 elm = document.getElementById('subName');
	 if (!elm) return true;
	 elm.innerHTML = ' - '+variantName;
	 
	 elm = document.getElementById('variantName');
	 if (!elm) return true;
	 elm.innerHTML = variantName;

  
}



function expeditionChange()
{
     var variantExpedition = '';
     if (!aVariantExpedition) return true;
     
     for (idVariant in aVariantExpedition)
     {
        elm = document.getElementById('item_variant_'+idVariant+'_value');
        if (!elm) continue;
        
        if (elm.checked === true) variantExpedition += aVariantExpedition[idVariant];
     }
    
     elm = document.getElementById('detail_expedition');
     if (!elm) return true;
     elm.innerHTML = variantExpedition;
     
}



function changePrice()
{
   var iVariantPriceVatAdd = 0;
   var iVariantPriceVat = 0;
   
   if (!aVariantNameList) return true;


   
   for (idVariant in aVariantNameList)
   {
      elm = document.getElementById('item_variant_'+idVariant+'_value');
      if (!elm) continue;
      
      
      if (elm.checked === true) 
      {
        iVariantPriceVatAdd += aVariantPriceVatAdd[idVariant];
        iVariantPriceVat = aVariantPriceVat[idVariant];
      }
   }
  
   // jestlize je iVariantPriceVat nenulove, a zaroven mame pouze jednu skupinu variant, tak uvest tuto cenu
   //if (iVariantPriceVat != 0) alert(iVariantPriceVat);
   if ((iVariantPriceVat != 0) && (iVariantGroupCount == 1))
   {
     //alert(iVariantPriceVat);
     iNewGoodsPrice = iVariantPriceVat;
   }
   else
   {
     elm = document.getElementById('addPriceVat-JS');
     if (elm) elm.innerHTML = iVariantPriceVatAdd;     
     
     elm = document.getElementById('addPrice-JS');
     if (elm) elm.innerHTML = Math.round(iVariantPriceVatAdd / ((iGoodsVat/100)+1));     
     
     iNewGoodsPrice = iGoodsPriceVat + iVariantPriceVatAdd;
   } 
   
   
   elm = document.getElementById('mainPriceVat-JS');
   if (elm) elm.innerHTML = iNewGoodsPrice + ',- Kč';

   iNewGoodsPriceWithoutVat = iNewGoodsPrice / ((iGoodsVat/100)+1);
   elm = document.getElementById('mainPrice-JS');
   if (elm) elm.innerHTML = Math.round(iNewGoodsPriceWithoutVat) + ',- Kč';
   
}

function changePaymentAdds(sVariantGroup, iNewPrice)
{
  elm = document.getElementById('addPriceVariantAmount_' + sVariantGroup);
  if (elm) elm.innerHTML = iNewPrice;
}


function imageChange(variantId)
{
  
  if (!aVariantImageURLList[variantId]) return true;
  if (aVariantImageURLList[variantId] == '') return true;

  elmImage = document.getElementById('detailMainImage');
  elmImage.src = aVariantImageURLList[variantId];    
  
  
  if (!aVariantImageHrefList[variantId]) alert('asfd'); //return true;
  if (aVariantImageHrefList[variantId] == '') alert('asfd'); //return true;
  
  elmHref = document.getElementById('detailMainImageHref');
  
  sJSHref = aVariantImageHrefList[variantId];
  elmHref.onclick = function () {return !shopGoodsImgDetail(sJSHref);};
}
