// JavaScript Document
function validateEmailAddress(email)
{
	
	// This function is used to validate a given e-mail 
	// address for the proper syntax
	
	if (email == ""){
		return false;
	}
	badStuff = ";:/,' \"\\";
	for (i=0; i<badStuff.length; i++){
		badCheck = badStuff.charAt(i)
		if (email.indexOf(badCheck,0) != -1){
			return false;
		}
	}
	posOfAtSign = email.indexOf("@",1)
	if (posOfAtSign == -1){
		return false;
	}
	if (email.indexOf("@",posOfAtSign+1) != -1){
		return false;
	}
	posOfPeriod = email.indexOf(".", posOfAtSign)
	if (posOfPeriod == -1){
		return false;
	}
	if (posOfPeriod+2 > email.length){
		return false;
	}
	return true
}

function checkfrmregister(frmregister)
{
	if(frmregister.fname.value=="")
	{
		alert("The First Name field cannot be blank.");
		frmregister.fname.focus();
		return false;
	}
	var tbLen3 = frmregister.fname.value.trim().length;
	// Check the text box for empty string (with no blank spaces)
	if (tbLen3 == 0)
	{ 
		alert('Spaces and Empty Fields are not allowed here.');
		frmregister.fname.focus();
		return false;
	}
	if(frmregister.billing_address.value=="")
	{
		alert("The Billing Address field cannot be blank.");
		frmregister.billing_address.focus();
		return false;
	}
	if(frmregister.postal_code.value=="")
	{
		alert("The Postal Code field cannot be blank.");
		frmregister.postal_code.focus();
		return false;
	}
	var tbLen10 = frmregister.postal_code.value.trim().length;
	// Check the text box for empty string (with no blank spaces)
	if (tbLen10 == 0)
	{ 
		alert('Spaces and Empty Fields are not allowed here.');
		frmregister.postal_code.focus();
		return false;
	}
	if(frmregister.telephone.value=="")
	{
		alert("The Contact No. field cannot be blank.");
		frmregister.telephone.focus();
		return false;
	}
	var tbLen5 = frmregister.telephone.value.trim().length;
	// Check the text box for empty string (with no blank spaces)
	if (tbLen5 == 0)
	{ 
		alert('Spaces and Empty Fields are not allowed here.');
		frmregister.telephone.focus();
		return false;
	}
	if(isNaN(frmregister.telephone.value) || frmregister.telephone.value.length<=6)
	{
	
		alert("Please enter a numeric value for work contact number with minimum 8 digits.");
		frmregister.telephone.focus();
		return false;
		
	}
	if(frmregister.telephone2.value=="")
	{
		alert("The Contact No. 2 field cannot be blank.");
		frmregister.telephone2.focus();
		return false;
	}
	var tbLen6 = frmregister.telephone2.value.trim().length;
	// Check the text box for empty string (with no blank spaces)
	if (tbLen6 == 0)
	{ 
		alert('Spaces and Empty Fields are not allowed here.');
		frmregister.telephone2.focus();
		return false;
	}
	if(isNaN(frmregister.telephone2.value) || frmregister.telephone2.value.length<=6)
	{
	
		alert("Please enter a numeric value for work contact number with minimum 8 digits.");
		frmregister.telephone2.focus();
		return false;
		
	}
	if(frmregister.telephone.value==frmregister.telephone2.value)
	{
		alert("Please enter 2 different Contact Numbers.");
		frmregister.telephone2.focus();
		return false;
	}
	if (frmregister.email.value=="")
	{
		alert("The Email Address field cannot be blank.");
		frmregister.email.focus();
		return (false);
	}
	if (!validateEmailAddress(frmregister.email.value))
	{
		alert("Please enter valid email address");
		frmregister.email.focus();	
		return false;
	}
	if(frmregister.event_venue.value=="")
	{
		alert("The Event Venue field cannot be blank.");
		frmregister.event_venue.focus();
		return false;
	}
	if(document.getElementById('deliverydate').value=="")
	{
		alert("The Event Date field cannot be blank.");
		return false;
	}
	if(frmregister.number_guest.value=="")
	{
		alert("The No. of Guests field cannot be blank.");
		frmregister.number_guest.focus();
		return false;
	}
	if(frmregister.terms.checked == false)
	{
	alert ( "Please check the Terms & Conditions box." );
	return false;
	}
	
	/*var x=frmregister.ddlDay.selectedIndex;
	if(frmregister.ddlDay[x].value==0)
	{
		alert("Please Select one of the day.");
		frmregister.ddlDay.focus();
		return false;
	}	
	var x=frmregister.ddlMonth.selectedIndex;
	if(frmregister.ddlMonth[x].value==0)
	{
		alert("Please Select one of the month.");
		frmregister.ddlMonth.focus();
		return false;
	}	
	var x=frmregister.ddlYear.selectedIndex;
	if(frmregister.ddlYear[x].value==0)
	{
		alert("Please Select one of the year.");
		frmregister.ddlYear.focus();
		return false;
	}*/
	/*if(frmregister.cname.value=="")
	{
		alert("The Company Name field cannot be blank.");
		frmregister.cname.focus();
		return false;
	}*/
	/*if(frmregister.event_level.value=="")
	{
		alert("The Event Level field cannot be blank.");
		frmregister.event_level.focus();
		return false;
	}*/
}

