/*   ////////////////////////////////////////////
	JavaScript Document :: profindemcheck1.js
	version 1.1 24.6.03
	copyright (c) 2003, Chris Whincop, neurvana.com
	email: chrisATneurvanaDOTcom
	tel: +44 (0)1896 820161
	adapted from various Open Source scripts and
	released under the GPL, see:
	http://www.gnu.org/copyleft/gpl.html
 	No warranty, freely distributable and reusable.
	If you make improvements, please let me know.
	Thanks! 
///////////////////////////////////////// */

function validate() { 


//check a field to make sure it's not blank 
if(document.ProfIndem1.orgname.value == '') { 
alert('Please fill in the field: \n\nName of Organisation'); 
document.ProfIndem1.orgname.focus(); 
return false; 
}

//check a field to make sure it's not blank 
if(document.ProfIndem1.contname.value == '') { 
alert('Please fill in the field: \n\nOffice Bearer'); 
document.ProfIndem1.contname.focus(); 
return false; 
}

/* 		NEW EMAIL PROCEDURE - 27.6.03 STARTS HERE 	*/

// offer the person the option of leaving the two email fields blank if they are both blank
if((document.ProfIndem1.contemail1a.value == '') && (document.ProfIndem1.contemail1b.value == '')) { 
if(!confirm("Are you sure you want to leave the two 'Contact Email Address' fields blank?\n\nPlease click on 'OK' to confirm, or click on 'Cancel' to go back and enter your email address.")) { 
document.ProfIndem1.contemail1a.focus(); 
return false; 
}
}
// check both email fields to make sure just the first isn't blank 
if((document.ProfIndem1.contemail1b.value != '') && (document.ProfIndem1.contemail1a.value == '')){ 
alert("It looks like you have filled in the second email field, but not the first.\n\nPlease EITHER:\n\n1. fill in the first email field: \n\n'Contact Email Address' \n\nOR:\n\n2. make sure the second email field is also empty"); 
document.ProfIndem1.contemail1a.focus(); 
return false; 
}
// check both email fields to make sure just the second isn't blank 
if((document.ProfIndem1.contemail1a.value != '') && (document.ProfIndem1.contemail1b.value == '')){ 
alert("It looks like you have filled in the first email field, but not the second.\n\nPlease EITHER:\n\n1. fill in the second email field: \n\n'Please retype the Contact Email Address...'\n\nOR:\n\n2. make sure the first email field is also empty"); 
document.ProfIndem1.contemail1b.focus(); 
return false; 
}

// check both email fields again, and this time, if neither is blank, proceed to check each of them for valid syntax
// if both are blank, do nothing
if((document.ProfIndem1.contemail1a.value != '') && (document.ProfIndem1.contemail1b.value != '')) { 
// check if email address entered has got valid syntax 
if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.ProfIndem1.contemail1a.value))) { 
alert("What you\'ve entered in the first email field is not a valid email address!\n\nPlease check it for spaces and other typos."); 
document.ProfIndem1.contemail1a.focus(); 
return false; 
}  //end the first if within if
if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.ProfIndem1.contemail1b.value))) { 
alert("What you\'ve entered in the second email field is not a valid email address!\n\nPlease check it for spaces and other typos."); 
document.ProfIndem1.contemail1b.focus(); 
return false; 
}  //end the second if within if
} //end the main if

// Now make sure that the two email addresses entered match
  if (document.ProfIndem1.contemail1a.value.toLowerCase() != document.ProfIndem1.contemail1b.value.toLowerCase()) {
alert("The two email addresses you\'ve just entered must match each other exactly!\n\nPlease check them both for spaces and other typos."); 
document.ProfIndem1.contemail1a.focus(); 
return false; 
} //end if 

/* 		NEW EMAIL PROCEDURE - 24.6.03 ENDS HERE 	*/



//check a field to make sure it's not blank 
if(document.ProfIndem1.contphone1.value == '') { 
alert('Please fill in the field: \n\nContact Telephone No.'); 
document.ProfIndem1.contphone1.focus(); 
return false; 
}



