/*
Quick.Cart plugins JavaScript
*/
function changeAttributesPrice( ){
  var fPriceAdd = 0;
  for (i=0; i<document.getElementsByTagName('input').length; i++) {
    if (document.getElementsByTagName('input')[i].type == 'radio' && document.getElementsByTagName('input')[i].className == 'attributes')
    {
      var aSelectValue = getCheckedValue(document.getElementsByTagName('input')[i]);
      if (aSelectValue.length>0) break;
    }
  }
  if( aSelectValue != '' )
    var aAttribute = aSelectValue.split( "|" );
  else
    var aAttribute = Array( 0, 0 );
  if( aAttribute[1] != '' ){
    aAttribute[1] = fix( aAttribute[1] ) * 1;
    fPriceAdd += aAttribute[1];
  }
  gEBI( 'price' ).innerHTML = changePriceFormat( fix( fPrice * 1 + fPriceAdd ) );
}

function changeAttributesPrice_OLD( ){
  var fPriceAdd = 0;
  var aSelects = gEBI( 'attributes' ).getElementsByTagName( 'input' );
  for( var i = 0; i < aSelects.length; i++ ){
    var aSelect = aSelects[i];
    if( aSelect.className == 'attributes' ){
      var aSelectValue = aSelect.options[aSelect.options.selectedIndex].value;
      if( aSelectValue != '' )
        var aAttribute = aSelectValue.split( "|" );
      else
        var aAttribute = Array( 0, 0 );
      if( aAttribute[1] != '' ){
        aAttribute[1] = fix( aAttribute[1] ) * 1;
        fPriceAdd += aAttribute[1];
      }
    }
  } // end for
  gEBI( 'price' ).innerHTML = changePriceFormat( fix( fPrice * 1 + fPriceAdd ) );
}

function getCheckedValue(radioObj) {
  if(!radioObj)
  return "";
  var radioLength = radioObj.length;
  if(radioLength == undefined)
    if(radioObj.checked)
      return radioObj.value;
    else
      return "";
    for(var i = 0; i < radioLength; i++) {
      if(radioObj[i].checked) {
        return radioObj[i].value;
      }
    }
  return "";
}
// end function changeAttributesPrice


