<!--
//************************************************************************
// 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    : openLeaseCalc_e
// Description : Opens a new browser window.
//************************************************************************
function openLeaseCalc_e(object) {

          MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/LeaseCalculator/leasecalc_e.asp', 'leaseCalc','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=570,height=500');

}

//************************************************************************
// Function    : openLeaseCalc_f
// Description : Opens a new browser window.
//************************************************************************
function openLeaseCalc_f(object) {

          MM_openBrWindow('/goto.asp?clk=/tool/&url=/tools/LeaseCalculator/leasecalc_f.asp', 'leaseCalc','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650,height=550');

}

//************************************************************************
// 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=645,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('/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('/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('https://secure.campaigner.com/Campaigner/Public/Form10.aspx?fid=91300', 'subscribe','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=480,height=500');

}

//************************************************************************
// Function    : openSubscribe_f
// Description : Opens a new browser window.
//************************************************************************
function openSubscribe_f(object) {

          MM_openBrWindow('https://secure.campaigner.com/Campaigner/Public/Form10.aspx?fid=91450', 'subscribe','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=580,height=500');

}

//************************************************************************
// Function    : openJournalSubscribe_e
// Description : Opens a new browser window.
//************************************************************************
function openJournalSubscribe_e(object) {
    MM_openBrWindow('http://secure.campaigner.com/Campaigner/Public/Form10.aspx?fid=99530', 'subscribe','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=480,height=500');
}

//************************************************************************
// Function    : openJournalSubscribe_f
// Description : Opens a new browser window.
//************************************************************************
function openJournalSubscribe_f(object) {
    MM_openBrWindow('http://secure.campaigner.com/Campaigner/Public/Form10.aspx?fid=106065', 'subscribe','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=580,height=500');
}

