<!--
//************************************************************************
// Function    : MM_openBrWindow -- by Macromedia
// Description : Opens a new browser window.
// Example: <a href="#" onClick="MM_openBrWindow('url_to_display',
//          'windowname','toolbar=yes,location=yes,status=yes,menubar=yes,
//          scrollbars=yes,resizable=yes,width=500,height=250')">LINK</a>
//************************************************************************
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//************************************************************************
// Function    : openWeather_e
// Description : Opens a new browser window.
//************************************************************************
function openWeather_e(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/Weather/index_e.asp', 'weather','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=670,height=430');

}

//************************************************************************
// Function    : openWeather_f
// Description : Opens a new browser window.
//************************************************************************
function openWeather_f(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/Weather/index_f.asp', 'weather','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=670,height=430');

}

//************************************************************************
// Function    : openWeatherIcon_e
// Description : Opens a new browser window.
//************************************************************************
function openWeatherIcon_e(object) {

  		MM_openBrWindow('/goto.asp?clk=/icon/&url=/tools/Weather/index_e.asp', 'weather','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=670,height=430');

}

//************************************************************************
// Function    : openWeatherIcon_f
// Description : Opens a new browser window.
//************************************************************************
function openWeatherIcon_f(object) {

  		MM_openBrWindow('/goto.asp?clk=/icon/&url=/tools/Weather/index_f.asp', 'weather','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=670,height=430');

}

//************************************************************************
// Function    : openCommodity_e
// Description : Opens a new browser window.
//************************************************************************
function openCommodity_e(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/CommodityPrices/commodity_prices_e.asp','commodity_prices','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=475');

}

//************************************************************************
// Function    : openCommodity_f
// Description : Opens a new browser window.
//************************************************************************
function openCommodity_f(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/CommodityPrices/commodity_prices_f.asp','commodity_prices','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=475');

}

//************************************************************************
// Function    : openRegTutorial_e
// Description : Opens a new browser window.
//************************************************************************
function RegTutorial_e(object) {

  		MM_openBrWindow('/tools/Tutorials/Registration/start_e.asp','registration','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=550');

}

//************************************************************************
// Function    : openRegTutorial_f
// Description : Opens a new browser window.
//************************************************************************
function openRegTutorial_f(object) {

  		MM_openBrWindow('/tools/Tutorials/Registration/start_f.asp','registration','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=550');

}

//************************************************************************
// Function    : openLoanCalc_e
// Description : Opens a new browser window.
//************************************************************************
function openLoanCalc_e(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/LoanCalculator/loancalc_e.asp', 'loanCalc','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=357');

}

//************************************************************************
// Function    : openLoanCalc_f
// Description : Opens a new browser window.
//************************************************************************
function openLoanCalc_f(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/LoanCalculator/loancalc_f.asp', 'loanCalc','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=357');

}


//************************************************************************
// Function    : openMortgageCalc_e
// Description : Opens a new browser window.
//************************************************************************
function openMortgageCalc_e(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/MortgageCalculator/mortcalc_e.asp', 'mortCalc','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=357');

}

//************************************************************************
// Function    : openMortgageCalc_f
// Description : Opens a new browser window.
//************************************************************************
function openMortgageCalc_f(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/MortgageCalculator/mortcalc_f.asp', 'mortCalc','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=400');

}


//************************************************************************
// Function    : openFarmFinanceKit_e
// Description : Opens a new browser window.
//************************************************************************
function openFarmFinanceKit_e(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/FarmFinanceKit/farmfinancekit_e.asp', 'finance_kit','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=595');

}

//************************************************************************
// Function    : openFarmFinanceKit_f
// Description : Opens a new browser window.
//************************************************************************
function openFarmFinanceKit_f(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/FarmFinanceKit/farmfinancekit_f.asp', 'finance_kit','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=595');

}


//************************************************************************
// Function    : openFinancialGlossary_e
// Description : Opens a new browser window.
//************************************************************************
function openFinancialGlossary_e(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/FinancialGlossary/financialglossary_e.asp', 'financialglossary','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=357');

}

//************************************************************************
// Function    : openFinancialGlossary_f
// Description : Opens a new browser window.
//************************************************************************
function openFinancialGlossary_f(object) {

  		MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/FinancialGlossary/financialglossary_f.asp', 'financialglossary','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=543,height=357');

}


