// ****************************************************************************************************************
// Javascript functions for the IBABC website
// ****************************************************************************************************************



// ****************************************************************************************************************
// trim leading/trailing white spacess
// ****************************************************************************************************************

function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 



// ****************************************************************************************************************
// validate Contact IBABC form
// ****************************************************************************************************************
function validate_video1(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name"))
			if(validate_field(f.brokerage.value, "Brokerage")) 
				if(validate_radio(f.member, "Is your brokerage a member?")) 
					if(validate_field(f.facilitator.value, "Level 3 Facilitator Name")) 
					if(validate_field(f.license.value, "License Number")) {

	return true;
	}

	return false;
}



// ****************************************************************************************************************
// For video request: open popup window to let user add a new participant
// ****************************************************************************************************************
function open_popup(buttonname){
	newWindow=window.open('educat_resour_reques_add.asp?bname='+buttonname, 'Videos', 'height=410,width=320')
	newWindow.opener = self; 
  	newWindow.focus(); 
}


// ****************************************************************************************************************
// For seminar registration: open popup window to let user add a new participant
// ****************************************************************************************************************
function open_sem_popup(buttonname){
	newWindow=window.open('educat_semina_semreg_add.asp', 'Videos', 'height=410,width=320')
	newWindow.opener = self; 
  	newWindow.focus(); 
}


// ****************************************************************************************************************
// For Seminar registration
// ****************************************************************************************************************
function validate_seminar(f) {

	if(validate_field(f.brokerage.value, "Brokerage")) 
		if(validate_field(f.biz_street.value, "Street")) 
			if(validate_field(f.biz_city.value, "City")) 
				if(validate_field(f.biz_postal.value, "Postal Code")) 
					if(validate_radio(f.member, "Are you a member?")) 
						if(validate_field(f.participants.value, "Participants")) 
							if(validate_field(f.names.value, "Names")) 
							  if (validate_partic(f.participants.value, f.names.value, f)) {

		return true;
		}
	return false;
}


// ****************************************************************************************************************
// For Event registration
// ****************************************************************************************************************
function validate_event(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_field(f.brokerage.value, "Brokerage")) 
				if(validate_field(f.biz_street.value, "Street")) 
					if(validate_field(f.biz_city.value, "City")) 
						if(validate_field(f.biz_postal.value, "Postal Code")) 
							if(validate_radio(f.member, "Are you a member?")) {

		return true;
		}
	return false;
}



// ****************************************************************************************************************
// check to see if no. of workbooks equals no. of participants
// if not show message box
// ****************************************************************************************************************
function validate_partic(num_person, participants, frm) {
	
	var str;
	var i;
	var count;
	var no_person;

   no_person = parseFloat(num_person);

	count = 0;

	str = participants

	// find number of people by counting number of commas
	for (i = 0; i < str.length; i++) {
		if (str.charAt(i) == ",") 
			count += 1;
	}

	if (count != no_person) {
		alert("The number of participants does not match the number of names in the Names field.");
		return false;
	}
	else	
		return true;
}	



// ****************************************************************************************************************
// For Homeowners video series
// make sure the number of workbooks equal the number of participants
// ****************************************************************************************************************
function validate_homeowners(f) {

 if (validate_book_partic(f.book_H1.options.selectedIndex, f.H1_names.value, "Homeowners Policy Concepts", f))
  if (validate_book_partic(f.book_H2.options.selectedIndex, f.H2_names.value, "Definitions - Insured Sections A, B, C, & D", f))
	if (validate_book_partic(f.book_H3.options.selectedIndex, f.H3_names.value, "Standard, Broad, & Comprehensive Forms", f))
	 if (validate_book_partic(f.book_H4.options.selectedIndex, f.H4_names.value, "Deductibles, Section C Limitations & Optional Loss", f))
	  if (validate_book_partic(f.book_H5.options.selectedIndex, f.H5_names.value, "Business Use of Premises", f))
		if (validate_book_partic(f.book_H6.options.selectedIndex, f.H6_names.value, "Personal Articles Floater & Jewelry Appraisals", f))
		 if (validate_book_partic(f.book_H7.options.selectedIndex, f.H7_names.value, "Miscellaneous Floaters, Rental, & Seasonal Dwellings", f))
		  if (validate_book_partic(f.book_H8.options.selectedIndex, f.H8_names.value, "Comprehensive Personal Liability & Pleasurecraft Insurance", f))

		return true;

	return false;
}