//radio fin_leg_advice
// Get the value of the radio button group in question
// valRadioButton is a function we define down below 
var radioVal = valRadiobutton(document.ProfIndem1.fin_leg_advice); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\nDoes the Charity provide... ...Financial or legal advice?  \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.fin_leg_advice[0].focus(); // and focus on the first option
return false; 
}


//radio counselling
// Get the value of the radio button group in question
// valRadioButton is a function we define down below 
var radioVal = valRadiobutton(document.ProfIndem1.counselling); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\nDoes the Charity provide... ...Counselling?  \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.counselling[0].focus(); // and focus on the first option
return false; 
}


//radio medical_advice
// Get the value of the radio button group in question
// valRadioButton is a function we define down below 
var radioVal = valRadiobutton(document.ProfIndem1.medical_advice); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\nDoes the Charity provide... ...Medical advice, diagnosis or treatment?  \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.medical_advice[0].focus(); // and focus on the first option
return false; 
}


//radio other_advice
// Get the value of the radio button group in question
// valRadioButton is a function we define down below 
var radioVal = valRadiobutton(document.ProfIndem1.other_advice); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\nDoes the Charity provide... ...Other kind of advice or information? \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.other_advice[0].focus(); // and focus on the first option
return false; 
}



//IFF fin_leg_advice THEN details_of_fin_legal_advice
var radioVal = valRadiobutton(document.ProfIndem1.fin_leg_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.details_of_fin_legal_advice.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Financial or legal advice?', \n\nplease fill in the field:\n\n2. a) Give details of type of financial or legal advice provided"); 
document.ProfIndem1.details_of_fin_legal_advice.focus(); 
return false; 
}
//IFF fin_leg_advice THEN finleg_partimers
var radioVal = valRadiobutton(document.ProfIndem1.fin_leg_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.finleg_partimers.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Financial or legal advice?', \n\nplease fill in the field:\n\n2. b) How many people provide it? \n\nPart Time"); 
document.ProfIndem1.finleg_partimers.focus(); 
return false; 
}
//IFF fin_leg_advice THEN finleg_fulltimers
var radioVal = valRadiobutton(document.ProfIndem1.fin_leg_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.finleg_fulltimers.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Financial or legal advice?', \n\nplease fill in the field:\n\n2. b) How many people provide it? \n\nFull Time"); 
document.ProfIndem1.finleg_fulltimers.focus(); 
return false; 
}
//IFF fin_leg_advice THEN finleg_qualifications
var radioVal = valRadiobutton(document.ProfIndem1.fin_leg_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.finleg_qualifications.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Financial or legal advice?', \n\nplease fill in the field:\n\n2. c) What is the qualification/background/experience of the people who provide it?"); 
document.ProfIndem1.finleg_qualifications.focus(); 
return false; 
}
//IFF fin_leg_advice THEN finleg_enquiries_per_annum
var radioVal = valRadiobutton(document.ProfIndem1.fin_leg_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.finleg_enquiries_per_annum.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Financial or legal advice?', \n\nplease fill in the field:\n\n2. d) Approximate number of enquiries per annum?"); 
document.ProfIndem1.finleg_enquiries_per_annum.focus(); 
return false; 
}