//************************************************************************
// Function    : openCFM_e
// Description : Opens a new browser window.
//************************************************************************
function openCFM_e(object) {

          MM_openBrWindow('http://www.canadianfarmersmarket.com/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.marchedelafermecanadienne.com/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.provincestate.value == "") {
        if (strLang == "E")
            alert("Province/state is required.");
        else
            alert("Veuillez inscrire le Province/État.");

        form.provincestate.focus();
        return false;
    }

    if (form.country.value == "") {
        if (strLang == "E")
            alert("Country is required.");
        else
            alert("Veuillez inscrire la Pays.");

        form.country.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;

//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 9 NAME
    if(form.txt_Q9_Name.value == "" )
    {
        if (strLang == "E")
            alert('You must provide a value for your Name.');
        else
            alert('Veuillez inscrire le Nom.');

        form.txt_Q9_Name.focus();
        return (false);
    }


//QUESTION 9 COMPANY
    if(form.txt_Q9_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_Q9_Company.focus();
        return (false);
    }


//QUESTION 9 PHONE
    if(form.txt_Q9_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_Q9_Phone.focus();
        return (false);
    }


//QUESTION 9 ADDRESS
    if(form.txt_Q9_Address.value == "" )
    {
        if (strLang == "E")
            alert('You must provide a value for Address.');
        else
            alert("Veuillez inscrire l'Adresse.");

        form.txt_Q9_Address.focus();
        return (false);
    }


//QUESTION 9 CITY
    if(form.txt_Q9_City.value == "" )
    {
        if (strLang == "E")
            alert('You must provide a value for City.');
        else
            alert('Veuillez inscrire le Ville.');

        form.txt_Q9_City.focus();
        return (false);
    }


//QUESTION 9 PROVINCE
    if(form.txt_Q9_Province.value == "" )
    {
        if (strLang == "E")
            alert('You must provide a value for Province.');
        else
            alert('Veuillez inscrire le Province.');

        form.txt_Q9_Province.focus();
        return (false);
    }


//QUESTION 9 POSTAL CODE
    if(form.txt_Q9_PostalCode.value == "" )
    {
        if (strLang == "E")
            alert('You must provide a value for Postal Code.');
        else
            alert('Veuillez inscrire le Code postal.');

        form.txt_Q9_PostalCode.focus();
        return (false);
    }

//QUESTION 9 E-MAIL
    if(form.txt_Q9_Email.value.length != 0 )
    {
        var emailValue = form.txt_Q9_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_Q9_Email.focus();
            return (false);
        }
    }

    if(form.txt_Q9_Email.value == "" )
    {
        if (strLang == "E")
            alert('You must provide a value for E-mail address.');
        else
            alert('Veuillez inscrire le Courriel.');

        form.txt_Q9_Email.focus();
        return (false);
    }


//QUESTION 9 FAX
    if(form.txt_Q9_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_Q9_Fax.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( document.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
    // 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
    if(form.txt_Q13.value == "" )
    {
        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.");

        form.txt_Q13.focus();
        return (false);
    }


    else
     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;
}

//************************************************************************
// Function    : DisplayFuturesGraph
// Description : Display commodities futures graph on Markets page
//************************************************************************

function DisplayFuturesGraph(graphlink, name, month, year, lang)
{
    var g = document.getElementById('commodities-graph');
    var t = document.getElementById('commodities-graph-title');
    var title;

    if (lang == "E")
        title = name + ': ' + month + ' ' + year;
    else
        title = name + ' : ' + month + ' ' + year;

    g.style.display = '';
    g.src = graphlink;
    g.alt = g.title = title;

    if (t.firstChild)
        t.firstChild.nodeValue = title;
    else
    {
        var titleText = document.createTextNode(title);
        t.appendChild(titleText);
    }

    location.hash = 'commodities-graph-tag';
}



//************************************************************************
// Function    : ColourRows
// Description : Alternatingly colours rows in a table
//************************************************************************

function ColourRows(tables, c1, c2)
{
    var t;

    c1 = c1 || "#E7EAEF";
    c2 = c2 || "#f8f8f8";

    for (t = 0; t < tables.length; t++)
    {
        var rows = document.getElementById(tables[t]).getElementsByTagName("tr");
        var i;

        for (i = 0; i < rows.length; i++)
        {
            if ((i % 2) == 0)
                rows.item(i).style.backgroundColor = c1;
            else
                rows.item(i).style.backgroundColor = c2;
        }
    }
}

//************************************************************************
// Function    : TranslateFeed
// Description : Translate Ag News feed time and dates from en to fr
//************************************************************************

function TranslateFeed()
{
    var x = document.getElementById("cp-news").getElementsByTagName("span")
    var y = Array();

    var i;
    for (i = 0; i < x.length; i++)
    {
        if (x[i].className == "cp-news-timestamp")
            y.push(x[i]);
    }

    for (i = 0; i < y.length; i++)
    {
        var re_time = /^([0-9][0-9]):([0-9][0-9]).*$/
        var t = y[i].firstChild.nodeValue;

        var match = re_time.exec(t);

        if (match != null)
        {
            t = match[1] + " h " + match[2] + "   ";
        }
        else {
            t = t.replace(/ /, " ");
            t = t.replace(/ /g, "");
            t = t.split(" ");

            if (t.length != 2)
              continue

            if (t[0] == "Jan")
                t[0] = "janv.";
            if (t[0] == "Feb")
                t[0] = "févr.";
            if (t[0] == "Mar")
                t[0] = "mars";
            if (t[0] == "Apr")
                t[0] = "avr.";
            if (t[0] == "May")
                t[0] = "mai";
            if (t[0] == "Jun")
                t[0] = "juin.";
            if (t[0] == "Jul")
                t[0] = "juill.";
            if (t[0] == "Aug")
                t[0] = "août";
            if (t[0] == "Sep")
                t[0] = "sept.";
            if (t[0] == "Oct")
                t[0] = "oct.";
            if (t[0] == "Nov")
                t[0] = "nov.";
            if (t[0] == "Dec")
                t[0] = "déc.";

            t = t[1] + " " + t[0] + "   ";
        }
        y[i].firstChild.nodeValue = t;
    }
}

//************************************************************************
// Function    : validateAgStoryForm
// Description : Validates form data on the Ag Awareness story page.
//************************************************************************
function validateAgStoryForm(form, strLang) {
    if (form.fullname.value == "") {
        form.fullname.focus();
        return false;
    }

    // make sure we have a valid email address
    /** regex that matches email address */
    var re = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    if (form.email.value == "" || !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.contact.value == "") {
        form.contact.focus();
        return false;
    }

    if (form.province.value == "") {
        form.province.focus();
        return false;
    }

    if (form.permission.checked == "") {
        form.permission.focus();
        return false;
    }

    if (form.story.value == "" && form.thought.value == "") {
        form.story.focus();
        return false;
    }

    return true;
}


//************************************************************************
// Function    : validateAgPrideForm
// Description : Validates form data on the Ag Awareness pride page.
//************************************************************************
function validateAgPrideForm(form, strLang) {
    if (form.fullname.value == "") {
        form.fullname.focus();
        return false;
    }

    // make sure we have a valid email address
    /** regex that matches email address */
    var re = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    if (form.email.value == "" || !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.address.value == "") {
        form.address.focus();
        return false;
    }

    if (form.city.value == "") {
        form.city.focus();
        return false;
    }
    
    if (form.province.value == "") {
        form.province.focus();
        return false;
    }
    
    if (form.postalcode.value == "") {
        form.postalcode.focus();
        return false;
    }

    if (form.telephone.value == "") {
        form.telephone.focus();
        return false;
    }

    if (form.referrer.selectedIndex == 4) {
        if (form.referrer_other.value == "") {
            form.referrer_other.focus();
            return false;
        }
    }

    return true;
}

// Validate summer student careers form
function validateCareersForm(form, lang) {
    // make sure we have a valid email address
    /** regex that matches email address */
    var re = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    if (form.first_name.value == "") {
        form.first_name.focus();
        return false;
    }
    else if (form.last_name.value == "") {
        form.last_name.focus();
        return false;
    }
    else if (form.address.value == "") {
        form.address.focus();
        return false;
    }
    else if (form.student_yes.checked == false && form.student_no.checked == false ) {
        form.student_yes.focus();
        return false;
    }
    else if (form.institution.value == "") {
        form.institution.focus();
        return false;
    }
    else if (form.field_of_study.value == "") {
        form.field_of_study.focus();
        return false;
    }
    else if (form.semesters.value == "") {
        form.semesters.focus();
        return false;
    }
    else if (form.background.value == "") {
        form.background.focus();
        return false;
    }
    else if (form.bilingual_yes.checked == false && form.bilingual_no.checked == false ) {
        form.bilingual_yes.focus();
        return false;
    }
    else if (form.relocate_yes.checked == false && form.relocate_no.checked == false ) {
        form.relocate_yes.focus();
        return false;
    }
    else if (form.entitled_to_work_yes.checked == false && form.entitled_to_work_no.checked == false ) {
        form.entitled_to_work_yes.focus();
        return false;
    }
    else if (form.aboriginal_yes.checked == false && form.aboriginal_no.checked == false ) {
        form.aboriginal_yes.focus();
        return false;
    }
    else if (form.disabled_yes.checked == false && form.disabled_no.checked == false ) {
        form.disabled_yes.focus();
        return false;
    }
    else if (form.minority_yes.checked == false && form.minority_no.checked == false ) {
        form.minority_yes.focus();
        return false;
    }
    else if (form.resume.value == "") {
        form.resume.focus();
        return false;
    }
    else if (form.cover_letter.value == "") {
        form.cover_letter.focus();
        return false;
    }

    return true;
}
function validatenotifylaunch(form, lang) {
    // make sure we have a valid email address
    /** regex that matches email address */
	var re_email = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    if (form.first_name.value == "") {
        form.first_name.focus();
        return false;
    }
    else if (form.last_name.value == "") {
        form.last_name.focus();
        return false;
    }   
	else if (!re_email.test(form.email.value)) {
        alert(fcc_lang == "E" ? "Your email address is invalid." : "Votre adresse de courrier électronique est invalide.");
        form.email.focus();
		return false;
    }
    return true;
}

// validate Express & Journal "forward to a friend" email forms
validateArticleEmailForm = function(form) {
    var re_email = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;
    var to_emails;

    to_emails = form.to_emails.value.split(/\s*,\s*/);

    for (var i = 0; i < to_emails.length; i++) {
        if (!re_email.test(to_emails[i])) {
            alert(fcc_lang == "E" ? "One or email addresses is invalid." : "Une ou plusieurs adresses de courrier électronique sont invalides.");
            return false;
        }
    }

    if (form.from_name.value == '') {
        alert(fcc_lang == "E" ? "Enter your name" : "Veuillez indiquer votre nom.");
        return false;
    }
    else if (!re_email.test(form.from_email.value)) {
        alert(fcc_lang == "E" ? "Your email address is invalid." : "Votre adresse de courrier électronique est invalide.");
        return false;
    }
}

// validate AgriSuccess contact form
validateContactEmailForm = function(form) {
    var re_email = /^[^\s\@]+\@([\da-zA-Z-]+\.)+[\da-zA-Z-]{2,}$/;

    if (form.from_name.value == '') {
        alert(fcc_lang == "E" ? "Enter your name" : "Veuillez indiquer votre nom.");
        return false;
    }
    else if (!re_email.test(form.from_email.value)) {
        alert(fcc_lang == "E" ? "Your email address is invalid." : "Votre adresse de courrier électronique est invalide.");
        return false;
    }
    else if (form.subject.value == '') {
        alert(fcc_lang == "E" ? "Enter a subject" : "Veuillez indiquer un objet.");
        return false;
    }
    else if (form.comments.value == '') {
        alert(fcc_lang == "E" ? "Enter a comment" : "Veuillez écrire vos commentaires.");
        return false;
    }
}


// forward journal or express article
forward_article = function (url, name) {
    name = name || "";

    var params = "width=530,height=570,scrollbars=yes,resizable=yes,top=30,left=10,scrollX=0,scrollY=0";

    var w = window.open(url, name, params);
}

open_window = function (url, name, w, h) {
    name = name || "";
    w = w || 530;
    h = h || 570;

    var params = "width="+w+",height="+h+",scrollbars=yes,resizable=yes,top=30,left=10,scrollX=0,scrollY=0";

    var w = window.open(url, name, params);
}

//-->


