function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function roundNumber(num, dec) { var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); return result; } function formatAsMoney(mnt) { mnt -= 0; mnt = (Math.round(mnt*100))/100; return (mnt == Math.floor(mnt))? mnt + '.00' : ( (mnt*10 == Math.floor(mnt*10))? mnt + '0' : mnt); } function checkFee(){ if(!IsInt(document.frmREG.Fee.value,true)){ alert('The fee must be a number.'); document.frmREG.Fee.value = ''; document.frmREG.VAT.value = ''; document.frmREG.TotalFee.value = ''; } else{ document.frmREG.VAT.value = (Math.round(document.frmREG.Fee.value.replace(',','')*document.frmREG.mytax.value)); document.frmREG.VAT.value = document.frmREG.VAT.value.substring(0,document.frmREG.VAT.value.length-2) + '.' + document.frmREG.VAT.value.substring(document.frmREG.VAT.value.length-2,document.frmREG.VAT.value.length); if(document.frmREG.VAT.value.length>6){ document.frmREG.VAT.value = document.frmREG.VAT.value.substring(0,document.frmREG.VAT.value.length-6) + ',' + document.frmREG.VAT.value.substring(document.frmREG.VAT.value.length-6,document.frmREG.VAT.value.length)}; document.frmREG.TotalFee.value = (Math.round((document.frmREG.Fee.value.replace(',','')*100)+(document.frmREG.VAT.value.replace(',','')*100))); document.frmREG.TotalFee.value = document.frmREG.TotalFee.value.substring(0,document.frmREG.TotalFee.value.length-2) + '.' + document.frmREG.TotalFee.value.substring(document.frmREG.TotalFee.value.length-2,document.frmREG.TotalFee.value.length); if(document.frmREG.TotalFee.value.length>6){ document.frmREG.TotalFee.value = document.frmREG.TotalFee.value.substring(0,document.frmREG.TotalFee.value.length-6) + ',' + document.frmREG.TotalFee.value.substring(document.frmREG.TotalFee.value.length-6,document.frmREG.TotalFee.value.length)}; } } function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } function IsInt(checkStr,bReal) { var checkOK = "0123456789,"; var allValid = true; var allNum = ""; if (bReal){ checkOK = checkOK + '.';} for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch != ",") allNum += ch; } if (!allValid) { return false; } else return true; } function updateFee(){ var theFee; // automatically populate gross fee for // package type switch (document.frmREG.NoM.value) { case "Silver#SILVER": theFee = 16950.00; break; case "Gold#GOLD": theFee = 23950.00; break; case "Lead Sponsor#LD SPONSOR": theFee = 34950.00; break; case "Summit Lead Sponsor#SUMMIT LEAD SPONSOR": theFee = 39950.00; break; case "Platinum#PLATINUM": theFee = 26950.00; break; case "Drinks Reception Sponsor#LUNCH SPNS": theFee = 10000.00; break; case "Delegate Lounge Sponsor#SPONSORSHIP": theFee = 8950.00; break; case "Delegate Bag Sponsor#BRFCASE SPNS": theFee = 5000.00; break; case "Online Package#ONLINE": theFee = 9950.00; break; case "Exhibitor Package#EXHIBITOR": theFee = 8950.00; break; case "Catalogue Sponsor#CAT SPNS": theFee = 5000.00; break; case "Lead Awards Ceremony Partner#AWARDS": theFee = 17950; break; case "Category Sponsor#LD SPONSOR": theFee = 8950.00; break; case "Awards Champagne Reception Sponsor#AWARDS": theFee = 9950; break; case "Focus Day Lunch Sponsor#FOCUS LUNCH": theFee = 8250.00; break; case "Awards Menu and Wine Sponsor#AWARDS": theFee = 5950.00; break; case "On-site Networking Package#DELG": theFee = 500.00; break; case "Ceremony Table Sponsor#AWARDS": theFee = 1995.00; break; case "SCL Focus Day Sponsor#FD SPONSOR": theFee = 26950.00; break; case "Show Guide Advert#ADVERT": theFee = 995.00; break; default: theFee = "0.00"; break; } var theTicket // automatically add ticket price switch (document.frmREG.Tickets.value) { case "1": theTicket = 150; break; case "2": theTicket = 300; break; case "3": theTicket = 360; break; case "4": theTicket = 480; break; case "5": theTicket = 600; break; default: theTicket = 0; break; } theFee = theFee + theTicket; if (document.getElementById("id_keynote").checked) { theFee=theFee+695.00; } // update fee box document.frmREG.Fee.value = addCommas(formatAsMoney(theFee)); // ensure tax and total is calculated if (document.frmREG.NoM.value=="Online Package#ONLINE") { document.frmREG.VAT.value =0; document.frmREG.TotalFee.value=document.frmREG.Fee.value; } else { checkFee(); } } function updateDelFee(delNo){ var theFee; var theExtra; // automatically populate gross fee for delegate // package type switch (document.frmREG.Package.value) { case "VIP Delegate Package#DELG": theFee = "1795.00"; break; case "ONE DAY delegate package 9th June -- COMP BOOKING#DELG": theFee = "950.00"; break; case "ONE DAY delegate package 10th June -- COMP BOOKING#DELG": theFee = "950.00"; break; case "Industry Delegate Package -- COMP BOOKING#DELG": theFee = "2250.00"; break; case "Platinum Delegate Package -- COMP BOOKING#DELG": theFee = "2850.00"; break; case "ONE DAY delegate package 9th June#DELG": theFee = "950.00"; break; case "ONE DAY delegate package 10th June#DELG": theFee = "950.00"; break; case "Industry Delegate Package#DELG": theFee = "1295.00"; break; case "Gold Delegate Package#DELG": theFee = "2550.00"; break; case "Platinum Delegate Package#DELG": theFee = "1295.00"; break; case "Supplier Delegate Package#SUPP DELG": theFee = "3250.00"; break; case "Delegate Discount Package#DELG": theFee = "995.00"; break; default: theFee = "0.00"; break; } // add extra for Virtual Conference booking if (document.frmREG.ondemand.checked) { theVC = parseFloat("395"); } else { theVC = parseFloat("0"); } // theFee = parseFloat(theFee) + theVC; if (document.frmREG.extra.checked) { theExtra = 200; } else { theExtra = 0; } // update fee box document.frmREG.Fee.value = ((theFee) * delNo) + theVC; // ensure tax and total is calculated checkFee(); }