// ****************************************************************************************************************
// For Liability & customer service video series
// make sure the number of workbooks equal the number of participants
// ****************************************************************************************************************
function validate_liability(f) {

 if (validate_book_partic(f.book_L1.options.selectedIndex, f.L1_names.value, "General Liability Concepts", f))
  if (validate_book_partic(f.book_L2.options.selectedIndex, f.L2_names.value, "Tort Law - Contract Law", f))
	if (validate_book_partic(f.book_L3.options.selectedIndex, f.L3_names.value, "Additional Common Law Concepts", f))
	 if (validate_book_partic(f.book_L4.options.selectedIndex, f.L4_names.value, "Liability Policy Components Part A", f))
	  if (validate_book_partic(f.book_L5.options.selectedIndex, f.L5_names.value, "Liability Policy Components Part B", f))
		if (validate_book_partic(f.book_L6.options.selectedIndex, f.L6_names.value, "Excess & Umbrella Coverages", f))
		 if (validate_book_partic(f.book_L7.options.selectedIndex, f.L7_names.value, "Introduction to the CGL Policy Declarations & Limits of Insurance", f))
		  if (validate_book_partic(f.book_L8.options.selectedIndex, f.L8_names.value, "The Insuring Agreements & Supplementary Payments", f))
          if (validate_book_partic(f.book_L9.options.selectedIndex, f.L9_names.value, "Policy Exclusions Part A", f))
           if (validate_book_partic(f.book_L10.options.selectedIndex, f.L10_names.value, "Policy Exclusions Part B", f))
	         if (validate_book_partic(f.book_L11.options.selectedIndex, f.L11_names.value, "Employers Liability Concepts & Coverages", f))
	          if (validate_book_partic(f.book_L12.options.selectedIndex, f.L12_names.value, "Products Liability - Completed Operations Liability", f))
	           if (validate_book_partic(f.book_L13.options.selectedIndex, f.L13_names.value, "Introduction to the Comprehensive Personal Liability Policy - Definitions", f))
		         if (validate_book_partic(f.book_L14.options.selectedIndex, f.L14_names.value, "The Insuring Agreements & Extensions Supp. Payments", f))
		          if (validate_book_partic(f.book_L15.options.selectedIndex, f.L15_names.value, "The Exclusions & Business Property Use", f))
		           if (validate_book_partic(f.book_C1.options.selectedIndex, f.C1_names.value, "Moments of Truth (available to Members only)", f))
		            if (validate_book_partic(f.book_C2.options.selectedIndex, f.C2_names.value, "Telephone Courtesy (available to Members only", f))
		             if (validate_book_partic(f.book_C3.options.selectedIndex, f.C3_names.value, "Calming Upset Customers (available to Members only", f))

		return true;

	return false;
}


