// JavaScript Document

	function hideItem(id){
		
		document.getElementById(id).style.display = "none";
		
	}

	function showItem(id){
		
		document.getElementById(id).style.display = "block";	
		
	}	
	
	
		formatCurrency = function (num) // Adds commas to a 'toFixed(2)' number.
	
	{
		
		num = num.toString().replace(/\|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		
		return (((sign)?'':'-') + '' + num + '.' + cents);
		
	};	

	
	function calculateHostingAndSMS(hostingSize, domainTld){
		
		var hostingAmount = document.getElementById(hostingSize).value;
		var domainAmount = document.getElementById(domainTld).value;
		var costingBreakDown = document.getElementById('costingBreakDown').innerHTML;
		var smsQuantity = null;
		
		
		if(hostingAmount == 'Select Hosting Account' || domainAmount == 'Select Domain Extension') {
			
			alert("Invalid selection!\nChoose a Hosting account AND a Domain name extention");
			return document.getElementById('costingBreakDown').innerHTML = "<font color=red><b>Choose a Hosting account AND a Domain name to view Pricing Details</b></font>";
			
		} else {

			hostingAmount = parseFloat(hostingAmount).toFixed(2);
			domainAmount = parseFloat(domainAmount).toFixed(2);
			
			// The Hosting and SMS calculation...

			if(hostingAmount == 1000.00) {
				emailAccounts = 10;
				MySQLDatabases = 10;
				MsAccessDatabases = 10;
				MsSQLDatabases = 1;
				ftpAccounts = 1;
				smsQuantity = 10;
			} else if(hostingAmount == 2000.00) {
				emailAccounts = 20;
				MySQLDatabases = 20;
				MsAccessDatabases = 20;
				MsSQLDatabases = 1;
				ftpAccounts = 2;
				smsQuantity = 20;
			} else if(hostingAmount == 3000.00) {
				emailAccounts = 30;
				MySQLDatabases = 30;
				MsAccessDatabases = 30;
				MsSQLDatabases = 1;
				ftpAccounts = 3;
				smsQuantity = 30;
			} else if(hostingAmount == 4000.00) {
				emailAccounts = 40;
				MySQLDatabases = 40;
				MsAccessDatabases = 40;
				MsSQLDatabases = 1;
				ftpAccounts = 4;
				smsQuantity = 40;
			} else if(hostingAmount == 5000.00) {
				emailAccounts = 50;
				MySQLDatabases = 50;
				MsAccessDatabases = 50;
				MsSQLDatabases = 1;
				ftpAccounts = 5;
				smsQuantity = 50;
			} else if(hostingAmount == 8000.00) {
				emailAccounts = 100;
				MySQLDatabases = 100;
				MsAccessDatabases = 100;
				MsSQLDatabases = 1;
				ftpAccounts = 10;
				smsQuantity = 100;
			} else if(hostingAmount == 12000.00) {
				emailAccounts = 200;
				MySQLDatabases = 200;
				MsAccessDatabases = 200;
				MsSQLDatabases = 1;
				ftpAccounts = 20;
				smsQuantity = 120;
			} else if(hostingAmount == 15000.00) {
				emailAccounts = 500;
				MySQLDatabases = 500;
				MsAccessDatabases = 500;
				MsSQLDatabases = 1;
				ftpAccounts = 50;
				smsQuantity = 150;
			} else if(hostingAmount == 20000.00) {
				emailAccounts = '1,000';
				MySQLDatabases = '1,000';
				MsAccessDatabases = '1,000';
				MsSQLDatabases = 1;
				ftpAccounts = 100;
				smsQuantity = 250;
			}
			
			total = parseInt(hostingAmount) + parseInt(domainAmount);
			total = parseFloat(total).toFixed(2);
			
			total = "<font color=red size=2 face=verdana><b>NGN " + formatCurrency(total) + " per year + Free " + smsQuantity + " SMS Units</b></font>";
			total += "<p>";
			total += "<strong><font size=2>Costing Breakdown...</font></strong>";
			total += "<p>";
			total += "<a href='domain-name-registration.php#com.ng'><img src=images/order.gif align=right /></a>";
			total += "<strong>Web Hosting:</strong> NGN " + formatCurrency(parseInt(hostingAmount)) + "<br />";
			total += "<strong>Domain Name Registration:</strong> NGN " + formatCurrency(parseInt(domainAmount));
			total += "<p>";
			total += "<strong>Email Accounts:</strong> " + emailAccounts  + "<br />";
			total += "<strong>FTP Accounts:</strong> " + ftpAccounts  + "<br />";
			total += "<strong>Free SMS Credits:</strong> " + smsQuantity;
			total += "<p>";
			total += "<strong>Databases</strong><br />";
			total += "<strong>MySQL: </strong>" + MySQLDatabases  + "<br />";
			total += "<strong>MicroSoft SQL Server 2000/2005:</strong> " + MsSQLDatabases  + "<br />";
			total += "<strong>MicroSoft Access:</strong> " + MsAccessDatabases;
			
			
			document.getElementById('costingBreakDown').innerHTML = total;
			
			return document.getElementById('costingBreakDown').innerHTML; 
		
		}
		
	}
	
	function calculateHosting(hostingSize, domainTld){
		
		var hostingAmount = document.getElementById(hostingSize).value;
		var domainAmount = document.getElementById(domainTld).value;
		var costingBreakDown = document.getElementById('costingBreakDown').innerHTML;
		var smsQuantity = null;
		
		
		if(hostingAmount == 'Select Hosting Account' || domainAmount == 'Select Domain Extension') {
			
			alert("Invalid selection!\nChoose a Hosting account AND a Domain name extention");
			return document.getElementById('costingBreakDown').innerHTML = "<font color=red><b>Choose a Hosting account AND a Domain name to view Pricing Details</b></font>";
			
		} else {

			hostingAmount = parseFloat(hostingAmount).toFixed(2);
			domainAmount = parseFloat(domainAmount).toFixed(2);
			
			// The Hosting and SMS calculation...

			if(hostingAmount == 1000.00) {
				emailAccounts = 10;
				MySQLDatabases = 10;
				MsAccessDatabases = 10;
				MsSQLDatabases = 1;
				ftpAccounts = 1;
/*				smsQuantity = 10;
*/			} else if(hostingAmount == 2000.00) {
				emailAccounts = 20;
				MySQLDatabases = 20;
				MsAccessDatabases = 20;
				MsSQLDatabases = 1;
				ftpAccounts = 2;
/*				smsQuantity = 20;
*/			} else if(hostingAmount == 3000.00) {
				emailAccounts = 30;
				MySQLDatabases = 30;
				MsAccessDatabases = 30;
				MsSQLDatabases = 1;
				ftpAccounts = 3;
/*				smsQuantity = 30;
*/			} else if(hostingAmount == 4000.00) {
				emailAccounts = 40;
				MySQLDatabases = 40;
				MsAccessDatabases = 40;
				MsSQLDatabases = 1;
				ftpAccounts = 4;
/*				smsQuantity = 40;
*/			} else if(hostingAmount == 5000.00) {
				emailAccounts = 50;
				MySQLDatabases = 50;
				MsAccessDatabases = 50;
				MsSQLDatabases = 1;
				ftpAccounts = 5;
/*				smsQuantity = 50;
*/			} else if(hostingAmount == 8000.00) {
				emailAccounts = 100;
				MySQLDatabases = 100;
				MsAccessDatabases = 100;
				MsSQLDatabases = 1;
				ftpAccounts = 10;
/*				smsQuantity = 100;
*/			} else if(hostingAmount == 12000.00) {
				emailAccounts = 200;
				MySQLDatabases = 200;
				MsAccessDatabases = 200;
				MsSQLDatabases = 1;
				ftpAccounts = 20;
/*				smsQuantity = 120;
*/			} else if(hostingAmount == 15000.00) {
				emailAccounts = 500;
				MySQLDatabases = 500;
				MsAccessDatabases = 500;
				MsSQLDatabases = 1;
				ftpAccounts = 50;
/*				smsQuantity = 150;
*/			} else if(hostingAmount == 20000.00) {
				emailAccounts = '1,000';
				MySQLDatabases = '1,000';
				MsAccessDatabases = '1,000';
				MsSQLDatabases = 1;
				ftpAccounts = 100;
/*				smsQuantity = 250;
*/			}
			
			total = parseInt(hostingAmount) + parseInt(domainAmount);
			total = parseFloat(total).toFixed(2);
			
			total = "<font color=red size=2 face=verdana><b>NGN " + formatCurrency(total) + " per year</b></font>";
			total += "<p>";
			total += "<strong><font size=2>Costing Breakdown...</font></strong>";
			total += "<p>";
			total += "<a href='domain-name-registration.php#com.ng'><img src=images/order.gif align=right /></a>";
			total += "<strong>Web Hosting:</strong> NGN " + formatCurrency(parseInt(hostingAmount)) + "<br />";
			total += "<strong>Domain Name Registration:</strong> NGN " + formatCurrency(parseInt(domainAmount));
			total += "<p>";
			total += "<strong>Email Accounts:</strong> " + emailAccounts  + "<br />";
			total += "<strong>FTP Accounts:</strong> " + ftpAccounts  + "<br />";
/*			total += "<strong>Free SMS Credits:</strong> " + smsQuantity;
*/			total += "<p>";
			total += "<strong>Databases</strong><br />";
			total += "<strong>MySQL: </strong>" + MySQLDatabases  + "<br />";
			total += "<strong>MicroSoft SQL Server 2000/2005:</strong> " + MsSQLDatabases  + "<br />";
			total += "<strong>MicroSoft Access:</strong> " + MsAccessDatabases;
			
			
			document.getElementById('costingBreakDown').innerHTML = total;
			
			return document.getElementById('costingBreakDown').innerHTML; 
		
		}
		
	}
	
