function checkForms(formname)
{
	///// set variables
	var yourForm = document.forms[formname.name];
	var errMsg = "The following fields need to be filled out ";
	var errCount = 0;
	
	//////////// login validation
	if (formname.name == "RSVP")
	{
		errMsg += "before you submit your RSVP:\n\n";
		with (yourForm)
		{
			if (FirstName.value == "") { errMsg += "First Name\n"; errCount++; }
			if (LastName.value == "") { errMsg += "Last Name\n"; errCount++; }
			if (Email.value == "") { errMsg += "E-mail Address\n"; errCount++; }
			else if (!isEmail(Email.value)) { errMsg += "Invalid E-mail Address\n"; errCount++; }
		}
	}
	
	///////// determine if error displays or not	
	if (errCount > 0)
	{
		alert(errMsg);
		return false;
	}
	else
	{
		return true;
	}
	return false;
	
} // end checkForms functions
	
/// popup window function
function popup(page,pgname,w,h)
{
	var width = w;
	var height = h;
	var left = ((screen.width-width)/2);
	var top = ((screen.height-height)/2);
	//window.open(page,pgname,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + '');
	document.location = page;
}

function callScreenings(MarketsId,MoviesId)
{
	popup('screenings.php?MarketsId=' + MarketsId + '&MoviesId=' + MoviesId,'Screenings','500','400');
}

function isEmail(posEmail)	
{
	var g = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[1-9]{1,3})(\]?)$/;
	return g.test(posEmail);
}
