function price_correct() { // this function updates the on-screen price (and shopping cart price) when an option with a price correction is selected // note that price corrections are concealed in the HTML of the product page using hidden variables. var optioncode = document.getElementById('options').options[document.getElementById('options').selectedIndex].value; // first see if there is a price adjustment for this option if (eval('document.getElementById(\'' + optioncode + '_price\')')) { // add the base price and price correction var newprice = parseInt(document.getElementById('base_price').value) + parseInt(eval('document.getElementById(\'' + optioncode + '_price\').value')) // set the new price document.getElementById('display_price').innerHTML = '£' + newprice; document.getElementById('PRICE').value = newprice; } else { // there's no price correction for this option, so make sure the base price is displayed document.getElementById('display_price').innerHTML = '£' + document.getElementById('base_price').value; document.getElementById('PRICE').value = document.getElementById('base_price').value; } }