function checkfrmstep7(frmstep7)
{
if ( ( frmstep7.temptation[0].checked == false ) && ( frmstep7.temptation[1].checked == false ) )
   {
	   alert ( "Please pick one of the reception menu." );
	   return false;
   } 
	/*if(frmstep7.temptation.checked == false)
	{
	alert ( "Please select one of the menu." );
	return false;
	}*/
}

function checkfrmbentosstep7(frmbentosstep7)
{
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmbentosstep7.text_1_a.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmbentosstep7.text_1_a.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "15"))
	{
		alertsay = "Minimum of 15 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmbentosstep7.text_1_a.focus();
	return (false);
	}
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmbentosstep7.text_2_a.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmbentosstep7.text_2_a.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "15"))
	{
		alertsay = "Minimum of 15 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmbentosstep7.text_2_a.focus();
	return (false);
	}
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmbentosstep7.text_3_a.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmbentosstep7.text_3_a.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "15"))
	{
		alertsay = "Minimum of 15 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmbentosstep7.text_3_a.focus();
	return (false);
	}
	
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmbentosstep7.text_4_a.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmbentosstep7.text_4_a.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "15"))
	{
		alertsay = "Minimum of 15 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmbentosstep7.text_4_a.focus();
	return (false);
	}
	
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmbentosstep7.text_5_a.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmbentosstep7.text_5_a.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "15"))
	{
		alertsay = "Minimum of 15 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmbentosstep7.text_5_a.focus();
	return (false);
	}
	
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmbentosstep7.text_6_a.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmbentosstep7.text_6_a.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "15"))
	{
		alertsay = "Minimum of 15 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmbentosstep7.text_6_a.focus();
	return (false);
	}
}

function checkfrmstep8(frmstep8)
{
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmstep8.coffee.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmstep8.coffee.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "30"))
	{
		alertsay = "Minimum of 30 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmstep8.coffee.focus();
	return (false);
	}
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmstep8.tea.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmstep8.tea.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "30"))
	{
		alertsay = "Minimum of 30 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmstep8.tea.focus();
	return (false);
	}
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmstep8.pink_guava.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmstep8.pink_guava.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "30"))
	{
		alertsay = "Minimum of 30 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmstep8.pink_guava.focus();
	return (false);
	}
	
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmstep8.sprite.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmstep8.sprite.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "30"))
	{
		alertsay = "Minimum of 30 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmstep8.sprite.focus();
	return (false);
	}
	
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmstep8.carlsberg.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmstep8.carlsberg.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "30"))
	{
		alertsay = "Minimum of 30 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmstep8.carlsberg.focus();
	return (false);
	}
	
	
	
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmstep8.beer.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmstep8.beer.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "30"))
	{
		alertsay = "Minimum of 30 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmstep8.beer.focus();
	return (false);
	}
}
function checkfrmsideorder1(frmsideorder1)
{
	// only allow 0-9, hyphen and comma be entered
	var checkOK = "0123456789-,";
	var checkStr = frmsideorder1.option6.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		alert("Please enter only digit characters in the \"NumberText\" field.");
		frmsideorder1.option6.focus();
		return (false);
	}
	
	var chkVal = allNum;
	var prsVal = parseInt(allNum);
	if (chkVal != "" && !(prsVal >= "30"))
	{
		alertsay = "Minimum of 30 Persons."
		//alertsay = alertsay + "equal to \"9\" and less than or "
		//alertsay = alertsay + "equal to \"5000\" in the \"NumberText\" field."
	alert(alertsay);
	frmsideorder1.option6.focus();
	return (false);
	}
}

