var service = new webhosting_service; var webhostings = Array(); function init_page() { webhostings[1] = new webhosting( 1, 'Gamer BSD Lite', '50 MB of webspace on fast FreeBSD webserver
PHP4 and Perl scripting languages
MySQL database
750 MB of transfers per month
1 POP3 mailbox
Email forwarding (anyone@yourname.com)', 250.00, 293.80 ); webhostings[1].add_payment_term( 3, 0.10 ); webhostings[1].add_payment_term( 12, 0.00000 ); webhostings[2] = new webhosting( 2, 'Gamer BSD', '100 MB of webspace on fast FreeBSD webserver
PHP4 and Perl scripting languages
MySQL database
2 GB of transfers per month
1 POP3 mailbox
Registration and hosting of 1 domain name (e.g. www.yourname.com or www.yourname.co.uk)
Email forwarding (anyone@yourname.com)
Phone and email support', 999.00, 1173.80 ); webhostings[2].add_payment_term( 1, 0.00 ); webhostings[2].add_payment_term( 12, 0.17417 ); webhostings[3] = new webhosting( 3, 'Gamer BSD Elite', '250 MB of webspace on fast FreeBSD webserver
PHP4 and Perl scripting languages
MySQL database
5 GB of transfers per month
20 POP3 mailboxes
Registration and hosting of 1 domain name (e.g. www.yourname.com or www.yourname.co.uk)
E-mail forwarding (anyone@yourname.com)
SSL (secure transactions to server) available on request, for accepting
secure data/sales.
SSH shell access available on request
Phone and email support', 1999.00, 2348.80 ); webhostings[3].add_payment_term( 1, 0.00 ); webhostings[3].add_payment_term( 12, 0.17040 ); webhostings[4] = new webhosting( 4, 'Gamer Win2k', '100 MB of webspace on fast Windows webserver
ASP scripting language
MySQL database
2 GB of transfers per month
1 POP3 mailbox
Registration and hosting of 1 domain name (e.g. www.yourname.com or www.yourname.co.uk)
Email forwarding (anyone@yourname.com)
Phone and email support', 1499.00, 1761.30 ); webhostings[4].add_payment_term( 1, 0.00 ); webhostings[4].add_payment_term( 12, 0.17167 ); webhostings[5] = new webhosting( 5, 'Gamer Win2k Elite', '250 MB of webspace on fast Windows webserver
ASP scripting language
MySQL database
5 GB of transfers per month
20 POP3 mailboxes
Registration and hosting of 1 domain name (e.g. www.yourname.com or www.yourname.co.uk)
E-mail forwarding (anyone@yourname.com)
SSL (secure transactions to server) available on request, for accepting
secure data/sales.
Phone and email support', 2499.00, 2936.30 ); webhostings[5].add_payment_term( 1, 0.00 ); webhostings[5].add_payment_term( 12, 0.16967 ); // Populate select box temp = Array(); for ( j in webhostings ) { temp.push( webhostings[j].name + '#:#' + j ); } //temp.sort(); webhosting_select = document.getElementById( "webhosting" ).options; j = 0; for ( i in temp ) { data = String( temp[ i ] ); data = data.split( "#:#" ); temp_option = new Option( data[ 0 ], data[ 1 ], 0, 0 ); webhosting_select[j++] = temp_option; } service.service_typeid = webhosting_select[0].value; update_service_desc(); update_payment_terms(); update_pricing(); } function update_service() { // Service type webhosting = document.getElementById( "webhosting" )[document.getElementById( "webhosting" ).selectedIndex].value; service.service_typeid = webhosting; // Payment term payment_terms = document.getElementById( "actionForm" ).paymentterm; if ( 'undefined' != typeof( payment_terms ) ) { service.payment_term = 0; if ( 'undefined' != typeof( payment_terms.length ) ) { for( i = 0; i < payment_terms.length; i++ ) { if ( i == 0 ) { default_payment_term = payment_terms[i].value; } if ( payment_terms[i].checked ) { service.payment_term = payment_terms[i].value; } } } else { default_payment_term = payment_terms.value; } if ( ! service.payment_term ) { service.payment_term = default_payment_term; } } } function update_service_desc() { webhosting = service.service_typeid; document.getElementById( "service_desc" ).innerHTML = webhostings[webhosting].description; } function update_payment_terms() { payment_terms = document.getElementById( "actionForm" ).paymentterm; current_payment_term = 0; if ( 'undefined' != typeof( payment_terms ) ) { if ( 'undefined' != typeof( payment_terms.length ) ) { for( i = 0; i < payment_terms.length; i++ ) { if ( payment_terms[i].checked ) { current_payment_term = payment_terms[i].value; } } } else { current_payment_term = payment_terms.value; } } tdpt = document.getElementById( "td_payment_terms" ); tdpt.innerHTML = ''; webhosting = document.getElementById( "webhosting" )[document.getElementById( "webhosting" ).selectedIndex].value; payment_terms = webhostings[webhosting].payment_terms; if ( payment_terms.length > 0 ) { cpt_exists = 0; def_pt = 0; for( i in payment_terms ) { if ( def_pt == 0 ) { def_pt = payment_terms[i].payment_term; } if ( payment_terms[i] ) { cpt_exists = ( payment_terms[i].payment_term == current_payment_term ) ? 1 : cpt_exists; } } if ( cpt_exists == 0 ) { current_payment_term = def_pt; } for( i in payment_terms ) { if ( payment_terms[i] ) { checked = ( payment_terms[i].payment_term == current_payment_term ) ? ' checked="checked"' : ''; tdpt.innerHTML += ' ' + payment_terms[i].payment_term + ' Month(s)
' } } } } function update_pricing() { update_service(); webhosting = service.service_typeid; webhosting = webhostings[webhosting]; total = service.cost(); multiplier = ( 1 - service.discount ) * service.payment_term; // update breakdown td_breakdown = document.getElementById( "breakdown" ); td_breakdown.innerHTML = webhosting.name + ": £" + format_currency( Math.round( service.base_cost * multiplier ) / 100 ) + "
"; total = webhosting.incvat; // update running_total td_running_total = document.getElementById( "running_total" ); td_running_total.innerHTML = "£" + format_currency( Math.round( total * multiplier ) / 100 ); // update extra_money_info td_extra_money_info = document.getElementById( "extra_money_info" ); td_extra_money_info.innerHTML = ""; if ( webhosting.payment_terms[service.payment_term].discount > 0 ) { td_extra_money_info.innerHTML += "Discount: £" + format_currency( Math.round( service.discount_cost ) / 100 ) + "
"; td_extra_money_info.innerHTML += "Equivalent Monthly: £" + format_currency( Math.round( ( total / service.payment_term * multiplier ) ) / 100 ); } } function format_currency( fAmount ) { aAmount = fAmount.toString().split( "." ); if ( aAmount[1] ) { if ( aAmount[1].length == 1 ) { aAmount[1] += "0"; } } else { aAmount[1] = "00"; } return aAmount[0] + "." + aAmount[1]; }