// ****************************************************************************************************************
// For Commercial property insurance video series
// make sure the number of workbooks equal the number of participants
// ****************************************************************************************************************
function validate_commercial(f) {

 if (validate_book_partic(f.book_P1.options.selectedIndex, f.P1_names.value, "History & Legal Aspects of Fire Insurance", f))
  if (validate_book_partic(f.book_P2.options.selectedIndex, f.P2_names.value, "Statutory Conditions 1 to 5 Standard Mortgage Clause", f))
	if (validate_book_partic(f.book_P3.options.selectedIndex, f.P3_names.value, "Statutory Conditions 6 to 15", f))
	 if (validate_book_partic(f.book_P4.options.selectedIndex, f.P4_names.value, "Other Policy Conditions, Construction Types, Hazards, & Basic Classifications", f))
	  if (validate_book_partic(f.book_P5.options.selectedIndex, f.P5_names.value, "The Standard Fire Policy & Extended Coverages", f))
		if (validate_book_partic(f.book_P6.options.selectedIndex, f.P6_names.value, "Replacement Cost Insurance, By-law Endorsements, Riders, & Electronic Data Policy", f))
		 if (validate_book_partic(f.book_P7.options.selectedIndex, f.P7_names.value, "Introduction to IBC Broad Form Wordings", f))
		  if (validate_book_partic(f.book_P8.options.selectedIndex, f.P8_names.value, "Broad Form Exclusions", f))
          if (validate_book_partic(f.book_P9.options.selectedIndex, f.P9_names.value, "Broad Form - Other Policy Conditions", f))
           if (validate_book_partic(f.book_P10.options.selectedIndex, f.P10_names.value, "Enhancements to the Broad Form Wordings", f))
	         if (validate_book_partic(f.book_P11.options.selectedIndex, f.P11_names.value, "Boiler & Machinery Insurance", f))
	          if (validate_book_partic(f.book_P12.options.selectedIndex, f.P12_names.value, "Contractors Broad Form Wordings", f))
	           if (validate_book_partic(f.book_P13.options.selectedIndex, f.P13_names.value, "Introduction to Business Interruption Insurance", f))
		         if (validate_book_partic(f.book_P14.options.selectedIndex, f.P14_names.value, "The Gross Earnings Forms", f))
		          if (validate_book_partic(f.book_P15.options.selectedIndex, f.P15_names.value, "The Profits Insurance Forms", f))
		           if (validate_book_partic(f.book_P16.options.selectedIndex, f.P16_names.value, "The Business Income Forms", f))
		            if (validate_book_partic(f.book_P17.options.selectedIndex, f.P17_names.value, "Rental Income Forms", f))
		             if (validate_book_partic(f.book_P18.options.selectedIndex, f.P18_names.value, "Miscellaneous Business Interruption Forms", f))

		return true;

	return false;
}


// ****************************************************************************************************************
// check to see if no. of workbooks equals no. of participants
// if not show message box
// ****************************************************************************************************************
function validate_book_partic(books, participants, title, frm) {
	
	var str;
	var i;
	var count;

	count = 0;

	str = participants

	for (i = 0; i < str.length; i++) {
		if (str.charAt(i) == ",") 
			count += 1;
	}

	if (count != books) {
		alert("The number of workbooks is not equal to the number of participants for the video '" + title + "'.");
		return false;
	}
	else	
		return true;
}	


// ****************************************************************************************************************
// validation for the second page of CAIB registration
// ****************************************************************************************************************
function validate_CAIB2(f) {
	
	var radioCourse;
	var radioPromise;
	var i;
	var strChoice;
	var selected;
	var course_done;

	course_done = "no";
	selected = "no";
	strChoice = "x"; 
	
	radioCourse = f.course;
	radioPromise = f.promise;

	// go through all the radio buttons
	// if a button is selected, find its value and assign it to a string
	for (i = 0; i < radioCourse.length; i++) {
			
		if (radioCourse[i].checked) {
			strChoice = radioCourse[i].value;	
			selected = "yes";		
		}				
	}
	
	//alert("string: " + strChoice + "  1st letter: " + strChoice.charAt(0));
	
		// if the 1st character is "c", check that the class and exam location are filled in
		if (strChoice.charAt(0) == "c") {

			if(f.c_class_loc.value == "" && f.c_exam_loc.value == "") {
				alert("Please fill in the Class Location and Exam Location fields under Option C.");
				return false;
			}
	
			else if(f.c_class_loc.value == "") {
				alert("Please fill in the Class Location field under Option C.");
				return false;
			}
	
			else if(f.c_exam_loc.value == "" && f.c_exam_loc.value == "") {
				alert("Please fill in the Exam Location field under Option C.");
				return false;
			}
		}

		// if it's a "b", make sure the Preferred Location field is entered	
		else if (strChoice.charAt(0) == "b") {
			
			if(f.b_preferred_loc.value == "") {
				alert("Please fill in the Preferred Location field under Option B.");
				return false;
			}
		}

		// if it's an "o", make sure the Preferred Exam Location field is entered	
		//else if (strChoice.charAt(0) == "o") {
			
		//	if(f.o_preferred_loc.value == "") {
		//		alert("Please fill in the Preferred Exam Location field under Option A(2).");
		//		return false;
		//	}
		//}
		
		// make sure the exam date is filled in
		else if (strChoice.charAt(0) == "a") {

			if(f.exam_date.value == "") {
				alert("Please fill in the Exam Date field under Options A, D, & E.");
				return false;
			}
		}	

		// make sure the exam date is filled in
		else if (strChoice.charAt(0) == "d") {
			
			if(f.exam_date.value == "") {
				alert("Please fill in the Exam Date field under Options A, D, & E.");
				return false;
			}
		}

		// make sure the exam date is filled in
		else if (strChoice.charAt(0) == "e") {
			
			if(f.exam_date.value == "") {
				alert("Please fill in the Exam Date field under Options A, D, & E.");
				return false;
			}
		}
		
		// make sure the exam date is filled in
		//else if (strChoice.charAt(0) == "f") {
			//
			//if(f.exam_date.value == "") {
				//alert("Please fill in the Exam Date field under Options A, D, E, & F");
				//return false;
			//}
		//}		

		// make sure the preferred location field is filled in
		else if (strChoice.charAt(0) == "g") {
				
			if(f.g_preferred_loc.value == "") {
				alert("Please fill in the Preferred Location field under Option G.");
				return false;
			}
		}
				
		else {
			alert("Please select a course type.");	
			return false;
		}
			
	if (!(radioPromise[0].checked) && !(radioPromise[1].checked))	{
		alert("Please answer the last question.");
		return false;
	}

	return true;
}	



