function roundit(Num, Places) {
   if (Places > 0) {
      if ((Num.toString().length - Num.toString().lastIndexOf('.')) > (Places + 1)) {
         var Rounder = Math.pow(10, Places);
         return Math.round(Num * Rounder) / Rounder;
      }
      else return Num;
   }
   else return Math.round(Num);
}

function updateString() {
	/* Creates and declares all variables used in the program */
	var country = eval(document.CustomerForm.InputCountry.selectedIndex);
	var type = eval(document.CustomerForm.InputType.selectedIndex);
	var pages = eval(document.CustomerForm.InputPages.value);
	var data = eval(document.CustomerForm.InputDatabase.value);
	var typeCost = 0;
	var pagesCost = 0;
	var dataCost = 0;
	var logoCost = 0;
	var illusCost = 0;
	var contentCost = 0;
	var searchCost = 0;
	var ecommCost = 0;
	var countryConvertCost = 0;
	var AUD = 1.08;
	var BRL = 1.56;
	var CAD = 1.03;
	var CNY = 6.84;
	var DKK = 4.79;
	var EGP = 5.29;
	var EUR = 0.64;
	var HKD = 7.80;
	var HUF = 149.38;
	var INR = 42.27;
	var JPY = 107.69;
	var KES = 67.10;
	var KRW = 1016.15;
	var LYD = 1.20;
	var MXN = 9.94;
	var MAD = 7.36;
	var NZD = 1.38;
	var PHP = 44.30;
	var PLN = 2.06;
	var RON = 2.25;
	var RUB = 23.47;
	var SGD = 1.37;
	var SEK = 6.08;
	var CHF = 1.05;
	var TWD = 31.38;
	var TRY = 1.18;
	var GBP = 0.54;
	var VEF = 2.15;
	var VND = 16625.50;
	var YER = 199.55;
	var ZMK = 3410.25;
	var ZWD = 8.93;
	var USD = 1;
	/* Ends the declaration block */


	/* if statement for the InputCountry selection box */
	if (country == "1") {
		countryConvertCost = AUD;
	}
	else if (country == "2" || country == "3" || country == "9" || country == "10" || country == "11" || country == "12" || country == "16" || country == "21" || country == "24" || country == "31") {
		countryConvertCost = EUR;
	}
	else if (country == "4") {
		countryConvertCost = BRL;
	}
	else if (country == "5") {
		countryConvertCost = CAD;
	}
	else if (country == "6") {
		countryConvertCost = CNY;
	}
	else if (country == "7") {
		countryConvertCost = DKK;
	}
	else if (country == "8") {
		countryConvertCost = EGP;
	}
	else if (country == "13") {
		countryConvertCost = HKD;
	}
	else if (country == "14") {
		countryConvertCost = HUF;
	}
	else if (country == "15") {
		countryConvertCost = INR;
	}
	else if (country == "17") {
		countryConvertCost = JPY;
	}
	else if (country == "18") {
		countryConvertCost = KES;
	}
	else if (country == "19") {
		countryConvertCost = KRW;
	}
	else if (country == "20") {
		countryConvertCost = LYD;
	}
	else if (country == "22") {
		countryConvertCost = MXN;
	}
	else if (country == "23") {
		countryConvertCost = MAD;
	}
	else if (country == "25") {
		countryConvertCost = NZD;
	}
	else if (country == "26") {
		countryConvertCost = PHP;
	}
	else if (country == "27") {
		countryConvertCost = PLN;
	}
	else if (country == "28") {
		countryConvertCost = RON;
	}
	else if (country == "29") {
		countryConvertCost = RUB;
	}
	else if (country == "30") {
		countryConvertCost = SGD;
	}
	else if (country == "32") {
		countryConvertCost = SEK;
	}
	else if (country == "33") {
		countryConvertCost = CHF;
	}
	else if (country == "34") {
		countryConvertCost = TWD;
	}
	else if (country == "35") {
		countryConvertCost = TRY;
	}
	else if (country == "36") {
		countryConvertCost = GBP;
	}
	else if (country == "37") {
		countryConvertCost = USD;
	}
	else if (country == "38") {
		countryConvertCost = VEF;
	}
	else if (country == "39") {
		countryConvertCost = VND;
	}
	else if (country == "40") {
		countryConvertCost = YER;
	}
	else if (country == "41") {
		countryConvertCost = ZMK;
	}
	else if (country == "42") {
		countryConvertCost = ZWD;
	}
	else  {
		countryConvertCost = USD;
	}
	/* Ends InputCountry */


	/* if statement for the InputType selection box */
	if (type == "1") {
		typeCost = roundit(70 * countryConvertCost);
	}
	else if (type == "2") {
		typeCost = roundit(100 * countryConvertCost);
	}
	else if (type == "3") {
		typeCost = roundit(170 * countryConvertCost);
	}
	else  {
		typeCost = 0 * countryConvertCost;
	}
	/* Ends InputType */


	/* if statement for the InputPages text box */
	if (isNaN(pages)) {
		alert("You must enter a value!");
	}
	else if (pages == "0") {
		pagesCost = 0;
	}
	else {
                if (type == "1" || type == "2" || type == "3") {
		        pagesCost = roundit((pages * 5) * countryConvertCost);
                }
                else {
                        pagesCost = roundit((pages * 20) * countryConvertCost);
                }
	}
	/* Ends InputPages */


	/* if statement for the InputDatabase text box */
	if (isNaN(data)) {
		alert("You must enter a value!");
	}
	else if (data == "0") {
		dataCost = 0 * countryConvertCost;
	}
	else {
                dataCost = roundit((data * 5) * countryConvertCost);
	}
	/* Ends InputDatabase */


	/* if statement for the InputLogo checkbox */
	if (document.CustomerForm.InputLogo.checked==true) {
		logoCost = roundit(25 * countryConvertCost);
	}
	else {
		logoCost = 0 * countryConvertCost;
	}
	/* Ends InputLogo */


	/* if statement for the InputIll checkbox */
	if (document.CustomerForm.InputIll.checked==true) {
		illusCost = roundit(50 * countryConvertCost);
	}
	else {
		illusCost = 0 * countryConvertCost;
	}
	/* Ends InputIll */


	/* if statement for the InputConMan checkbox */
	if (document.CustomerForm.InputConMan.checked==true) {
		contentCost = roundit(10 * countryConvertCost);
	}
	else {
		contentCost = 0 * countryConvertCost;
	}
	/* Ends InputConMan */


	/* if statement for the InputSEO checkbox */
	if (document.CustomerForm.InputSEO.checked==true) {
		searchCost = roundit(10 * countryConvertCost);
	}
	else {
		searchCost = 0 * countryConvertCost;
	}
	/* Ends InputSEO */


	/* if statement for the InputEcomm checkbox */
	if (document.CustomerForm.InputEcomm.checked==true) {
		ecommCost = roundit(30 * countryConvertCost);
	}
	else {
		ecommCost = 0 * countryConvertCost;
	}
	/* Ends InputEcomm */


	/* Calculates the total of all values included in the form */
	document.CustomerForm.InputCost.value = typeCost + pagesCost + dataCost + logoCost + illusCost + contentCost + searchCost + ecommCost;
	/* Ends calculation */
}