function createChangeSelects(){
   var itemPage = document.getElementById('item-page');
   if(!itemPage)return;
   var selects = itemPage.getElementsByTagName('select');
   for(i=0;i<selects.length;i++){
      fn = function(){displayPrice();}
      if (selects[i].addEventListener){
         selects[i].addEventListener('change', fn, false);
      } else if (selects[i].attachEvent){
         selects[i].attachEvent('onchange', fn);
      } else {
         selects[i].onchange=fn;
      }
   }
}

function displayPrice(){
   var selects = document.getElementsByTagName('select');
   if(document.getElementById('sale-price-rt')){
      var priceId = document.getElementById('sale-price-rt');
   } else if(document.getElementById('price-rt-with-sale')){
      var priceId = document.getElementById('price-rt-with-sale');
   } else{
      var priceId = document.getElementById('price-rt');
   }
   var price =priceId.innerHTML.substring(1)
   price = price.replace(/,/g,"");
   price = parseFloat(price);
   var add = 0;
   for(i=0;i<selects.length;i++){
      var value = selects[i].options[selects[i].selectedIndex].value;
      num = value.split(/\(\+(.*?)\)/);
      if(num[1]!=null){
         add = parseFloat(value.substring(num[0].length+2, value.indexOf(')')));
         price+=add;
      }
      /*add=parseFloat(num[1]); price+=add;}
      alert(num[1]);*/
   }
   document.getElementById('mss-new-price').innerHTML = "$"+price.toFixed(2);
   document.getElementById('mss-new-price-div').style.display="block";
}
window.addEvent('domready', function(){
   createChangeSelects();
});
