/*
* Plugins JS scripts
/*/
function changeAttributesPrice( ){
  var fPriceAdd = 0;
  var aSelects = gEBI( 'attributes' ).getElementsByTagName( 'select' );
  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] != '' ){
        fPriceAdd += ( generatePrice( fPrice, aAttribute[1] ) - fPrice );
      }
    }
  } // end for
	var cena = fPrice * 1 + fPriceAdd;
	var staracena = fPrice * 1 + fPriceAdd;
	if (cena > 2999 && cena < 5000 ){
	cena = cena - cena * 0.03;
	}
	else if (cena > 4999 && cena < 7500 ){
	cena = cena - cena * 0.04;
	}
	else if (cena > 7499 && cena < 10000 ){
	cena = cena - cena * 0.05;
	}
	else if (cena > 9999 && cena < 15000 ){
	cena = cena - cena * 0.07;
	}
	else if (cena > 14999 && cena < 20000 ){
	cena = cena - cena * 0.085;
	}
	else if (cena > 19999){
	cena = cena - cena * 0.1;
	}
	else {
	cena = fPrice * 1 + fPriceAdd;
	}
	if ( staracena == cena || zrabatowany != ""){
	gEBI('rabat').innerHTML = " ";
	gEBI( 'priceValue' ).innerHTML = changePriceFormat( fix( fPrice * 1 + fPriceAdd ) );
	}
	else {
	if (gEBI('rabat').innerHTML == " "){
	gEBI('rabat').innerHTML += "<br /><em>Po rabacie</em><strong id='priceValue1'></strong><span>zł</span><br /><em>Oszczędzasz:</em><strong id='priceValue2'></strong><span>zł</span>";
	}
	gEBI( 'priceValue' ).innerHTML = changePriceFormat( fix( fPrice * 1 + fPriceAdd ) );
  gEBI( 'priceValue1' ).innerHTML = changePriceFormat( fix( cena ) );
	gEBI( 'priceValue2' ).innerHTML = changePriceFormat( fix( (fPrice * 1 + fPriceAdd) - cena ) );
		}
	} // end function changeAttributesPrice