//************************************************************************
// Function    : openLanguages_e
// Description : Opens a new browser window.
//************************************************************************
function openLanguages_e(object) {

  		MM_openBrWindow('/en/languages_e.asp', 'languages','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}

//************************************************************************
// Function    : openLanguages_f
// Description : Opens a new browser window.
//************************************************************************
function openLanguages_f(object) {

  		MM_openBrWindow('/fr/languages_f.asp', 'languages','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}

//************************************************************************
// Function    : openSecurity_e
// Description : Opens a new browser window.
//************************************************************************
function openSecurity_e(object) {

  		MM_openBrWindow('/en/security_e.asp', 'security','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}

//************************************************************************
// Function    : openSecurity_f
// Description : Opens a new browser window.
//************************************************************************
function openSecurity_f(object) {

  		MM_openBrWindow('/fr/security_f.asp', 'security','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}


//************************************************************************
// Function    : openPrivacy_e
// Description : Opens a new browser window.
//************************************************************************
function openPrivacy_e(object) {

  		MM_openBrWindow('http://www.fcc-fac.ca/en/privacy_e.asp', 'privacy','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}

//************************************************************************
// Function    : openPrivacy_f
// Description : Opens a new browser window.
//************************************************************************
function openPrivacy_f(object) {

  		MM_openBrWindow('http://www.fcc-fac.ca/fr/privacy_f.asp', 'privacy','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}


//************************************************************************
// Function    : openLegalAgreement_e
// Description : Opens a new browser window.
//************************************************************************
function openLegalAgreement_e(object) {

  		MM_openBrWindow('/en/legal_agreement_e.asp', 'legal_agreement','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}

//************************************************************************
// Function    : openLegalAgreement_f
// Description : Opens a new browser window.
//************************************************************************
function openLegalAgreement_f(object) {

  		MM_openBrWindow('/fr/legal_agreement_f.asp', 'legal_agreement','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=525,height=357');

}

//************************************************************************
// Function    : openSubscribe_e
// Description : Opens a new browser window.
//************************************************************************
function openSubscribe_e(object) {

  		MM_openBrWindow('/en/agnews/agrisuccess/Newsletter_Sign_Up_Form_e.html', 'subscribe','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=500');

}

//************************************************************************
// Function    : openSubscribe_f
// Description : Opens a new browser window.
//************************************************************************
function openSubscribe_f(object) {

  		MM_openBrWindow('/fr/agnews/agrisuccess/Newsletter_Sign_Up_Form_f.html', 'subscribe','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600');

}


//************************************************************************
// Function    : openCFM_e
// Description : Opens a new browser window.
//************************************************************************
function openCFM_e(object) {

  		MM_openBrWindow('http://www.fcc-fac.ca/cfm/en/faq/sign_up_intro_e.asp', 'cfm','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');

}

//************************************************************************
// Function    : openCFM_f
// Description : Opens a new browser window.
//************************************************************************
function openCFM_f(object) {

  		MM_openBrWindow('http://www.fac-fcc.ca/cfm/fr/faq/sign_up_intro_f.asp', 'cfm','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');

}


//************************************************************************
// Function    : validateSearch
// Description : Checks to see if Search textbox is empty.
//************************************************************************
function validateSearch(q, strLang) {
	if (strLang == "E") {
		strMsg = "Please enter a search word.";
	}
	else {
		strMsg = "Veuillez entrer un mot de recherche.";
	}
	if (q == "") {
	  alert(strMsg);
	  return false;
	}
	return true;
}


//************************************************************************
// Function    : lib_isValidPhoneNumberFormat
// Description : Checks to see if a valid phone number format was entered.
//************************************************************************

function lib_isValidPhoneNumberFormat(object) {
	//Search for alpha's..if there are letters..throw away
	//Strip any other symbols such as commas or brackets
	//Check for 10 digits
	//reformat
	object.value = lib_TrimStart(object);
	var nonFormattedString= object.value;
	var formattedString="";
	//remove any non digits.
	var alpha=/[a-zA-Z]/;
	var reg=/\D/gi;
	var special=/[^0-9\#\-\(\)\s\,]/;
	if(nonFormattedString.search(special)!= -1) {
		return false;
	}
	formattedString=nonFormattedString.replace(reg, "");
	//check to see if 10 digits are there (including area code)
	if(formattedString.length != 10) {
		return false;
	}
	//process and change format
	formattedString="("
				+formattedString.charAt(0)
				+formattedString.charAt(1)
				+formattedString.charAt(2)
				+")"
				+formattedString.charAt(3)
				+formattedString.charAt(4)
				+formattedString.charAt(5)
				+"-"
				+formattedString.charAt(6)
				+formattedString.charAt(7)
				+formattedString.charAt(8)
				+formattedString.charAt(9);
	object.value=formattedString;
	return true;
}

//************************************************************************
// Function    : lib_isValidEmailAddress
// Description : Checks to see if object value is of a valid e-mail format.
//************************************************************************
function lib_isValidEmailAddress(object) {
	var email=object.value;
	var reg=/[0-9a-zA-Z\.\_\-]+\@[0-9a-zA-Z\._\-]+\.[0-9a-zA-Z\._\-]+/;

	if(email.search(reg)== -1) {
		return false;
	}
	return true;
}

//************************************************************************
// Function    : lib_TrimStart()
// Description : Trims off all whites spaces at the beginning
//************************************************************************
function lib_TrimStart(object) {

	reg = /\s+/;
	reg1 = /\s+$/;
	var theString = object.value;
	if(theString.charAt(0) == " ") {
		theString = theString.replace(reg,"");
	}
	theString = theString.replace(reg1,"");
	return theString;
}

//************************************************************************
// Function    : lib_TrimAll()
// Description : Trims off all whites spaces
//************************************************************************
function lib_TrimAll(object) {

	reg = /\s+/gi;
	var theString = object.value;
	theString = theString.replace(reg,"");
	return theString;
}

//************************************************************************
// Function    : lib_isRadioChecked
// Description : Checks to see if a radio buttons has been selected.
//************************************************************************

function lib_isRadioChecked(object) {
	var i=0;
	for(i=0;i<object.length;i++) {
   	if(object[i].checked==true) {
   		return true;
   	}
   }
   return false;
}


//************************************************************************
// Function    : openWindow
// Description : Open a new browser window based on URL and size
//************************************************************************
function openWindow(URL, x, y) {
  if (x == null) {
    x = 600;
  }
  if (y == null) {
    y = 450;
  }

  var params = "width=" + x + ",height=" + y + ",scrollbars=yes,resizable=yes,top=30,left=10,scrollX=0,scrollY=0";
  myWindow=window.open(URL, "picWindow",  params );
  setTimeout("myWindow.focus()", 500);
}


//************************************************************************
// Function    : lib_isValidPostalCode
// Description : Checks to see if object value a valid postalcode
//************************************************************************
function lib_isValidPostalCode(object) {
	if(object.value=="") {
		return false;
	}
	if(object.value.length < 6){
		return false;
	}
	object.value = lib_TrimStart(object);
	postalCode=object.value;
	var reg=/[^0-9a-zA-Z]/;
	var num=/[^0-9]/;
	var alpha=/[^a-zA-Z]/;
	var space=/[\ ]/gi;
	postalCode = postalCode.replace(space,"");
	//if(object.value.length != 6){
		//return false;
	//}
	if(postalCode.search(reg)!= -1) {
		return false;
	}
	if(postalCode.charAt(0).search(alpha) != -1) {
		return false;
	}
	if(postalCode.charAt(1).search(num) != -1) {
		return false;
	}
	if(postalCode.charAt(2).search(alpha) != -1){
		return false;
	}
	if(postalCode.charAt(3).search(num) != -1){
		return false;
	}
	if(postalCode.charAt(4).search(alpha) != -1) {
		return false;
	}
	if(postalCode.charAt(5).search(num) != -1) {
		return false;
	}
	return true;
}


//************************************************************************
// Function    : validateForm
// Description : Validates form data on the landform.asp page.
//************************************************************************
  function validateForm(ckf, strLang) {
    if (ckf.txtFirstname.value == "") {
      if (strLang == "E") {
      	alert("You must enter your first name.");
      }
      else {
      	alert("Vous devez entrer votre prénom.");
      }
      ckf.txtFirstname.focus();
      return false;
    }
    if (ckf.txtlastname.value == "") {
      if (strLang == "E") {
      	alert("You must enter your last name.");
      }
      else {
      	alert("Vous devez entrer votre nom de famille.");
      }
      ckf.txtlastname.focus();
      return false;
    }
    if (ckf.txtphone.value == "") {
      if (strLang == "E") {
      	alert("You must enter your phone number.");
      }
      else {
      	alert("Vous devez entrer votre numéro de téléphone.");
      }
      ckf.txtphone.focus();
      return false;
    }

    if (!lib_isValidPhoneNumberFormat(ckf.txtphone)) {
      if (strLang == "E") {
      	alert("Please enter a valid phone number.");
      }
      else {
      	alert("Veuillez saisir un numéro de téléphone valide.");
      }
      ckf.txtphone.focus();
      return false;
    }

    if (ckf.txtemail.value == "") {
      if (strLang == "E") {
      	alert("You must enter your e-mail address.");
      }
      else {
      	alert("Vous devez saisir votre adresse électronique.");
      }
      ckf.txtemail.focus();
      return false;
    }

    if (!lib_isValidEmailAddress(ckf.txtemail)){
      if (strLang == "E") {
      	alert("Please enter a valid email address.");
      }
      else {
      	alert("Veuillez saisir une adresse électronique valide.");
      }
      ckf.txtemail.focus();
      return false;
    }

  	return true;
  }


//************************************************************************
// Function    : validateApplyNowForm
// Description : Validates form data on the Apply Now page.
//************************************************************************
function validateApplyNowForm(form, strLang) {
	if(form.txtFirstName.value=="") {
		if (strLang == "E") {
			alert("Please enter your first name.");
		}
		else {
			alert("Veuillez inscrire votre prénom(s).");
		}
		form.txtFirstName.focus();
		return false;
	}

	if(form.txtSurname.value=="") {
		if (strLang == "E") {
			alert("Please enter your last name.");
		}
		else {
			alert("Veuillez inscrire votre nom de famille.");
		}
		form.txtSurname.focus();
		return false;
	}


	if(!lib_isRadioChecked(form.radSalutation)) {
		if (strLang == "E") {
			alert("Please select a salutation.");
		}
		else {
			alert("Sélectionnez une des options 'Salutation'.");
		}
		form.radSalutation[0].focus();
		return false;
	}

	if(form.radSalutation[3].checked==true && form.OtherSal.value=="") {
		if (strLang == "E") {
			alert("Please enter a salutation");
		}
		else {
			alert("Veuillez une salutation.");
		}
		form.OtherSal.focus();
		return false;
	}


	if(form.txtAddress.value=="") {
		if (strLang == "E") {
			alert("Please enter your address.");
		}
		else {
			alert("Tapez une valeur pour le champ 'Addresse'.");
		}
		form.txtAddress.focus();
		return false;
	}


	if(form.txtCityTown.value=="") {
		if (strLang == "E") {
			alert("Please enter your City or Town.");
		}
		else {
			alert("Tapez une valeur pour le champ 'Ville'.");
		}
		form.txtCityTown.focus();
		return false;
	}


	if(!lib_isValidPostalCode(form.txtPostal_Code)) {
		if (strLang == "E") {
			alert("Please enter a valid postal code.");
		}
		else {
			alert("Veuillez inscrire une code postal valide.");
		}
		form.txtPostal_Code.focus();
		return false;
	}


	if(form.txtTelephone.value=="") {
		if (strLang == "E") {
			alert("Please enter your phone number.");
		}
		else {
			alert("Veuillez inscrire votre téléphone.");
		}
		form.txtTelephone.focus();
		return false;
	}


	if(!lib_isValidPhoneNumberFormat(form.txtTelephone)) {
		if (strLang == "E") {
			alert("Please enter a valid phone number.");
		}
		else {
			alert("Veuillez inscrire une téléphone valide.");
		}
		form.txtTelephone.focus();
		return false;
	}

	if(form.txtFax.value!="") {
		if(!lib_isValidPhoneNumberFormat(form.txtFax)) {
			if (strLang == "E") {
				alert("Please enter a valid fax number.");
			}
			else {
				alert("Veuillez inscrire une télécopier valide.");
			}
			form.txtFax.focus();
			return false;
		}
	}

	if(form.txtEmail.value!=""){
		if(!lib_isValidEmailAddress(form.txtEmail)) {
			if (strLang == "E") {
				alert("Please enter a valid email address.");
			}
			else {
				alert("Veuillez inscrire une adresse électronique valide.");
			}
			form.txtEmail.focus();
			return false;
		}
	}

	if(!lib_isRadioChecked(form.radCanadianCitizen)) {
		if (strLang == "E") {
			alert("Please indicate if you are a Canadian Citizen or permanent resident.");
		}
		else {
			alert("Sélectionnez une des options 'Citoyen canadien ou résident permanent'.");
		}
		form.radCanadianCitizen[0].focus();
		return false;
	}

	return true;
}

//************************************************************************
// Function    : validateJournalForm
// Description : Validates form data on the AgriSuccess Journal subscribe page.
//************************************************************************
function validateJournalForm(form, strLang) {
	if (form.firstname.value == "") {
		if (strLang == "E")
			alert("You must provide your first name to continue.");
		else
			alert("Vous devez fournir votre prénom pour continuer.");

		form.firstname.focus();
		return false;
	}

	if (form.lastname.value == "") {
		if (strLang == "E")
			alert("You must provide your last name to continue.");
		else
			alert("Vous devez fournir votre nom de famille pour continuer.");

		form.lastname.focus();
		return false;
	}

	if (form.address.value == "") {
		if (strLang == "E")
			alert("You must provide a mailing address to continue.");
		else
			alert("Vous devez fournir une adresse postale pour continuer.");

		form.address.focus();
		return false;
	}

	if (form.city.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your city or hometown to continue.");
		else
			alert("Vous devez fournir le nom de votre ville ou village pour continuer.");

		form.city.focus();
		return false;
	}

	if (form.postalcode.value == "") {
		if (strLang == "E")
			alert("You must provide a postal code to continue.");
		else
			alert("Vous devez fournir votre code postal pour continuer.");

		form.postalcode.focus();
		return false;
	}

	if (!form.language[0].checked/*English*/ && !form.language[1].checked/*French*/) {
		if (strLang == "E")
			alert("Please select the official language in which you prefer to communicate.");
		else
			alert("Veuillez choisir la langue officielle dans laquelle vous préférez communiquer.");

		form.language[0].focus();
		return false;
	}

    /** regex that matches email address */
    var re = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    // If we choose to subscribe to the Express, make sure we have a valid
    // email address
	if (form.weekly[0].checked/*Yes*/) {
        if (!re.test(form.email.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.email.focus();
            return false;

        }
	}
    // Also, if we have any value in the email field, make sure it's a valid
    // email address
    else if (form.email.value != "") {
        if (!re.test(form.email.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.email.focus();
            return false;

        }
    }

	return true;
}


//************************************************************************
// Function    : VerifyData
// Description : Validates form data on CanadianFarmersMarket.com contest
//               and recipe subscribe page.
//************************************************************************
function VerifyData(form, strLang) {
	if (form.name.value == "") {
		if (strLang == "E")
			alert("You must provide your name to continue.");
		else
			alert("Vous devez fournir votre nom pour continuer.");

		form.name.focus();
		return false;
	}

	if (form.address1.value == "") {
		if (strLang == "E")
			alert("You must provide a mailing address to continue.");
		else
			alert("Vous devez fournir une adresse postale pour continuer.");

		form.address1.focus();
		return false;
	}

	if (form.city.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your city or hometown to continue.");
		else
			alert("Vous devez fournir le nom de votre ville ou village pour continuer.");

		form.city.focus();
		return false;
	}

	if (form.province.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your province to continue.");
		else
			alert("Vous devez fournir le nom de votre province pour continuer.");

		form.province.focus();
		return false;
	}

	if (form.postalcode1.value == "") {
		if (strLang == "E")
			alert("You must provide a postal code to continue.");
		else
			alert("Vous devez fournir votre code postal pour continuer.");

		form.postalcode1.focus();
		return false;
	}


    /** regex that matches email address */
    var re = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    // If we choose to subscribe to the Express, make sure we have a valid
    // email address

        if (!re.test(form.email.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.email.focus();
            return false;

        }

    // Also, if we have any value in the email field, make sure it's a valid
    // email address
    else if (form.email.value != "") {
        if (!re.test(form.email.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.email.focus();
            return false;

        }
    }

	if (form.verifyemail.value == "") {
		if (strLang == "E")
			alert("You must provide a valid e-mail to continue.");
		else
			alert("Vous devez fournir une adresse courriel valide.");

		form.verifyemail.focus();
		return false;
	}

	if (form.email.value != form.verifyemail.value) {
		if (strLang == "E")
			alert("Your e-mail address does not match.");
		else
			alert("Votre adresse électronique votre pas allumette.");

		form.email.focus();
		return false;
	}

	if (form.daynumber1.value == "") {
		if (strLang == "E")
			alert("You must provide a daytime telephone to continue.");
		else
			alert("Vous devez fournir votre numéro de téléphone pour continuer.");

		form.daynumber1.focus();
		return false;
	}

	if (form.eveningnumber1.value == "") {
		if (strLang == "E")
			alert("You must provide an evening telephone to continue.");
		else
			alert("Vous devez fournir votre numéro de téléphone pour continuer.");

		form.eveningnumber1.focus();
		return false;
	}

	return true;
}


//************************************************************************
// Function    : CFMSignUpForm
// Description : Validates form data on CanadianFarmersMarket.com
//               sign up form.
//************************************************************************
function CFMSignUpForm(form, strLang)
{
  // set var radio_choice[n] to false
  var radio_choice1 = false;
  var radio_choice2 = false;
  var radio_choice3 = false;
  var radio_choice4 = false;
  var radio_choice5 = false;
  var radio_choice6 = false;

//QUESTION 1
    // Loop from zero to the one minus the number of radio button selections
    for (counter = 0; counter < form.txt_Q1.length; counter++)
     {
      // If a radio button has been selected it will return true
      // (If not it will return false)
        if (form.txt_Q1[counter].checked)
        radio_choice1 = true;
     }

     if (!radio_choice1)
      {
	  if (strLang == "E")
       // If there were no selections made display an alert box
       alert('You must provide a value for Question 1.');
	  else
	      alert("Vous n'avez pas répondu aux questions suivantes : Question 1.");

       return (false);
      }


//QUESTION 2
	if(form.txt_Q2.value == "" )
	{
	     if (strLang == "E")
		     alert('You must provide a value for Question 2.');
		 else
		     alert("Vous n'avez pas répondu aux questions suivantes : Question 2.");

		form.txt_Q2.focus();
		return (false);
	}


//QUESTION 3
	if( form.txt_Q3.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for Question 3.');
		else
		    alert("Vous n'avez pas répondu aux questions suivantes : Question 3.");

		form.txt_Q3.focus();
		return (false);
	}

//QUESTION 4
	if(form.txt_Q4.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for Question 4.');
		else
		    alert("Vous n'avez pas répondu aux questions suivantes : Question 4.");

		form.txt_Q4.focus();
		return (false);
	}

//QUESTION 5
	if(form.txt_Q5.value == "" )
	{
	    if (strLang == "E")
		     alert('You must provide a value for Question 5.');
	    else
		    alert("Vous n'avez pas répondu aux questions suivantes : Question 5.");

		form.txt_Q5.focus();
		return (false);
	}


//QUESTION 6
	if(form.txt_Q6.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for Question 6.');
		else
		    alert("Vous n'avez pas répondu aux questions suivantes : Question 6.");

		form.txt_Q6.focus();
		return (false);
	}


//QUESTION 7
	// Loop from zero to the one minus the number of radio button selections
    for (counter = 0; counter < form.txt_Q7.length; counter++)
     {
      // If a radio button has been selected it will return true
      // (If not it will return false)
        if (form.txt_Q7[counter].checked)
        radio_choice2 = true;
     }

     if (!radio_choice2)
      {
       // If there were no selections made display an alert box
	   if (strLang == "E")
           alert('You must provide a value for Question 7.');
	   else
	       alert("Vous n'avez pas répondu aux questions suivantes : Question 7.");

       return (false);
      }


//QUESTION 8
	if(form.txt_Q8.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for Question 8.');
		else
		    alert("Vous n'avez pas répondu aux questions suivantes : Question 8.");

		form.txt_Q8.focus();
		return (false);
	}





//QUESTION 10
	// Loop from zero to the one minus the number of radio button selections
    for (counter = 0; counter < form.txt_Q10.length; counter++)
     {
        // If a radio button has been selected it will return true
        // (If not it will return false)
        if (form.txt_Q10[counter].checked)
            radio_choice3 = true;
     }

     if (!radio_choice3)
      {
       // If there were no selections made display an alert box
       if (strLang == "E")
	       alert('You must provide a value for Question 10.');
	   else
	       alert("Vous n'avez pas répondu aux questions suivantes : Question 10.");

       return (false);
      }

//QUESTION 11
	if( form.txt_Q11.value == "" )
	{
		if (strLang == "E")
		    alert('You must provide a value for Question 11.');
		else
		    alert("Vous n'avez pas répondu aux questions suivantes : Question 11.");

		form.txt_Q11.focus();
		return (false);
	}
    
    //QUESTION 12 NAME
	if(form.txt_Q12_Name.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for your Name.');
		else
		    alert('Veuillez inscrire le Nom.');

		form.txt_Q12_Name.focus();
		return (false);
	}


//QUESTION 12 COMPANY
	if(form.txt_Q12_Company.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for your Company name.');
		else
		    alert("Veuillez inscrire le Nom de l'entreprise.");

		form.txt_Q12_Company.focus();
		return (false);
	}


//QUESTION 12 PHONE
	if(form.txt_Q12_Phone.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for Phone number.');
		else
		    alert('Veuillez inscrire le Numéro de telephone.');

		form.txt_Q12_Phone.focus();
		return (false);
	}


//QUESTION 12 ADDRESS
	if(form.txt_Q12_Address.value == "" )
	{
	    if (strLang == "E")
		    alert('You must provide a value for Address.');
		else
		    alert("Veuillez inscrire l'Adresse.");

		form.txt_Q12_Address.focus();
		return (false);
	}


//QUESTION 12 PROVINCE
	if(form.txt_Q12_Province.value == "" )
	{
		if (strLang == "E")
		    alert('You must provide a value for Province.');
		else
		    alert('Veuillez inscrire le Province.');

		form.txt_Q12_Province.focus();
		return (false);
	}


//QUESTION 12 POSTAL CODE
	if(form.txt_Q12_PostalCode.value == "" )
	{
		if (strLang == "E")
			alert('You must provide a value for Postal Code.');
		else
		    alert('Veuillez inscrire le Code postal.');

		form.txt_Q12_PostalCode.focus();
		return (false);
	}

//QUESTION 12 E-MAIL
	if(form.txt_Q12_Email.value.length != 0 )
	{
		var emailValue = form.txt_Q12_Email.value;
		if( ( emailValue.indexOf( '@' ) <= 0 ) || ( emailValue.indexOf( '.', emailValue.indexOf( '@' ) ) <= 0 ) )
	{
			if (strLang == "E")
			    alert('You must provide a valid E-mail address.');
			else
			    alert('Veuillez inscrire le Courriel.');

			form.txt_Q12_Email.focus();
			return (false);
		}
	}

	if(form.txt_Q12_Email.value == "" )
	{
		if (strLang == "E")
		    alert('You must provide a value for E-mail address.');
		else
		    alert('Veuillez inscrire le Courriel.');

		form.txt_Q12_Email.focus();
		return (false);
	}


//QUESTION 12 FAX
	if(form.txt_Q12_Fax.value == "" )
	{
		if (strLang == "E")
		    alert('You must provide a value for Fax number.');
		else
		    alert('Veuillez inscrire le Numéro de télécopieur.');

		form.txt_Q12_Fax.focus();
		return (false);
	}

//QUESTION 12
	// Loop from zero to the one minus the number of radio button selections
    for (counter = 0; counter < form.txt_Q12.length; counter++)
     {
      // If a radio button has been selected it will return true
      // (If not it will return false)
        if (form.txt_Q12[counter].checked)
        radio_choice4 = true;
     }

     if (!radio_choice4)
      {
       // If there were no selections made display an alert box
       if (strLang == "E")
	       alert('You must provide a value for Question 12.');
       else
	       alert("Vous n'avez pas répondu aux questions suivantes : Question 12.");

	   return (false);
      }


//QUESTION 13
	// Loop from zero to the one minus the number of radio button selections
    for (counter = 0; counter < form.txt_Q13.length; counter++)
     {
      // If a radio button has been selected it will return true
      // (If not it will return false)
        if (form.txt_Q13[counter].checked)
        radio_choice5 = true;
     }

     if (!radio_choice5)
      {
       // If there were no selections made display an alert box
       if (strLang == "E")
	       alert('You must provide a value for Question 13.');
       else
	       alert("Vous n'avez pas répondu aux questions suivantes : Question 13.");

	   return (false);
      }

return true;

}


//************************************************************************
// Function    : frmAg101Essay
// Description : Validates form data on Ag101 essay page.
//************************************************************************
function frmAg101Essay(form, strLang) {
	if (form.studentname.value == "") {
		if (strLang == "E")
			alert("You must provide your student name to continue.");
		else
			alert("Vous devez fournir votre nom de l'étudiant(e) pour continuer.");

		form.studentname.focus();
		return false;
	}

	if (form.university.value == "") {
		if (strLang == "E")
			alert("You must provide your university to continue.");
		else
			alert("Vous devez fournir votre université ou collège pour continuer.");

		form.university.focus();
		return false;
	}

	if (form.program.value == "") {
		if (strLang == "E")
			alert("You must provide your program to continue.");
		else
			alert("Vous devez fournir votre programme pour continuer.");

		form.program.focus();
		return false;
	}

	if (form.programyear.value == "") {
		if (strLang == "E")
			alert("You must provide your program year to continue.");
		else
			alert("Vous devez fournir votre à quel cycle de votre programme êtes-vous rendu(e) pour continuer.");

		form.programyear.focus();
		return false;
	}

	if (form.address.value == "") {
		if (strLang == "E")
			alert("You must provide a mailing address to continue.");
		else
			alert("Vous devez fournir une adresse pour continuer.");

		form.address.focus();
		return false;
	}

	if (form.city.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your city or hometown to continue.");
		else
			alert("Vous devez fournir le nom de votre ville ou village pour continuer.");

		form.city.focus();
		return false;
	}

	if (form.province.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your province to continue.");
		else
			alert("Vous devez fournir le nom de votre province pour continuer.");

		form.province.focus();
		return false;
	}

	if (form.postalcode1.value == "") {
		if (strLang == "E")
			alert("You must provide a postal code to continue.");
		else
			alert("Vous devez fournir votre code postal pour continuer.");

		form.postalcode1.focus();
		return false;
	}

	if (form.phonenumber1.value == "") {
		if (strLang == "E")
			alert("You must provide your telephone to continue.");
		else
			alert("Vous devez fournir votre téléphone pour continuer.");

		form.phonenumber1.focus();
		return false;
	}


    /** regex that matches email address */
    var re = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    // If we choose to subscribe to the Express, make sure we have a valid
    // email address

        if (!re.test(form.emailaddress.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.emailaddress.focus();
            return false;

        }

    // Also, if we have any value in the email field, make sure it's a valid
    // email address
    else if (form.emailaddress.value != "") {
        if (!re.test(form.emailaddress.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.emailaddress.focus();
            return false;

        }
    }

	if (form.essay.value == "") {
		if (strLang == "E")
			alert("You must provide your essay to continue.");
		else
			alert("Vous devez fournir votre essai pour continuer.");

		form.essay.focus();
		return false;
	}

	if (form.referencename1.value == "") {
		if (strLang == "E")
			alert("You must provide your name to continue.");
		else
			alert("Vous devez fournir votre nom pour continuer.");

		form.referencename1.focus();
		return false;
	}

	if (form.referencedepartment1.value == "") {
		if (strLang == "E")
			alert("You must provide your department to continue.");
		else
			alert("Vous devez fournir votre département pour continuer.");

		form.referencedepartment1.focus();
		return false;
	}

	if (form.referencenumber11.value == "") {
		if (strLang == "E")
			alert("You must provide your telephone to continue.");
		else
			alert("Vous devez fournir votre téléphone pour continuer.");

		form.referencenumber11.focus();
		return false;
	}

	// make sure we have a valid email address

        if (!re.test(form.referenceemail1.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.referenceemail1.focus();
            return false;

        }

    // Also, if we have any value in the email field, make sure it's a valid
    // email address
    else if (form.referenceemail1.value != "") {
        if (!re.test(form.referenceemail1.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.referenceemail1.focus();
            return false;

        }
    }

		if (form.referencename2.value == "") {
		if (strLang == "E")
			alert("You must provide your name to continue.");
		else
			alert("Vous devez fournir votre nom pour continuer.");

		form.referencename2.focus();
		return false;
	}

	if (form.referencedepartment2.value == "") {
		if (strLang == "E")
			alert("You must provide your department to continue.");
		else
			alert("Vous devez fournir votre département pour continuer.");

		form.referencedepartment2.focus();
		return false;
	}

	if (form.referencenumber21.value == "") {
		if (strLang == "E")
			alert("You must provide your telephone to continue.");
		else
			alert("Vous devez fournir votre téléphone pour continuer.");

		form.referencenumber21.focus();
		return false;
	}

	// make sure we have a valid email address

        if (!re.test(form.referenceemail2.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.referenceemail2.focus();
            return false;

        }

    // Also, if we have any value in the email field, make sure it's a valid
    // email address
    else if (form.referenceemail2.value != "") {
        if (!re.test(form.referenceemail2.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.referenceemail2.focus();
            return false;

        }
    }

	return true;
}


//************************************************************************
// Function    : RecipeVerifyData
// Description : Validates form data on CanadianFarmersMarket.com contest
//               and recipe subscribe page.
//************************************************************************
function RecipeVerifyData(form, strLang) {
	if (form.firstname.value == "") {
		if (strLang == "E")
			alert("You must provide your  first name to continue.");
		else
			alert("Vous devez fournir votre nom pour continuer.");

		form.firstname.focus();
		return false;
	}

	if (form.lastname.value == "") {
		if (strLang == "E")
			alert("You must provide your last name to continue.");
		else
			alert("Vous devez fournir votre nom pour continuer.");

		form.lastname.focus();
		return false;
	}



	if (form.city.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your city or hometown to continue.");
		else
			alert("Vous devez fournir le nom de votre ville ou village pour continuer.");

		form.city.focus();
		return false;
	}

	if (form.province.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your province to continue.");
		else
			alert("Vous devez fournir le nom de votre province pour continuer.");

		form.province.focus();
		return false;
	}


    /** regex that matches email address */
    var re = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    // If we choose to subscribe to the Express, make sure we have a valid
    // email address

        if (!re.test(form.email.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.email.focus();
            return false;

        }

    // Also, if we have any value in the email field, make sure it's a valid
    // email address
    else if (form.email.value != "") {
        if (!re.test(form.email.value)) {
            if (strLang == "E")
                alert("You must provide a valid e-mail address.");
            else
                alert("Vous devez fournir une adresse courriel valide.");

            form.email.focus();
            return false;

        }
    }

	if (form.recipe.value == "") {
		if (strLang == "E")
			alert("You must provide the name of your recipe to continue.");
		else
			alert("Vous devez fournir le nom de votre recette pour continuer.");

		form.recipe.focus();
		return false;
	}




	return true;
}
//-->