// ****************************************************************************************************************
// validate 1st page of CAIB registration
// ****************************************************************************************************************
function validate_CAIB1(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_home_biz_addr(f.biz_street.value, f.biz_city.value, f.biz_postal.value, f.home_street.value, f.home_city.value, f.home_postal.value))	
				if(validate_radio(f.member, "My firm is a member in good standing of the Insurance Brokers Association of B.C.")) 
					if(validate_1st_course(f.first_course, f.course_year.value)) {

	return true;
	}

	//else
		return false;
}


// ****************************************************************************************************************
// validate CE Seminar registration
// ****************************************************************************************************************

function validate_CESeminar(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name"))
			if(validate_radio(f.member, "IBABC Member: Yes/No"))  
				if(validate_field(f.business_name.value, "Business Name")) 
					if(validate_field(f.business_address.value, "Business Address")) 
						if(validate_field(f.business_telephone.value, "Business Telephone Number")) 
							if(validate_field(f.business_fax.value, "Business Fax"))
								if(validate_pers_org_email(f.email_pers.value, f.email_org.value)) {

	return true;
	}

	//else
		return false;
}


// ****************************************************************************************************************
// make sure the question: Is this the first time you have enrolled... is answered
// ****************************************************************************************************************
function validate_1st_course(rad, course_yr) {

	var radioGroup;
	var selectedChoice;
	var i;

	selectedChoice = "cfs";
	radioGroup = rad;

	for (i = 0; i < radioGroup.length; i++) {
		if (radioGroup[i].checked) {
			selectedChoice = radioGroup[i].value;			
		}
	}	

	if (selectedChoice == "no") {

		if (course_yr == "") {
			alert("Please fill in the Year field.");
			return false;
		}
	}

	else if (selectedChoice == "yes") {
		return true;
	}

	else {
		alert("Please answer the question 'Is this the first time you have enrolled for a CAIB course?'");
		return false;
	}

	return true;
}



// ****************************************************************************************************************
// make sure a radio button is selected
// ****************************************************************************************************************
function validate_radio(rad, text) {

	var radioGroup;
	var selectedChoice;
	var i;

	radioGroup = rad;

	for (i = 0; i < radioGroup.length; i++) {
		if (radioGroup[i].checked) {
			selectedChoice = radioGroup[i].value;
			return true;
		}
	}	

	alert("Please answer the question '" + text + "'");

	return false;
}



