// Pricing for Pluh.net! OMG SECRET?

// setup fee doesn't change. Not unless I really want it to.
// if any of this changes update the php formulas too!
setup_fee = 24.99;

// default config.
default_config = 19.98;

// dollar values
gig_of_transfer = 1.25;
email_address = 1.00;
domain_name = 1.035;
gig_of_storage = 1.25;

function stupidround(original) {
	var result = Math.round(original*100)/100;
	return result;
}

function init() {
	var transfer = document.hosting_form.transfer.value;
	var email_addresses = document.hosting_form.email_addresses.value;
	var domain_names = document.hosting_form.domain_names.value;
	var storage = document.hosting_form.storage.value;
	var payment_frequency = document.hosting_form.payment_frequency.value;
	var total_services = ((transfer * gig_of_transfer) + (email_address * email_addresses) + (domain_name * domain_names) + (gig_of_storage * storage));
	// must calculate.
	// 25 50 65 70
	if (payment_frequency > 0) {
		
		// ok. do each formula one at a time
		
		if (payment_frequency == 12) {
			total_services = (total_services - (total_services * 0.25));
			document.getElementById("hosting_text").innerHTML = "25% savings! You will be billed once a year.";
		} else if (payment_frequency == 24) {
			total_services = (total_services - (total_services * 0.5));
			document.getElementById("hosting_text").innerHTML = "50% savings! You will be billed once every two years.";
		} else if (payment_frequency == 36) {
			total_services = (total_services - (total_services * 0.65));
			document.getElementById("hosting_text").innerHTML = "65% savings! You will be billed once every three years.";
		} else if (payment_frequency == 48) {
			total_services = (total_services - (total_services * 0.7));
			document.getElementById("hosting_text").innerHTML = "70% savings! You will be billed once every four years.";
		}
		
		total_services = (payment_frequency * total_services);
	} else {
		document.getElementById("hosting_text").innerHTML = "this will be billed monthly";
	}
	
	document.getElementById("hosting_total").innerHTML = stupidround(total_services);
	document.getElementById("grand_total").innerHTML = stupidround((total_services + setup_fee));
	document.getElementById("setup_fee").innerHTML = setup_fee;
}