<!--

function confirmDelete(entity, displayName) 
{
	return confirm("Are you sure you want to delete the " + entity + ": " + displayName + "?");
}

function validateBasicConferenceInfo()
{
	fv = new formValidator(); //instantiate formvalidator
	
	if (fv.isEmpty("group_name"))
		fv.raiseError("Please enter the group name.");
		
	if (fv.isEmpty("contact_name"))
		fv.raiseError("Please enter the contact name.");
		
	if (fv.isEmpty("email_address"))
		fv.raiseError("Please enter an email address.");
	else
	if (!fv.isEmailAddress("email_address"))
		fv.raiseError("Please enter a valid email address.");

	if (fv.isEmpty("telephone_no") && fv.isEmpty("cellphone_no"))
		fv.raiseError("Please enter a telephone and / or a cellphone number.");
		
	if (fv.isEmpty("company_name"))
		fv.raiseError("Please enter a company name.");

	if (fv.isEmpty("address"))
		fv.raiseError("Please enter an address.");
		
	// check the dates specified are correct and they are in the future	and are not on the same days
	todayDay = new Date().getDate();	
	todayMonth = new Date().getMonth();
	todayYear = new Date().getFullYear();
	
	today = new Date(todayYear, todayMonth, todayDay);
	
	arrivalDate = new Date(fv.findObj("arrival_date_year").value, fv.findObj("arrival_date_month").value-1, fv.findObj("arrival_date_day").value);

	departureDate = new Date(fv.findObj("departure_date_year").value, fv.findObj("departure_date_month").value-1, fv.findObj("departure_date_day").value);	
	
	if (arrivalDate < today || departureDate < today)
		fv.raiseError("Only future dates for arrival and departure dates are permitted");
		
	if (arrivalDate >= departureDate)
		fv.raiseError("The arrival date must occur before the departure date.");
		
	// check the dates are valid dates
	if (!(isDate(fv.findObj("arrival_date_day").value + "/"+ fv.findObj("arrival_date_month").value + "/" + fv.findObj("arrival_date_year").value)))
		fv.raiseError("The arrival date is not a valid date.");
		
	if (!(isDate(fv.findObj("departure_date_day").value + "/"+ fv.findObj("departure_date_month").value + "/" + fv.findObj("departure_date_year").value)))
		fv.raiseError("The departure date is not a valid date.");		

	if (fv.numErrors() == 0)	
	{
		var one_day=1000*60*60*24;
		numDaysBetween = Math.ceil((departureDate.getTime()-arrivalDate.getTime())/(one_day));
		if (numDaysBetween > 10)
		{
			fv.raiseError("The requested conference time will take too long to generate. Please contact us directly to receive better group discounts for the required conference period.");
		}
	}
	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function validateConference()
{
	fv = new formValidator(); //instantiate formvalidator
	
	times = new String(fv.findObj("ts").value);
	timesArray = times.split(",")

	numDelegates = new Array(timesArray.length);
	numPackages = new Array(timesArray.length);
	numTables = new Array(timesArray.length);
	numBoth = new Array(timesArray.length);
	numVenues = new Array(timesArray.length);
	
	// initialize validatorArray fields
	for (i=0;i<numDelegates.length;i++)
	{
		numDelegates[i] = false;
		numPackages[i] = false;
		numTables[i] = false;
	}
	
	//numDelegates = false;	
	//numPackages = false;	
	//numTables = false;	
	totalConferenceDays = 0;
	for (i=0;i<timesArray.length;i++)
	{
		if (!fv.isChecked("exclude"+timesArray[i]))
		{
			if (fv.isEmpty("num_delegates"+timesArray[i]))
				numDelegates[i] = true;
				
			if ((!fv.isSelected("package"+timesArray[i])) && (!fv.isSelected("venue"+timesArray[i])))
				numPackages[i] = true;
				
			if ((fv.isSelected("package"+timesArray[i])) && (fv.isSelected("venue"+timesArray[i])))
				numBoth[i] = true;
				
			if (!fv.isSelected("table"+timesArray[i]))
				numTables[i] = true;
			
			totalConferenceDays++;
		}
	}
	
	for (i=0;i<timesArray.length;i++)
	{
		if (numDelegates[i])
		{
			fv.raiseError("The number of delegates attending must be specified for each day.");
			break;
		}
	}
	
	for (i=0;i<timesArray.length;i++)
	{
		if (numPackages[i])
		{
			fv.raiseError("The package OR venue for each day must be specified.");
			break;
		}
	}
	
	for (i=0;i<timesArray.length;i++)
	{
		if (numBoth[i])
		{
			fv.raiseError("You can either select a Package or a Venue for a specific day. Please correct.");
			break;
		}
	}
	
	for (i=0;i<timesArray.length;i++)
	{
		if (numTables[i])
		{
			fv.raiseError("The table setup for each day must be specified.");
			break;
		}
	}
	
	if (totalConferenceDays == 0)
		fv.raiseError("At least one day must be specified for conferencing.");
	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

// 
function excludeStamp(stamp, isChecked)
{
	fv = new formValidator();
	if (isChecked)
	{
		fv.findObj("table"+stamp).selectedIndex = 0;
		fv.findObj("package"+stamp).selectedIndex = 0;
		fv.findObj("num_delegates"+stamp).value= "";
	}
}

-->
