// JavaScript Document
//////////////////////////////////////////////////////////////////////////////////////////
////////////////// this section validates fields
//////////////////////////////////////////////////////////////////////////////////////////
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false}
else {return true}
}
}

function validate_neweventform(thisform)
{
with (thisform)
{
if (validate_required(txt_programname,"you need to give the event a title")==false)
  {txt_programname.focus();return false}
if (validate_required(txt_description,"describe this event a little.  A paragraph or two would be great! Let Dragos know if you need to put up any pictures.")==false)
  {txt_description.focus();return false}
if (validate_required(txt_registration,"we need the first day of event  (it helps list the date on the site)")==false)
  {txt_registration.focus();return false}
if (validate_required(txt_other1,"when is this happening?   (for example: Friday and Saturday, May 11-12, at 4 pm)  ")==false)
  {txt_other1.focus();return false}
if (validate_required(txt_other2,"where is this going to take place?  (for example: Ritchie Center - Hamilton Gymnasium)")==false)
  {txt_other2.focus();return false}
if (validate_required(txt_programdates,"no Post Start Date?   this tells the website when to first post your event ")==false)
  {txt_programdates.focus();return false}
if (validate_required(txt_costs,"no Post End Date?  this tells the website when to stop posting your event ")==false)
  {txt_costs.focus();return false}
if (validate_required(txt_prerequisites,"you should post this at least on one venue page")==false)
  {txt_prerequisites.focus();return false}
}
}

//
function validate_fields_winetasting(thisform)
{
	with (thisform)
	{
		if(drop_howmany.value == "0"){
				
				alert("Please choose a number of attendees.");	
				drop_howmany.focus();
				drop_howmany.style.background = '#0099FF';
				return false;
			}
		  else{drop_howmany.style.background = '#ffffff';}
		if (validate_required(txt_name,"Please enter your name as it appears on your credit card.")==false)
		  {txt_name.focus();
		  txt_name.style.background = '#0099FF';
		  return false}
		  else{txt_name.style.background = '#ffffff';}
		if (validate_required(txt_address,"Please enter your billing address.")==false)
		  {txt_address.focus();
		  txt_address.style.background = '#0099FF';
		  return false}
		  else{txt_address.style.background = '#ffffff';}
		if (validate_required(txt_city,"Please enter a city.")==false)
		  {txt_city.focus();
		  txt_city.style.background = '#0099FF';
		  return false}
		  else{txt_city.style.background = '#ffffff';}
		if (validate_required(txt_state,"Please enter a state.")==false)
		  {txt_state.focus();
		  txt_state.style.background = '#0099FF';
		  return false}
		  else{txt_state.style.background = '#ffffff';}
	
		if (validate_required(txt_zip,"Please enter a zip code.")==false)
		  {txt_zip.focus();
		  txt_zip.style.background = '#0099FF';
		  return false}
		  else{txt_zip.style.background = '#ffffff';}
	
		if (validate_required(txt_phone,"Please enter a phone number.")==false)
		  {txt_phone.focus();
		  txt_phone.style.background = '#0099FF';
		  return false}
		  else{txt_phone.style.background = '#ffffff';}
	
	}//end with 


}//edn function