//IFF counselling THEN details_of_counselling
var radioVal = valRadiobutton(document.ProfIndem1.counselling); 
if((radioVal == 'Yes') && (document.ProfIndem1.details_of_counselling.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Counselling?', \n\nplease fill in the field:\n\n3. a) Give details of the type of counselling provided"); 
document.ProfIndem1.details_of_counselling.focus(); 
return false; 
}
//IFF counselling THEN counselling_partimers
var radioVal = valRadiobutton(document.ProfIndem1.counselling); 
if((radioVal == 'Yes') && (document.ProfIndem1.counselling_partimers.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Counselling?', \n\nplease fill in the field:\n\n3. b) How many people provide it? \n\nPart Time"); 
document.ProfIndem1.counselling_partimers.focus(); 
return false; 
}
//IFF counselling THEN counselling_fulltimers
var radioVal = valRadiobutton(document.ProfIndem1.counselling); 
if((radioVal == 'Yes') && (document.ProfIndem1.counselling_fulltimers.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Counselling?', \n\nplease fill in the field:\n\n3. b) How many people provide it? \n\nFull Time"); 
document.ProfIndem1.counselling_fulltimers.focus();
return false; 
}
//IFF counselling THEN counselling_qualifications
var radioVal = valRadiobutton(document.ProfIndem1.counselling); 
if((radioVal == 'Yes') && (document.ProfIndem1.counselling_qualifications.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Counselling?', \n\nplease fill in the field:\n\n3. c) What is the qualification/background/experience of the people who provide it?");
document.ProfIndem1.counselling_qualifications.focus(); 
return false; 
}
//IFF counselling THEN counselling_enquiries_per_annum
var radioVal = valRadiobutton(document.ProfIndem1.counselling); 
if((radioVal == 'Yes') && (document.ProfIndem1.counselling_enquiries_per_annum.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Counselling?', \n\nplease fill in the field:\n\n3. d) Approximate number of enquiries per annum?"); 
document.ProfIndem1.counselling_enquiries_per_annum.focus(); 
return false; 
}




//IFF fin_leg_advice OR counselling THEN require finleg_procedures [textarea]
//IFF incorporated_as_a_body_corporate OR separately_incorporated_company THEN companies_concerned
var radioVal1 = valRadiobutton(document.ProfIndem1.fin_leg_advice);
var radioVal2 = valRadiobutton(document.ProfIndem1.counselling);
// Check the value of the FIRST radio button group in question
if(((radioVal1 == 'Yes') ||
// Check the value of the SECOND radio button group in question
(radioVal2 == 'Yes')) &&
// Check for blank field
(document.ProfIndem1.finleg_procedures.value == '')) { 
alert("As you have answered 'Yes' to EITHER: \n\nDoes the Charity provide... ...Financial or legal advice? \n\nOR: \n\nDoes the Charity provide... ...Counselling? \n\nor BOTH, please provide a response to:\n\n4. a) Where counselling or financial or legal advice is provided, give details of present procedures/guidelines which identify situations where the person being counselled/advised should be encouraged to seek independent professional advice"); 
document.ProfIndem1.finleg_procedures.focus();  // and focus on the blank field
return false; 
}

//IFF fin_leg_advice OR counselling THEN require finleg_recommend_advisors [radio]
var radioVal1 = valRadiobutton(document.ProfIndem1.fin_leg_advice);
var radioVal2 = valRadiobutton(document.ProfIndem1.counselling);
var radioVal3 = valRadiobutton(document.ProfIndem1.finleg_recommend_advisors);
// Check the value of the FIRST radio button group in question and set up OR condition
if(((radioVal1 == 'Yes') ||
// Check the value of the SECOND radio button group in question and set up AND condition
(radioVal2 == 'Yes')) &&
// Check for blank field
(radioVal3 == '')) { 
alert("As you have answered 'Yes' to EITHER: \n\nDoes the Charity provide... ...Financial or legal advice? \n\nOR: \n\nDoes the Charity provide... ...Counselling? \n\nor BOTH, please provide a response to:\n\n4. b) Where such independent advice is appropriate, is it usual practice to recommend one or more named advisors?"); 
document.ProfIndem1.finleg_recommend_advisors[0].focus(); // and focus on the first option
return false; 
}



//IFF medical_advice THEN details_of_med_advice
var radioVal = valRadiobutton(document.ProfIndem1.medical_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.details_of_med_advice.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Medical advice, diagnosis or treatment?', \n\nplease fill in the field:\n\n5. Give details of medical advice, diagnosis or treatment provided"); 
document.ProfIndem1.details_of_med_advice.focus(); 
return false; 
}
// but NOT, notice: IFF medical_advice THEN medical_partimers -> medical_enquiries_per_annum! - because not one is on the form



//IFF other_advice THEN details_of_other_services
var radioVal = valRadiobutton(document.ProfIndem1.other_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.details_of_other_services.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Other kind of advice or information?', \n\nplease fill in the field:\n\n6. a) Give full details of other services (e.g. advice, information, assistance, design) provided"); 
document.ProfIndem1.details_of_other_services.focus(); 
return false; 
}
//IFF other_advice THEN other_partimers
var radioVal = valRadiobutton(document.ProfIndem1.other_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.other_partimers.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Other kind of advice or information?', \n\nplease fill in the field:\n\n6. b) How many people provide it? \n\nPart Time"); 
document.ProfIndem1.other_partimers.focus(); 
return false; 
}
//IFF other_advice THEN other_fulltimers
var radioVal = valRadiobutton(document.ProfIndem1.other_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.other_fulltimers.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Other kind of advice or information?', \n\nplease fill in the field:\n\n6. b) How many people provide it? \n\nFull Time"); 
document.ProfIndem1.other_fulltimers.focus(); 
return false; 
}
//IFF other_advice THEN other_qualifications
var radioVal = valRadiobutton(document.ProfIndem1.other_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.other_qualifications.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Other kind of advice or information?', \n\nplease fill in the field:\n\n6. c) What is the qualification/background/experience of the people who provide it?"); 
document.ProfIndem1.other_qualifications.focus(); 
return false; 
}
// IFF other_advice THEN other_enquiries_per_annum
var radioVal = valRadiobutton(document.ProfIndem1.other_advice); 
if((radioVal == 'Yes') && (document.ProfIndem1.other_enquiries_per_annum.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'Does the Charity provide... ...Other kind of advice or information?', \n\nplease fill in the field:\n\n6. d) Approximate number of enquiries per annum?"); 
document.ProfIndem1.other_enquiries_per_annum.focus(); 
return false; 
}

// textbox gross_income_forthcoming without or with pound sign
if((document.ProfIndem1.gross_income_forthcoming.value == '') || (document.ProfIndem1.gross_income_forthcoming.value == '£')) { 
alert('Please fill in the field: \n\nState gross income or total turnover... \nForthcoming Year (estimated)'); 
document.ProfIndem1.gross_income_forthcoming.focus(); 
return false; 
}
// textbox gross_income_last without or with pound sign
if((document.ProfIndem1.gross_income_last.value == '') || (document.ProfIndem1.gross_income_last.value == '£')) { 
alert('Please fill in the field: \n\nState gross income or total turnover... \nLast Year'); 
document.ProfIndem1.gross_income_last.focus(); 
return false; 
}
// textbox gross_income_previous without or with pound sign
if((document.ProfIndem1.gross_income_previous.value == '') || (document.ProfIndem1.gross_income_previous.value == '£')) { 
alert('Please fill in the field: \n\nState gross income or total turnover... \nPrevious Year'); 
document.ProfIndem1.gross_income_previous.focus(); 
return false; 
}




//radio claim_made
var radioVal = valRadiobutton(document.ProfIndem1.claim_made); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\n9. a) Has any claim been made against the Proposer or any predecessors in business or any trustee, director, consultant, or employee for neglect, error or omission in relation to professional duties? \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.claim_made[0].focus(); // and focus on the first option
return false; 
}
//IFF claim_made THEN claim_dates
var radioVal = valRadiobutton(document.ProfIndem1.claim_made); 
if((radioVal == 'Yes') && (document.ProfIndem1.claim_dates.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'9. a) Has any claim been made against the Proposer or any predecessors in business or any trustee, director, consultant, or employee for neglect, error or omission in relation to professional duties?', \n\nplease fill in the field:\n\nDate(s) of claim(s) or loss(es) [dd/mm/yyyy]"); 
document.ProfIndem1.claim_dates.focus(); 
return false; 
}
//IFF claim_made THEN claim_details
var radioVal = valRadiobutton(document.ProfIndem1.claim_made); 
if((radioVal == 'Yes') && (document.ProfIndem1.claim_details.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'9. a) Has any claim been made against the Proposer or any predecessors in business or any trustee, director, consultant, or employee for neglect, error or omission in relation to professional duties?', \n\nplease fill in the field:\n\nBrief details of each claim or loss"); 
document.ProfIndem1.claim_details.focus(); 
return false; 
}
//IFF claim_made THEN claim_cost - with check for pound sign
var radioVal = valRadiobutton(document.ProfIndem1.claim_made); 
if((radioVal == 'Yes') && ((document.ProfIndem1.claim_cost.value == '') || (document.ProfIndem1.claim_cost.value == '£'))) { 
alert("As you have answered 'Yes' to the question:\n\n'9. a) Has any claim been made against the Proposer or any predecessors in business or any trustee, director, consultant, or employee for neglect, error or omission in relation to professional duties?', \n\nplease fill in the field:\n\nCost (if any) of claim paid or loss incurred"); 
document.ProfIndem1.claim_cost.focus(); 
return false; 
}
//IFF claim_made THEN outstanding_cost - with check for pound sign
var radioVal = valRadiobutton(document.ProfIndem1.claim_made); 
if((radioVal == 'Yes') && ((document.ProfIndem1.outstanding_cost.value == '') || (document.ProfIndem1.outstanding_cost.value == '£'))) { 
alert("As you have answered 'Yes' to the question:\n\n'9. a) Has any claim been made against the Proposer or any predecessors in business or any trustee, director, consultant, or employee for neglect, error or omission in relation to professional duties?', \n\nplease fill in the field:\n\nEstimated outstanding cost"); 
document.ProfIndem1.outstanding_cost.focus(); 
return false; 
}
//IFF claim_made THEN action_taken
var radioVal = valRadiobutton(document.ProfIndem1.claim_made); 
if((radioVal == 'Yes') && (document.ProfIndem1.action_taken.value == '')) { 
alert("As you have answered 'Yes' to the question:\n\n'9. a) Has any claim been made against the Proposer or any predecessors in business or any trustee, director, consultant, or employee for neglect, error or omission in relation to professional duties?', \n\nplease fill in the field:\n\n9. b) What action has been taken to prevent the recurrence of the situation which gave rise to the claim or loss?"); 
document.ProfIndem1.action_taken.focus(); 
return false; 
}







//radio potential_claim_aware
var radioVal = valRadiobutton(document.ProfIndem1.potential_claim_aware); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\n10. Is any trustee, principal, director, consultant or employee AFTER ENQUIRY aware of any circumstances which might...\n\na) give rise to a claim against the Proposer or any predecessors in the business or any of the present or former trustees or principals? \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.potential_claim_aware[0].focus(); // and focus on the first option
return false; 
}

//radio potential_losses_aware
var radioVal = valRadiobutton(document.ProfIndem1.potential_losses_aware); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\n10. Is any trustee, principal, director, consultant or employee AFTER ENQUIRY aware of any circumstances which might...\n\nb) result in the Proposer or any predecessors in the business or any of the present or former trustees or principals incurring any losses or expenses which might be within the terms of this cover?  \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.potential_losses_aware[0].focus(); // and focus on the first option
return false; 
}

//radio potential_consideration_aware
var radioVal = valRadiobutton(document.ProfIndem1.potential_consideration_aware); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to:\n\n10. Is any trustee, principal, director, consultant or employee AFTER ENQUIRY aware of any circumstances which might...\n\nc) otherwise affect the Company's consideration of this insurance? \n\nSorry, but you MUST make a selection!"); 
document.ProfIndem1.potential_consideration_aware[0].focus(); // and focus on the first option
return false; 
}



