// for the events booking pages
function checkInput( a_or_b ) {

var doc = document.forms[0] ;
var emsg = "" ;
var efield = "" ;
var numAttending = getFieldValue( doc.NumberAttending , 'select' ) ;

var i=0 ;
for (i=numAttending;i>=1;i--)
{

	if ( trim( eval( 'doc.ParticipantAgeBand_' + i + '.value' ) ) == "ignore" ) 
	{
		emsg = "Participant #" + i + " Age Band.\n" + emsg ;
		efield = eval( 'doc.ParticipantAgeBand_' + i ) ;
	}

	if ( trim( eval( 'doc.ParticipantPPS_' + i + '.value' ) ) == '' ) 
	{
		emsg = "Participant #" + i + " PPS Number.\n" + emsg ;
		efield = eval( 'doc.ParticipantPPS_' + i ) ;
	}

	if ( trim( eval( 'doc.ParticipantJobTitle_' + i + '.value' ) ) == '' ) 
	{
		emsg = "Participant #" + i + " Job Title.\n" + emsg ;
		efield = eval( 'doc.ParticipantJobTitle_' + i ) ;
	}
	
	if ( trim( eval( 'doc.ParticipantName_' + i + '.value' ) ) == '' ) 
	{
		emsg = "Participant #" + i + " Name.\n" + emsg ;
		efield = eval( 'doc.ParticipantName_' + i ) ;
	}

}




if ( getFieldValue( doc.CompanyFundingExcess,'radio' ) == "Yes" )
{
	if ( trim( doc.CompanyFundingExcessDetails.value ).length <5 ) {
		emsg = "Details about company funding/grants.\n" + emsg ;
		efield = doc.CompanyFundingExcessDetails ;
	}
}


if ( getFieldValue( doc.CompanyIsPartOf,'radio' ) == ""  )
{
	emsg = "Is company part of a group, branch or holding company?\n" + emsg ;
	efield = doc.CompanyIsPartOf ;
}


if ( trim( doc.CompanyTaxRegistration.value ) == "" )
{
	emsg = "Company Tax Registration Number.\n" + emsg ;
	efield = doc.CompanyTaxRegistration ;
}

if ( getFieldValue( doc.Invoice_Address_County , 'select' ) == '00' )
{
	emsg = "Invoice Address - County.\n" + emsg ;
	efield = doc.Invoice_Address_county ;
}


if ( trim( doc.Invoice_Address_3.value ) == "" )
{
	emsg = "Invoice Address - City/Town.\n" + emsg ;
	efield = doc.Invoice_Address_3 ;
}

if ( trim( doc.Invoice_Address_1.value ) == "" )
{
	emsg = "Invoice Address - line 1.\n" + emsg ;
	efield = doc.Invoice_Address_1 ;
}


if ( trim( doc.Company_Phone.value ) == "" )
{
	emsg = "Company Phone.\n" + emsg ;
	efield = doc.Company_Phone ;
}


if ( getFieldValue( doc.Contact_Address_County , 'select' ) == '00' )
{
	emsg = "Company Address - County.\n" + emsg ;
	efield = doc.Contact_Address_county ;
}


if ( trim( doc.Contact_Address_3.value ) == "" )
{
	emsg = "Company Address - City/Town.\n" + emsg ;
	efield = doc.Contact_Address_3 ;
}

if ( trim( doc.Contact_Address_1.value ) == "" )
{
	emsg = "Company Address - line 1.\n" + emsg ;
	efield = doc.Contact_Address_1 ;
}

if ( trim( doc.Company.value ) == "" )
{
	emsg = "Company Name.\n" + emsg ;
	efield = doc.Company ;
}

if ( trim( doc.Email.value ) == "" )
{
	emsg = "Email Address.\n" + emsg ;
	efield = doc.Email ;
}

/*
if ( trim( doc.Phone.value ) == "" )
{
	emsg = "Contact Phone.\n" + emsg ;
	efield = doc.Phone ;
}
*/

if ( trim( doc.JobTitle.value ) == "" )
{
	emsg = "Job Title.\n" + emsg ;
	efield = doc.JobTitle ;
}

if ( trim( doc.Name.value ) == "" )
{
	emsg = "Contact Name.\n" + emsg ;
	efield = doc.Name ;
}

if ( emsg == "" )
{
	doc.submit() ;
}
else
{
	alert( "Error!  The following field(s) must be completed:\n\n" + emsg ) ;
	efield.focus()
}
}

function setOPFlag( theOPFLag ) 
{
	document.forms[0].eUserPayOnline.value = theOPFLag ;
}

