function Validate(theForm) {

   if (theForm.FirstName.value == "")
  {
    alert("Please enter your first name.");
    theForm.FirstName.focus();
    return (false);
  }
   if (theForm.LastName.value == "")
  {
    alert("Please enter your last name.");
    theForm.LastName.focus();
    return (false);
  }
   if (theForm.Address1.value == "")
  {
    alert("Please enter your address.");
    theForm.Address1.focus();
    return (false);
  }
   if (theForm.City.value == "")
  {
    alert("Please enter your city.");
    theForm.City.focus();
    return (false);
  }
   if (theForm.Country.value == "")
  {
    alert("Please select your country.");
    theForm.Country.focus();
    return (false);
  }
   if (theForm.PreferPhone.value == "")
  {
    alert("Please enter your preferred phone number.");
    theForm.PreferPhone.focus();
    return (false);
  }
   if (theForm.Email.value == "")
  {
    alert("Please enter your email address.");
    theForm.Email.focus();
    return (false);
  }

	var checkStr = theForm.Email.value;
	var ch = checkStr.indexOf('@');

	if (ch==0 || ch==-1) {
		alert("Please enter a valid email address.");
		theForm.Email.focus();
		return (false);
	}
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-@.-_";
	var checkStr = theForm.Email.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only letter, digit and \"@.-_\" characters in the \"Email\" field.");
		theForm.Email.focus();
		return (false);
	}
   if (theForm.MeetingName.value == "")
  {
    alert("Please enter meeting name.");
    theForm.MeetingName.focus();
    return (false);
  }
   if (theForm.MeetingOrganization.value == "")
  {
    alert("Please enter meeting organization.");
    theForm.MeetingOrganization.focus();
    return (false);
  }
   if (theForm.NumOfRooms.value == 0)
  {
    alert("Please enter number of guest rooms.");
    theForm.NumOfRooms.focus();
    return (false);
  }
	var checkOK = "0123456789";
	var checkStr = theForm.NumOfRooms.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit in the \"Number of Rooms\" field.");
		theForm.NumOfRooms.focus();
		return (false);
	}
   if (theForm.MeetingDays.value == 0)
  {
    alert("Please enter number of actual meeting days.");
    theForm.MeetingDays.focus();
    return (false);
  }
	var checkOK = "0123456789";
	var checkStr = theForm.MeetingDays.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Number of Actual Meeting Days.");
		theForm.MeetingDays.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Double1.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Double room information on day1.");
		theForm.Double1.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.King1.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for King room information on day1.");
		theForm.King1.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Suite1.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Suite room information on day1.");
		theForm.Suite1.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Double2.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Double room information on day2.");
		theForm.Double2.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.King2.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for King room information on day2.");
		theForm.King2.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Suite2.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Suite room information on day2.");
		theForm.Suite2.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Double3.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Double room information on day3.");
		theForm.Double3.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.King3.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for King room information on day3.");
		theForm.King3.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Suite3.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Suite room information on day3.");
		theForm.Suite3.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Double4.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Double room information on day4.");
		theForm.Double4.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.King4.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for King room information on day4.");
		theForm.King4.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Suite4.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Suite room information on day4.");
		theForm.Suite4.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Double5.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Double room information on day5.");
		theForm.Double5.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.King5.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for King room information on day5.");
		theForm.King5.focus();
		return (false);
	}
	var checkOK = "0123456789";
	var checkStr = theForm.Suite5.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Suite room information on day5.");
		theForm.Suite5.focus();
		return (false);
	}
   if (theForm.txtFunctionDate1.value == "" && theForm.txtFunctionDate2.value == "" && theForm.FunctionName1.value == "" && theForm.FunctionName2.value == "" && theForm.FunctionStart1.value == "" && theForm.FunctionStart2.value == "" && theForm.FunctionStop1.value == "" && theForm.FunctionStop2.value == "" && theForm.FunctionSetup1.value == "" && theForm.FunctionSetup2.value == "" && theForm.NumOfPeople1.value == 0 && theForm.NumOfPeople1.value == 0 && theForm.FunctionFood1.value == "" && theForm.FunctionFood2.value == "")
  {
    alert("At least one function is required.");
    theForm.FunctionName1.focus();
    return (false);
  }
	var checkOK = "0123456789";
	var checkStr = theForm.NumOfPeople1.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Number of People.");
		theForm.NumOfPeople1.focus();
		return (false);

	}
	var checkOK = "0123456789";
	var checkStr = theForm.NumOfPeople2.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit for Number of People.");
		theForm.NumOfPeople2.focus();
		return (false);
	}
	var checkOK = "0123456789.";
	var checkStr = theForm.MeetingBudget.value;
	var allValid = true;
	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 (!allValid) {
		alert("Please enter only digit in the \"Meeting Budget\" field.");
		theForm.MeetingBudget.focus();
		return (false);
	}
	return (true);
}
var localForm; 
function initForm(theForm) 
{ 
   localForm = theForm;
}
function kingtotal() {
	var kday1 = parseInt(document.frmRFP.King1.value)
	var kday2 = parseInt(document.frmRFP.King2.value);
	var kday3 = parseInt(document.frmRFP.King3.value);
	var kday4 = parseInt(document.frmRFP.King4.value);
	var kday5 = parseInt(document.frmRFP.King5.value);
		if (isNaN(kday1)) {
			kday1=0
			}
		if (isNaN(kday5)) {
			kday5=0
			}
		if (isNaN(kday4)) {
			kday4=0
			}
		if (isNaN(kday3)) {
			kday3=0
			}
		if (isNaN(kday2)) {
			kday2=0
			}
	kings = kday1+kday2+kday3+kday4+kday5;
	document.frmRFP.KingTotal.value = kings;
}
function doubletotal() {
	var dday1 = parseInt(document.frmRFP.Double1.value)
	var dday2 = parseInt(document.frmRFP.Double2.value);
	var dday3 = parseInt(document.frmRFP.Double3.value);
	var dday4 = parseInt(document.frmRFP.Double4.value);
	var dday5 = parseInt(document.frmRFP.Double5.value);
		if (isNaN(dday1)) {
			dday1=0
			}
		if (isNaN(dday5)) {
			dday5=0
			}
		if (isNaN(dday4)) {
			dday4=0
			}
		if (isNaN(dday3)) {
			dday3=0
			}
		if (isNaN(dday2)) {
			dday2=0
			}
	doubles = dday1+dday2+dday3+dday4+dday5;
	document.frmRFP.DoubleTotal.value = doubles;
}
function suitetotal() {
	var sday1 = parseInt(document.frmRFP.Suite1.value)
	var sday2 = parseInt(document.frmRFP.Suite2.value);
	var sday3 = parseInt(document.frmRFP.Suite3.value);
	var sday4 = parseInt(document.frmRFP.Suite4.value);
	var sday5 = parseInt(document.frmRFP.Suite5.value);
		if (isNaN(sday1)) {
			sday1=0
			}
		if (isNaN(sday5)) {
			sday5=0
			}
		if (isNaN(sday4)) {
			sday4=0
			}
		if (isNaN(sday3)) {
			sday3=0
			}
		if (isNaN(sday2)) {
			sday2=0
			}
	suites = sday1+sday2+sday3+sday4+sday5;
	document.frmRFP.SuiteTotal.value = suites;
}
function calculate1() {
	var king1 = parseInt(document.frmRFP.King1.value);
	var double1 = parseInt(document.frmRFP.Double1.value);
	var suite1 = parseInt(document.frmRFP.Suite1.value);
	if (isNaN(king1)) {
		king1=0;
		}
	if (isNaN(double1)) {
		double1=0;
		}
	if (isNaN(suite1)) {
		suite1=0;
		}
	var total1 = king1 + double1 + suite1;
	document.frmRFP.TotalDay1.value = total1;
}
function calculate2() {
	var king2 = parseInt(document.frmRFP.King2.value);
	var double2 = parseInt(document.frmRFP.Double2.value);
	var suite2 = parseInt(document.frmRFP.Suite2.value);
	if (isNaN(king2)) {
		king2=0;
		}
	if (isNaN(double2)) {
		double2=0;
		}
	if (isNaN(suite2)) {
		suite2=0;
		}
	var total2 = king2 + double2 + suite2;
	document.frmRFP.TotalDay2.value = total2;
}
function calculate3() {
	var king3 = parseInt(document.frmRFP.King3.value);
	var double3 = parseInt(document.frmRFP.Double3.value);
	var suite3 = parseInt(document.frmRFP.Suite3.value);
	if (isNaN(king3)) {
		king3=0;
		}
	if (isNaN(double3)) {
		double3=0;
		}
	if (isNaN(suite3)) {
		suite3=0;
		}
	var total3 = king3 + double3 + suite3;
	document.frmRFP.TotalDay3.value = total3;
}
function calculate4() {
	var king4 = parseInt(document.frmRFP.King4.value);
	var double4 = parseInt(document.frmRFP.Double4.value);
	var suite4 = parseInt(document.frmRFP.Suite4.value);
	if (isNaN(king4)) {
		king4=0;
		}
	if (isNaN(double4)) {
		double4=0;
		}
	if (isNaN(suite4)) {
		suite4=0;
		}
	var total4 = king4 + double4 + suite4;
	document.frmRFP.TotalDay4.value = total4;
}
function calculate5() {
	var king5 = parseInt(document.frmRFP.King5.value);
	var double5 = parseInt(document.frmRFP.Double5.value);
	var suite5 = parseInt(document.frmRFP.Suite5.value);
	if (isNaN(king5)) {
		king5=0;
		}
	if (isNaN(double5)) {
		double5=0;
		}
	if (isNaN(suite5)) {
		suite5=0;
		}
	var total5 = king5 + double5 + suite5;
	document.frmRFP.TotalDay5.value = total5;
}
function grndtotal() {
	var day1 = parseInt(document.frmRFP.TotalDay1.value);
	var day2 = parseInt(document.frmRFP.TotalDay2.value);
	var day3 = parseInt(document.frmRFP.TotalDay3.value);
	var day4 = parseInt(document.frmRFP.TotalDay4.value);
	var day5 = parseInt(document.frmRFP.TotalDay5.value);
		if (isNaN(day1)) {
			day1=0
			}
		if (isNaN(day5)) {
			day5=0
			}
		if (isNaN(day4)) {
			day4=0
			}
		if (isNaN(day3)) {
			day3=0
			}
		if (isNaN(day2)) {
			day2=0
			}
	grandttl = day1+day2+day3+day4+day5;
	document.frmRFP.Total.value = grandttl;
}
