function calculateWoodPrice(){ objWidth=document.getElementById('wood_width'); objDrop=document.getElementById('wood_drop'); objSwatchCategory=document.getElementById('swatch_category'); objSlatSize=document.getElementById('wood_slatSize_hidden'); objTapes=document.getElementById('wood_tapes'); objHoldDownBrackets=document.getElementById('wood_holdDownBrackets'); var width = objWidth.value; var drop = objDrop.value; var swatch_category = objSwatchCategory.value; var slatSize = objSlatSize.value; var tapes = objTapes.value; var holdDownBrackets = objHoldDownBrackets.value; var width_minimum = 300; var width_maximum = 2100; var drop_minimum = 10; var drop_maximum = 3000; switch (slatSize){ case '25': document.getElementById('wood_holdDownBracket_text').style.visibility='hidden'; document.getElementById('wood_holdDownBracket_text').style.display='none'; document.getElementById('wood_holdDownBracket_select').style.visibility='hidden'; document.getElementById('wood_holdDownBracket_select').style.display='none'; silentlySetHoldDownBrackets('No'); break; case '35': document.getElementById('wood_holdDownBracket_text').style.visibility='visible'; document.getElementById('wood_holdDownBracket_text').style.display='inline'; document.getElementById('wood_holdDownBracket_select').style.visibility='visible'; document.getElementById('wood_holdDownBracket_select').style.display='inline'; break; case '50': document.getElementById('wood_holdDownBracket_text').style.visibility='visible'; document.getElementById('wood_holdDownBracket_text').style.display='inline'; document.getElementById('wood_holdDownBracket_select').style.visibility='visible'; document.getElementById('wood_holdDownBracket_select').style.display='inline'; break; } if (!width || !drop) { objPrice=document.getElementById('wood_price'); objPrice.value='0'; document.getElementById('addButton').disabled=true; return false; } if (isNaN(parseFloat(width))) { alert("Sorry, the width entered ("+width+") is not a number. Please enter an integer in the width field."); objPrice=document.getElementById('wood_price'); objPrice.value='0'; document.getElementById('addButton').disabled=true; return false; } if (isNaN(parseFloat(drop))) { alert("Sorry, the drop entered ("+drop+") is not a number. Please enter an integer in the drop field."); objPrice=document.getElementById('wood_price'); objPrice.value='0'; document.getElementById('addButton').disabled=true; return false; } if (parseFloat(width_minimum)>parseFloat(width)) { alert("Sorry, the width entered ("+width+") is narrower than we are able to offer. Please enter a width between "+width_minimum+"mm and "+width_maximum+"mm."); objPrice=document.getElementById('wood_price'); document.getElementById('addButton').disabled=true; objPrice.value='0'; return false; } if (parseFloat(width_maximum)parseFloat(drop)) { alert("Sorry, the drop entered ("+drop+") is shorter than we are able to offer. Please enter a drop between "+drop_minimum+"mm and "+drop_maximum+"mm."); objPrice=document.getElementById('wood_price'); objPrice.value='0'; document.getElementById('addButton').disabled=true; return false; } if (parseFloat(drop_maximum) 9998 || parseFloat(price) < 1) { alert("Sorry, the configuration specified is not available."); objPrice=document.getElementById('wood_price'); objPrice.value='0'; document.getElementById('addButton').disabled=true; return false; } saving = roundNumber(parseFloat(beforeDiscount - price),'0'); saving = '£' + saving; price = '£' + price; objPrice=document.getElementById('wood_price'); objPrice.value=price; objSaving=document.getElementById('wood_saving'); objSaving.value=saving; document.getElementById('addButton').disabled=false; } function silentlySetSlatSizeSelect(slatSize){ objSelect=document.getElementById('wood_slatSize_hidden'); objSelect.value=slatSize; } function silentlySetHoldDownBrackets(holdDownBrackets){ objSelect=document.getElementById('wood_holdDownBrackets'); objSelect.value=holdDownBrackets; }