// ****************************************************************************************************************
// make sure at least the home address or business address is filled in
// ****************************************************************************************************************
function validate_home_biz_addr(bstreet, bcity, bpostal, hstreet, hcity, hpostal) {

	// if business and home streets are blank
	if (bstreet == "" && hstreet == "") {
		alert("You must enter either your business address or home address.")
		return false;
	}	
					
	else
		// if business street is filled in, make sure its city and postal code are filled in also
		if (bstreet != "" && hstreet == "") {
		
			if(bcity == "") {
				alert("Please enter your business city.")		
				return false;
			}
		
			else
				if(bpostal == "") {
					alert("Please enter your business postal code.")
					return false;
				}
			return true;
		}
			
	else
		// if home street is filled in, make sure its city and postal code are filled also
		if (bstreet == "" && hstreet != "") {
			
			if (hcity == "") {
				alert("Please enter your home city.")
				return false;
			}		
		
			else
				if (hpostal == "") {
					alert("Please enter your home postal code.")
					return false;
				}
			return true;
		}	

	else {
		// if home and business street are filled, make sure at least one of the addresses is completely filled in
		if (bstreet != "" && hstreet != "") {
				
			if (hcity == "" | hpostal == "") {
				if (bcity == "" | bpostal == "") {
					alert("Please enter either your full business or home address.");
					return false;
				}
				else
					return true;
			}
			else
				return true;
		}
	}
}


// ****************************************************************************************************************
// make sure at least one email address (personal or organizational) is filled in
// ****************************************************************************************************************
function validate_pers_org_email(persemail, orgemail) {

	// if personal and organizational emails are blank
	if (persemail == "" && orgemail == "") {
		alert("You must enter either your personal or organizational e-mail address.");
		return false;
	}
	return true;	
}
			

// ****************************************************************************************************************
// make sure a field is filled in
// ****************************************************************************************************************
function validate_field(field, text) {

	// if first name is blank		
	if(trim(field) == "") {
		alert("Please fill in the " + text + " field.")
		return false;
	}
	return true;	
}



// ****************************************************************************************************************
// calculate total cost for Immersion registration
// ****************************************************************************************************************
//function calc_immers_cost(f) {

//	var today;
//	var compared_date;

//	today = new Date();
//	compared_date = new Date(1999, 5, 1);	

	// if user registers before June 1, 1999
//	if (today < compared_date) {

		// if Member is selected
//		if (f.fee[0].checked) {
//			f.total.value = "375.00";
//			return true;
//		}

//		else
			// if Non-Member is selected
//			if (f.fee[1].checked) {
//				f.total.value = "500.00";
//				return true;
//			}

//		else {
//			alert("Please select a course package.");
//			return true;
//		}			
//	}
//	else {
		// if user registers on or after June 1, 1999
//		if (today >= compared_date) {
			
			// if Member is selected
//			if (f.fee[0].checked) {
//				f.total.value = "445.00";
//				return true;
//			}

//			else
				// if Non-Member is selected
//				if (f.fee[1].checked) {
//					f.total.value = "590.00";
//					return true;
//				}

//			else {
//				alert("Please select a course package.");
//				return true;
//			}			
			
//			return true;
//		}
//		return true;
//	}
//}



// ****************************************************************************************************************
// calculate total cost for Immersion registration
// ****************************************************************************************************************
function calc_immers_cost(f) {

//	var today;
//	var compared_date;

//	today = new Date();
//	compared_date = new Date(1999, 5, 1);	

	if (!(parseFloat(f.accom.value))) { 
		alert("Please fill in the Accomodation field.");
		return false;
	}

	else {

		// if user registers before June 1, 1999
//		if (today < compared_date) {

			// if Member is selected
//			if (f.fee[0].checked) {
//				f.total.value = 375.00 + parseFloat(f.accom.value);
//				return true;
//			}

//			else
				// if Non-Member is selected
//				if (f.fee[1].checked) {
//					f.total.value = 500.00 + parseFloat(f.accom.value);
//					return true;
//				}

//			else {
//				alert("Please select a course package.");
//				return true;
//			}			
//		}
//		else {
			// if user registers on or after June 1, 1999
//			if (today >= compared_date) {
			
				// if Member is selected
				if (f.fee[0].checked) {
					f.total.value = 445.00 + parseFloat(f.accom.value);
					return true;
				}

				else
					// if Non-Member is selected
					if (f.fee[1].checked) {
						f.total.value = 590.00 + parseFloat(f.accom.value);
						return true;
					}

				else {
					alert("Please select a course package.");
					return true;
				}			
			
				return true;
			}
			return true;
//		}
//		return true;
//	}
}


