function CommaFormatted(amount)
{
var delimiter = ","; // replace comma if desired
var a = amount.split('.',2)
var d = a[1];
var i = parseInt(a[0]);
if(isNaN(i)) { return ''; }
var minus = '';
if(i < 0) { minus = '-'; }
i = Math.abs(i);
var n = new String(i);
var a = [];
while(n.length > 3)
{
var nn = n.substr(n.length-3);
a.unshift(nn);
n = n.substr(0,n.length-3);
}
if(n.length > 0) { a.unshift(n); }
n = a.join(delimiter);
if(d.length < 1) { amount = n; }
else { amount = n + '.' + d; }
amount = minus + amount;
return amount;
}
function calculate() {
var output = document.getElementById("result");
var info = document.getElementById("form");
var output2 = document.getElementById("resultinfo");
var od = parseFloat(document.getElementById("od").value);
var id = parseFloat(document.getElementById("id").value);
var costhb = 6.25;
var lrate = 85;
var ipr = 0.01;
var vc = 550;
var len = parseFloat(document.getElementById("len").value);
var cost = parseFloat(document.getElementById("cost").value);
var chuck = document.getElementById("chucking").value;
var parts = parseFloat(document.getElementById("parts").value);
var saving = (((((((((od)*(od))*2.699)/12)*(cost))*(len))-((((((od)-(((od)-(id))/2))*(((od)-(id))/2)*10.73)/12)*(costhb))*(len)))+(((lrate)/60)*((len)/((((vc)*3.82)/((id)))*(ipr)))))*(parts));
saving2 = saving.toFixed(2);
saving2 = CommaFormatted(saving2);
form.innerHTML = "";
if(saving <= 0) {
output.innerHTML = "
| For your component no obvious savings can be identified by using hollow bar, but we might be able to help you save by finding other solutions, so please do not hesitate to contact us. |
"+"
"+output2.innerHTML;
}
else {
output.innerHTML = "
| You will save $"+saving2+" |
"+"
"+output2.innerHTML;
}
}
function popup(argx, argy, linkx) {
window.open(linkx, "popup", innerWidth=argx, innerHeight=argy);
window.focus("popup");
window.close("popup");
}
function change_img(){
var images=new Array()
images[1]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/all.gif?OpenElement"
images[2]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/collection3.gif?OpenElement"
images[3]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/strip1.gif?OpenElement"
images[4]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/collection.gif?OpenElement"
images[5]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/bar.gif?OpenElement"
images[6]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/die.gif?OpenElement"
images[7]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/springwire1.gif?OpenElement"
images[8]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/strip2.gif?OpenElement"
images[9]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/strip3.gif?OpenElement"
images[10]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/tube.gif?OpenElement"
images[11]="/sandvik/0140/internet/se01280.nsf/E37583B30932212785256BFB0048DCCB/$file/collection4.gif?OpenElement"
var i=Math.floor(Math.random()*images.length)
if (i==0)
i=1
document.write(' | ')
}