function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}


function checkemail()
{
	var emailvalidator = /^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;

	if (!emailvalidator.test(document.form1.ContactMail.value))
	{
		alert ("Please enter a valid email address.");
		document.form1.ContactMail.focus();
	}
	else if ((isNaN(document.form1.FinalTotal.value)) || (document.form1.FinalTotal.value == ""))    
	{
		alert ("Please enter a numeric  Final Total.");
		document.form1.FinalTotal.focus();
	}	
	else
	{
		document.form1.submit();
	}
}


function calculateform() { 

	totalatt = 0
	if ((document.form1.NOAttendees1.value > 0) && (document.form1.NOAttendees1.value < 99999999) && (document.form1.Cost1.value > 0) && (document.form1.Cost1.value < 99999999))
	{
		totalatt = document.form1.NOAttendees1.value
		document.form1.Total1.value = document.form1.NOAttendees1.value * document.form1.Cost1.value
		if ((document.form1.NOAttendees2.value > 0) && (document.form1.NOAttendees2.value < 99999999) && (document.form1.Cost2.value > 0) && (document.form1.Cost2.value < 99999999))
		{
			totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees2.value)
			document.form1.Total2.value = document.form1.NOAttendees2.value * document.form1.Cost2.value
			if ((document.form1.NOAttendees3.value > 0) && (document.form1.NOAttendees3.value < 99999999) && (document.form1.Cost3.value > 0) && (document.form1.Cost3.value < 99999999))
			{
				totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees3.value)
				document.form1.Total3.value = document.form1.NOAttendees3.value * document.form1.Cost3.value
				if ((document.form1.NOAttendees4.value > 0) && (document.form1.NOAttendees4.value < 99999999) && (document.form1.Cost4.value > 0) && (document.form1.Cost4.value < 99999999))
				{
					totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees4.value)
					document.form1.Total4.value = document.form1.NOAttendees4.value * document.form1.Cost4.value
					if ((document.form1.NOAttendees5.value > 0) && (document.form1.NOAttendees5.value < 99999999) && (document.form1.Cost5.value > 0) && (document.form1.Cost5.value < 99999999))
					{
						totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees5.value)
						document.form1.Total5.value = document.form1.NOAttendees5.value * document.form1.Cost5.value
						if ((document.form1.NOAttendees6.value > 0) && (document.form1.NOAttendees6.value < 99999999) && (document.form1.Cost6.value > 0) && (document.form1.Cost6.value < 99999999))
						{
							totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees6.value)
							document.form1.Total6.value = document.form1.NOAttendees6.value * document.form1.Cost6.value
							if ((document.form1.NOAttendees7.value > 0) && (document.form1.NOAttendees7.value < 99999999) && (document.form1.Cost7.value > 0) && (document.form1.Cost7.value < 99999999))
							{
								totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees7.value)
								document.form1.Total7.value = document.form1.NOAttendees7.value * document.form1.Cost7.value				
								if ((document.form1.NOAttendees8.value > 0) && (document.form1.NOAttendees8.value < 99999999) && (document.form1.Cost8.value > 0) && (document.form1.Cost8.value < 99999999))
								{
									totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees8.value)
									document.form1.Total8.value = document.form1.NOAttendees8.value * document.form1.Cost8.value
									if ((document.form1.NOAttendees9.value > 0) && (document.form1.NOAttendees9.value < 99999999) && (document.form1.Cost9.value > 0) && (document.form1.Cost9.value < 99999999))
									{
										totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees9.value)
										document.form1.Total9.value = document.form1.NOAttendees9.value * document.form1.Cost9.value				
										if ((document.form1.NOAttendees10.value > 0) && (document.form1.NOAttendees10.value < 99999999) && (document.form1.Cost10.value > 0) && (document.form1.Cost10.value < 99999999))
										{
											totalatt = parseFloat(totalatt) + parseFloat(document.form1.NOAttendees10.value)
											document.form1.Total10.value = document.form1.NOAttendees10.value * document.form1.Cost10.value
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	document.form1.NetCost.value = document.form1.Total1.value
	if ((document.form1.Total2.value > 0) && (document.form1.Total2.value < 99999999999))
	{
		document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total2.value)
		if ((document.form1.Total3.value > 0) && (document.form1.Total3.value < 99999999999))
		{
			document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total3.value)
			if ((document.form1.Total4.value > 0) && (document.form1.Total4.value < 99999999999))
			{
				document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total4.value)
				if ((document.form1.Total5.value > 0) && (document.form1.Total5.value < 99999999999))
				{	
					document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total5.value)
					if ((document.form1.Total6.value > 0) && (document.form1.Total6.value < 99999999999))
					{
						document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total6.value)
						if ((document.form1.Total7.value > 0) && (document.form1.Total7.value < 99999999999))
						{
							document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total7.value)
							if ((document.form1.Total8.value > 0) && (document.form1.Total8.value < 99999999999))
							{
								document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total8.value)
								if ((document.form1.Total9.value > 0) && (document.form1.Total9.value < 99999999999))
								{
									document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total9.value)
									if ((document.form1.Total10.value > 0) && (document.form1.Total10.value < 99999999999))
									{
										document.form1.NetCost.value = parseFloat(document.form1.NetCost.value) + parseFloat(document.form1.Total10.value)
									}										
								}									
							}								
						}							
					}						
				}
			}
		}
	}
	n = Math.round (document.form1.NetCost.value * 100) / 100;
	n = (n + .001) + "";
  n = n.substring(0, n.indexOf('.') + 3);
	document.form1.NetCost.value = n


	if (totalatt > 2)
	{
		if (totalatt > 4)
		{
			if (totalatt > 6)
			{
				document.form1.Discount.value = (parseFloat(document.form1.NetCost.value) / 100) * 20;
				n = Math.round (document.form1.Discount.value * 100) / 100;
				n = (n + .001) + "";
			    n = n.substring(0, n.indexOf('.') + 3);
				document.form1.Discount.value = n
				
			}
			else
			{
				document.form1.Discount.value = (parseFloat(document.form1.NetCost.value) / 100) * 17.5;
				n = Math.round (document.form1.Discount.value * 100) / 100;
				n = (n + .001) + "";
			    n = n.substring(0, n.indexOf('.') + 3);
				document.form1.Discount.value = n
			}
		}
		else
		{
			document.form1.Discount.value = (parseFloat(document.form1.NetCost.value) / 100) * 10;
			n = Math.round (document.form1.Discount.value * 100) / 100;
			n = (n + .001) + "";
		    n = n.substring(0, n.indexOf('.') + 3);
			document.form1.Discount.value = n		
		}
	}
	else
	{
		document.form1.Discount.value = 0;
	}
	document.form1.Vat.value = (((document.form1.NetCost.value - document.form1.Discount.value) / 100) * 17.5);
	n = Math.round (document.form1.Vat.value * 100) / 100;
	n = (n + .001) + "";
	n = n.substring(0, n.indexOf('.') + 3);
	document.form1.Total.value = document.form1.NetCost.value - document.form1.Discount.value
	document.form1.Vat.value = n
	document.form1.FinalTotal.value = ((document.form1.NetCost.value - document.form1.Discount.value) + parseFloat(document.form1.Vat.value))
	n = Math.round (document.form1.FinalTotal.value * 100) / 100;
	n = (n + .001) + "";
	n = n.substring(0, n.indexOf('.') + 3);
	document.form1.FinalTotal.value = n
}