//IFF potential_claim_aware OR potential_losses_aware OR potential_consideration_aware THEN potential_claim_details
var radioVal1 = valRadiobutton(document.ProfIndem1.potential_claim_aware); 
var radioVal2 = valRadiobutton(document.ProfIndem1.potential_losses_aware); 
var radioVal3 = valRadiobutton(document.ProfIndem1.potential_consideration_aware); 
if(((radioVal1 == 'Yes') || (radioVal2 == 'Yes')  || (radioVal3 == 'Yes')) && (document.ProfIndem1.potential_claim_details.value == '')) { 
alert("As you have answered 'Yes' to AT LEAST ONE of the questions:\n\n'10. Is any trustee, principal, director, consultant or employee AFTER ENQUIRY aware of any circumstances which might... \n\na) give rise to a claim against the Proposer or any predecessors in the business or any of the present or former trustees or principals? \nb) result in the Proposer or any predecessors... ...incurring any losses or expenses which might be within the terms of this cover? \nc) otherwise affect the Company's consideration of this insurance?', \n\nplease fill in the field:\n\ndetails"); 
document.ProfIndem1.potential_claim_details.focus(); 
return false; 
}


//IFF potential_claim_aware OR potential_losses_aware OR potential_consideration_aware THEN potential_claim_max_cost - at the same time taking the pound sign into account
var radioVal1 = valRadiobutton(document.ProfIndem1.potential_claim_aware); 
var radioVal2 = valRadiobutton(document.ProfIndem1.potential_losses_aware); 
var radioVal3 = valRadiobutton(document.ProfIndem1.potential_consideration_aware); 
if(((radioVal1 == 'Yes') || (radioVal2 == 'Yes')  || (radioVal3 == 'Yes')) && ((document.ProfIndem1.potential_claim_max_cost.value == '') || (document.ProfIndem1.potential_claim_max_cost.value == '£'))) { 
alert("As you have answered 'Yes' to AT LEAST ONE of the questions:\n\n'10. Is any trustee, principal, director, consultant or employee AFTER ENQUIRY aware of any circumstances which might... \n\na) give rise to a claim against the Proposer or any predecessors in the business or any of the present or former trustees or principals? \nb) result in the Proposer or any predecessors... ...incurring any losses or expenses which might be within the terms of this cover? \nc) otherwise affect the Company's consideration of this insurance?', \n\nplease fill in the field:\n\maximum potential cost"); 
document.ProfIndem1.potential_claim_max_cost.focus(); 
return false; 
}



