<!-- var mobbill=0.00; var mobpbill=0.00; var linerent=0.00; var mobprent=9.99; var itembill=0.00; var peakcost=0; var peakmobp=8; var offpcost=0; var offpmobp=5; var profile; var offnet=0; var offnetmp=35; var onnet=0; var onnetmp=5; var mobmins=0; var onmobmins=0; var mobcallcost; var onmobcallcost; var textm=0; var textmp=8; var numtext=0; var textcost; var mins; var freemins=0; var callcost; var numoffpmin; var numpeakmin; var totalmins; var lowratemins; var total; var x; var y; var win=false; var tpcharge; var btcharge=0.00; var landdiff; var year2diff=0; var yeardiff=0; function compute() { lowratemins=0; freemins=0; total=0; tpcharge=0; mobbill=0; landdiff=0; year2diff=0; yeardiff=0; if((document.estimator.mobbill.value>0)&&(document.estimator.offpcost.value>0)&&(document.estimator.peakcost.value>0)) { mobbill=parseInt(document.estimator.mobbill.value)*100; offpcost=parseInt(document.estimator.offpcost.value); peakcost=parseInt(document.estimator.peakcost.value); linerent=document.estimator.linerent.value*100; itembill=document.estimator.itembill.value*100; mobmins=document.estimator.mobmins.value; mobcallcost=(document.estimator.offnet.value * mobmins); onmobmins=document.estimator.onmobmins.value; onmobcallcost=(document.estimator.onnet.value * onmobmins); numtext=document.estimator.numtext.value; textcost=(document.estimator.textm.value * numtext); callcost=mobbill-linerent-onmobcallcost-mobcallcost-textcost-itembill; if(document.estimator.free.selectedIndex==1) { callcost=callcost+(document.estimator.freemins.value*100); } if(callcost<0) { alert('Please double check your figures.\nThe calls you make exceed the bill.\nWe\'re not convinced this deal is possible!'); return; } profile=parseInt(document.estimator.profile.selectedIndex); switch (profile) { case 0://All Off-Peak numpeakmin=0; numoffpmin=parseInt(callcost/offpcost); break; case 1://Mainly Off-Peak y=3; x=parseInt(callcost/(offpcost+(y*peakcost))); numpeakmin=x; numoffpmin=parseInt(y*x); break; case 2://Half of each x=parseInt(callcost/(offpcost+peakcost)); numpeakmin=x; numoffpmin=x; break; case 3://Mainly Peak y=1/3; x=parseInt(callcost/(offpcost+(y*peakcost))); numpeakmin=x; numoffpmin=parseInt(y*x); break; case 4://All Peak numoffpmin=0; numpeakmin=parseInt(callcost/peakcost); break; } if(document.estimator.free.selectedIndex==0) { freemins=document.estimator.freemins.value; } freemins=parseInt(freemins); totalmins=numoffpmin+numpeakmin+freemins; if (totalmins>200) { lowratemins=totalmins-200; totalmins=200; } mobpbill=(parseInt(mobprent*100))+(parseInt(lowratemins*offpmobp))+(parseInt(totalmins*peakmobp))+(parseInt(mobmins*offnetmp))+(parseInt(onmobmins*onnetmp))+(parseInt(numtext*textmp)); mobpbill=mobpbill/100; document.estimator.mobpbill.value=mobpbill; total=parseInt(1200*((mobbill/100)-mobpbill))/100; yeardiff=24.00; } if(document.estimator.btcharge.value>28)//allow for standing charge { btcharge=parseInt(document.estimator.btcharge.value)-28; tpcharge=(parseInt((btcharge*66.66)/3)/100); if(mobbill<=0) tpcharge=parseInt((tpcharge+1.76)*100)/100; landdiff=(btcharge*4)-(parseInt(tpcharge*1200)/100); if(mobbill<=0) { landdiff=landdiff-23.50; year2diff=23.50; } total=total+landdiff; } document.estimator.tpcharge.value=tpcharge; document.estimator.total.value=parseInt(total*100)/100; document.estimator.total2.value=(parseInt((total+year2diff+yeardiff)*100))/100; document.estimator.total3.value=(parseInt((total+year2diff+(2*yeardiff))*100))/100; if(total>100) { message='Thanks for trying Telecom plus.\n\nSwitch to us and you could\nsave over �'+parseInt(total/10)*10+' this year!!'; alert(message); } if(total<0) { message='Thanks for trying Telecom plus.\nIt appears that you have a\nvery good deal from your\nexisting supplier, well done!'; message2='\n\nPlease let us know who your\nservice provider is, so that\nwe can beat them next time!'; alert(message); } } function ResetForm() { document.estimator.mobbill.value=0.00; document.estimator.mobpbill.value=0.00; document.estimator.linerent.value=0.00; document.estimator.mobprent.value=mobprent; document.estimator.itembill.value=0.00; document.estimator.peakcost.value=0; document.estimator.peakmobp.value=peakmobp; document.estimator.offpcost.value=0; document.estimator.offpmobp.value=offpmobp; document.estimator.mobmins.value=0; document.estimator.offnet.value=0; document.estimator.offnetmp.value=offnetmp; document.estimator.onmobmins.value=0; document.estimator.onnet.value=0; document.estimator.onnetmp.value=onnetmp; document.estimator.textm.value=0; document.estimator.textmp.value=textmp; document.estimator.numtext.value=0; document.estimator.freemins.value=0; document.estimator.btcharge.value=0.00; document.estimator.tpcharge.value=0.00; document.estimator.total.value=0.00; document.estimator.total2.value=0.00; document.estimator.total3.value=0.00; } function popUp() { if (win) { win.close(); } var win_x = screen.width / 2 - 200; var win_y = screen.height / 2 - 75; win = window.open('','more','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=400,height=170,resizable=0,screenX=' + win_x + ',screenY=' + win_y + ',left=' + win_x + ',top=' + win_y); win.document.writeln('
');
win.document.writeln('');
win.document.writeln('
|
| '); win.document.writeln(''); win.document.writeln('click to close |
| '); win.document.writeln(''); win.document.writeln(' |