// $Header: /HBI Websites/websites/beta/BETA.HIREDIVERSITY.COM/_client/js/validate_submit_event.js 1     9/06/07 11:50a Ricardo.peinado $
// requires include.js
include("is_valid_email");
include("is_valid_phone");
include("is_valid_date");

function validate_submit_event(form)
{	var aok = true;
	var alertText = "";

	if (!form.eventName.value)
	{	aok = false;
		alertText += "Please enter the name of your event.\n";
		form.eventName.focus();
	}

	if (!form.description.value)
	{	aok = false;
		alertText += "Please enter a decscription of your event.\n";
		form.description.focus();
	}
	
	if (!is_valid_date(form.startDate.value))
	{	aok = false;
		alertText += "Please enter a valid starting date for your event. i.e. 1/29/03\n";
		form.startDate.focus();
	}

	if (form.endDate.value && !is_valid_date(form.endDate.value))
	{	aok = false;
		alertText += "Please enter a valid end date. i.e. 1/29/03\n";
		form.endDate.focus();
	}

	if (!form.location.value)
	{	aok = false;
		alertText += "Please enter the location of your event.\n";
		form.location.focus();
	}


	if (!form.organization.value)
	{	aok = false;
		alertText += "Please enter your organization.\n";
		form.organization.focus();
	}

	if (!is_valid_phone(form.phone.value))
	{	aok = false;
		alertText += "Please enter your phone i.e. 555 555-5555.\n";
		form.phone.focus();
	}


	if (!is_valid_email(form.email.value))
	{	aok = false;
		alertText += "Please enter a valid email.\n";
		form.email.focus();
	}

	if (!aok)
	{	alert(alertText);
	}

	return aok;
}