// ****************************************************************************************************************
// validate Immersion registration
// ****************************************************************************************************************
function validate_immersion(f) {

	if(validate_field(f.name.value, "Name")) 
		if(validate_field(f.badge.value, "Name for Badge")) 
			if(validate_field(f.street.value, "Street")) 
				if(validate_field(f.city.value, "City")) 
					if(validate_field(f.postal.value, "Postal Code")) 
						if(validate_radio(f.promise, "If employed by a member broker: I confirm the applicant is employed or will be employed upon successful completion of the exam by the above-named firm and the firm accepts responsibility for all fees incurred from this course.")) 
							if(validate_field(f.principal.value, "Principal")) 
								if(validate_radio(f.fee, "Please select a course package.")) 
								  if(validate_field(f.dates.value, "Class Dates"))
									if(validate_field(f.accom.value, "Accommodation")) {

	return true;
	}

	//else
		return false;
}



// ****************************************************************************************************************
// validate Fundamentals of Insurance Night School registration
// ****************************************************************************************************************
function validate_nightschool(f) {

	if(validate_field(f.name.value, "Name")) 
      if(validate_field(f.badge.value, "Name for Badge")) 
		if(validate_field(f.street.value, "Street")) 
			if(validate_field(f.city.value, "City")) 
				if(validate_field(f.postal.value, "Postal Code")) 
					if(validate_radio(f.promise, "If employed by a member broker: I confirm the applicant is employed or will be employed upon successful completion of the exam by the above-named firm and the firm accepts responsibility for all fees incurred from this course.")) 
						if(validate_field(f.principal.value, "Principal")) 
							if(validate_radio(f.fee, "Please select a course package.")) {	

	return true;
	}

	//else
		return false;
}


// ****************************************************************************************************************
// calculate total cost for Nightschool registration
// ****************************************************************************************************************
function calc_night_cost(f) {

	if (f.fee[0].checked) {
		f.total.value = "375.00";
		return true;
	}

	else
		if (f.fee[1].checked) {
			f.total.value = "415.00";
			return true;
		}

	else
		if (f.fee[2].checked) {
			f.total.value = "500.00";
			return true;
		}

	else
		if (f.fee[3].checked) {
			f.total.value = "550.00";
			return true;
		}

	else {
		alert("Please select a course package.");
		return true;
	}
	return true;			
}


// ****************************************************************************************************************
// calculate total cost for Homestudy registration
// ****************************************************************************************************************
function calc_home_cost(f) {

//	var today;
//	var compared_date;

//	today = new Date();
//	compared_date = new Date(1999, 5, 1);	

	// if user registers before June 1, 1999
//	if (today < compared_date) {
		
//		if (f.text.checked && f.exam.checked) {
//			f.total.value = "140.00";
//			return true;
//		}
		
//		else
//			if (!(f.text.checked) && f.exam.checked) {
//				f.total.value = "60.00";
//				return true;
//			}

//		else
//			if (f.text.checked && !(f.exam.checked)) {
//				f.total.value = "85.00";
//				return true;
//			}

//		else
//			if (!(f.text.checked) && !(f.exam.checked)) {
//				alert("Please check the Textbook and/or Exam checkboxes.");
//				return true;
//			}
//		}

//		else {
			// if user registers on or after June 1, 1999
//			if (today >= compared_date) {
					
				if (f.text.checked && f.exam.checked) {
					f.total.value = "192.00";
					return true;
				}
		
				else
					if (!(f.text.checked) && f.exam.checked) {
						f.total.value = "80.00";
						return true;
					}

				else
					if (f.text.checked && !(f.exam.checked)) {
						f.total.value = "112.00";
						return true;
					}

				else
					if (!(f.text.checked) && !(f.exam.checked)) {
						alert("Please check the Textbook and/or Exam checkboxes.");
						return true;
					}
//				}
//			}
}


// ****************************************************************************************************************
// validate Homestudy registration
// ****************************************************************************************************************
function validate_homestudy(f) {

	//if(validate_home_biz_addr(f.biz_street.value, f.biz_city.value, f.biz_postal.value, f.home_street.value, f.home_city.value, f.home_postal.value))	

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_field(f.home_street.value, "Home Street")) 
				if(validate_field(f.home_city.value, "Home City")) 
					if(validate_field(f.home_postal.value, "Home Postal Code")) 
						if(validate_field(f.exam_date.value, "Exam Date")) 
							if(validate_field(f.location.value, "Exam Location")) 
								if(validate_home_checkboxes(f.text, f.exam)) {

	return true;
	}

	//else
		return false;
}