// Get the value of the radio button group in question
// valRadioButton is a function we define down below 
var radioVal = valRadiobutton(document.ProfIndem1.resubmitting); 
//make sure that the user actually selected one of the radio buttons: 
if (radioVal == '') { 
alert("It looks like you forgot to click on your choice in response to the \n'Are you resubmitting...' question. \n \nSorry, but you MUST make a selection!"); 
document.ProfIndem1.resubmitting[0].focus(); // and focus on the first option
return false; 
}



//check for two conditions within a single field to make sure something else (beyond the conditions) is filled in 
if((document.ProfIndem1.full_name_1.value == '') || (document.ProfIndem1.full_name_1.value == 'your full name')) { 
alert('Please fill in the first \'your full name\' field, in the declaration, with: \n\nyour full name'); 
document.ProfIndem1.full_name_1.focus(); 
return false; 
}


//check for two conditions within a single field to make sure something else (beyond the conditions) is filled in
if((document.ProfIndem1.full_name_2.value == '') || (document.ProfIndem1.full_name_2.value == 'your full name')) { 
alert('Please fill in the second  \'your full name\' field, just after the declaration, with: \n\nyour full name'); 
document.ProfIndem1.full_name_2.focus(); 
return false; 
}



// Now make sure that the names given in the declaration match each other
  if (document.ProfIndem1.full_name_1.value.toLowerCase() != document.ProfIndem1.full_name_2.value.toLowerCase()) {

alert("The two instances of 'your full name' that you\'ve just entered must match each other exactly!\n\nPlease check them both to make sure they match and have no spaces at the end or other typos."); 
document.ProfIndem1.full_name_1.focus(); 
return false; 
} //end if 


//check a field to make sure it's not blank 
if(document.ProfIndem1.date.value == '') { 
alert('Please fill in the field: \n\nDate'); 
document.ProfIndem1.date.focus(); 
return false; 
}


//if the checking gets this far, everything checked is OK 

return; 

}// end validate function 



/*  this function gets the value of a required radio group */
function valRadiobutton(radiobutton) { 
myOption = -1; 
for (i=0; i< radiobutton.length; i++) { 
if (radiobutton[i].checked) { 
myOption = i; 
}
}
if (myOption == -1) { 
return ""; 
} else { 
return radiobutton[myOption].value 
}
}// end function valRadioButton 


//EOF