function validate_home_checkboxes(text, exam) {

	if (!(text.checked) && !(exam.checked)) {
		alert("Please check the Textbook and/or Exam checkboxes.");
		return false;
	}
	return true;
}


// ****************************************************************************************************************
// validate CCIB registration
// ****************************************************************************************************************
function validate_ccib(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_home_biz_addr(f.biz_street.value, f.biz_city.value, f.biz_postal.value, f.home_street.value, f.home_city.value, f.home_postal.value))	
				if(validate_radio(f.member, "My firm is a member in good standing of the Insurance Brokers Association of B.C.")) 
					if(validate_1st_course(f.first_course, f.course_year.value)) 
						if(validate_radio(f.exam, "Please select an exam type.")) 	
								if(validate_radio(f.promise, "Please answer the last question.")) {

	return true;
	}

	//else
		return false;
}


// ****************************************************************************************************************
// validate Business Interruption Insurance registration
// ****************************************************************************************************************
function validate_business(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_field(f.street.value, "Street"))
				if(validate_field(f.city.value, "City")) 
					if(validate_field(f.postal.value, "Postal Code")) { 

	return true;
	}
		return false;
}



// ****************************************************************************************************************
// validate service registration
// ****************************************************************************************************************
function validate_service(f) {

	if(validate_field(f.mentor.value, "Name of Mentor")) 
   	if(validate_field(f.mentor_phone.value, "Telephone No.")) 
     		if(validate_field(f.firstname.value, "First Name")) 
				if(validate_field(f.lastname.value, "Last Name")) 
					if(validate_home_biz_addr(f.biz_street.value, f.biz_city.value, f.biz_postal.value, f.home_street.value, f.home_city.value, f.home_postal.value))	
						if(validate_radio(f.module, "Please select a module.")) {

	return true;
	}

	//else
		return false;
}

// ****************************************************************************************************************
// validate risk management registration
// ****************************************************************************************************************
function validate_risk(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_home_biz_addr(f.biz_street.value, f.biz_city.value, f.biz_postal.value, f.home_street.value, f.home_city.value, f.home_postal.value))	
				if(validate_radio(f.cost, "Please select a package.")) {

	return true;
	}

	//else
		return false;
}


// ****************************************************************************************************************
// validate MARCS management registration
// ****************************************************************************************************************
function validate_MARCS(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_home_biz_addr(f.biz_street.value, f.biz_city.value, f.biz_postal.value, f.home_street.value, f.home_city.value, f.home_postal.value))	{

	return true;
	}

	//else
		return false;
}


// ****************************************************************************************************************
// validate Update contact form
// ****************************************************************************************************************
function validate_update(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_field(f.workphone.value, "Work Phone")) {	

	return true;
	}

	return false;
}


// ****************************************************************************************************************
// validate Ask a Broker form
// ****************************************************************************************************************
function validate_askbroker(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_field(f.email.value, "Email")) 	
				if(validate_field(f.questions.value, "Questions")) {

	return true;
	}

	return false;
}



// ****************************************************************************************************************
// validate Contact IBABC form
// ****************************************************************************************************************
function validate_contact(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) 
			if(validate_field(f.phone.value, "Telephone Number")) 
				if(validate_field(f.fax.value, "Fax Number")) 
					if(validate_field(f.email.value, "Email")) 
						if(validate_field(f.comments.value, "Comments")) {	

	return true;
	}

	return false;
}

// ****************************************************************************************************************
// validate Contact IBABC form
// ****************************************************************************************************************
function validate_glossary(f) {

	if(validate_field(f.firstname.value, "First Name")) 
		if(validate_field(f.lastname.value, "Last Name")) {

	return true;
	}

	return false;
}


// ****************************************************************************************************************
// validate add event
// ****************************************************************************************************************
function validate_addevent(f) {

	if(validate_field(f.event_name.value, "Event Name")) 
		if(validate_field(f.time.value, "Time")) 
			if(validate_field(f.street.value, "Street")) 
				if(validate_field(f.city.value, "City")) 
					if(validate_field(f.contact.value, "Contact")) 
						if(validate_field(f.registration.value, "Registration Information")) {

	return true;
	}

	//else
		return false;
}


//-->