// JavaScript Document

// code to switch language contextually
function switchlang(encor) {

	var iamHere, thereToGo, re, match;
	var pagesList = new Object();

	re = /(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/i;	
	iamHere = window.location.href;
	match = re.exec(iamHere); // to get only the part of the url after the domain name

	thereToGo = encor.href;

	// pages definition
	
		// English to French
		
		pagesList["/en/about/"] = "/fr/apropos/";
		pagesList["/en/about/index.html"] = "/fr/apropos/index.html";
		pagesList["/en/about/contact.us.html"] = "/fr/apropos/nous.joindre.html";
		pagesList["/en/about/company.profile.html"] = "/fr/apropos/profil.entreprise.html";
		pagesList["/en/about/management.team.html"] = "/fr/apropos/dirigeants.html";
		pagesList["/en/about/new.at.mediapages.html"] = "/fr/apropos/nouvelles.communiques.html";
		pagesList["/en/about/adverts.html"] = "/fr/apropos/publicites.html";
		
		pagesList["/en/advertise/"] = "/fr/annoncez/";
		pagesList["/en/advertise/index.html"] = "/fr/annoncez/index.html";
		
		pagesList["/en/careers/"] = "/fr/carrieres/";
		pagesList["/en/careers/index.html"] = "/fr/carrieres/index.html";
		pagesList["/en/careers/working.at.qmp.html"] = "/fr/carrieres/travailler.chez.qmp.html";
		pagesList["/en/careers/apply.online.html"] = "/fr/carrieres/postuler.en.ligne.html";
		pagesList["/en/careers/advertising.advisor.business.contact.centre.html"] = "/fr/carrieres/conseiller.en.publicite.centre.contact.affaires.html";
		pagesList["/en/careers/advertising.solutions.sales.rep.html"] = "/fr/carrieres/rep.ventes.et.solutions.publicitaires.html";
		pagesList["/en/careers/product.specialist.canoe411.ca.html"] = "/fr/carrieres/specialiste.de.produits.canoe411.ca.html";
		pagesList["/en/careers/receptionist.html"] = "/fr/carrieres/receptionniste.html";
		pagesList["/en/careers/computer.graphics.designer.graphic.artist.html"] = "/fr/carrieres/infographiste.graphiste.html";
		pagesList["/en/careers/sales.support.agent.online.products.html"] = "/fr/carrieres/prepose.support.aux.ventes.produits.en.ligne.html";
		pagesList["/en/careers/customer.service.coordinator.html"] = "/fr/carrieres/coordinnateur.service.clientele.html";
		pagesList["/en/careers/flex.programmer.integrator.html"] = "/fr/carrieres/programmeur.integrateur.flex.html";
		pagesList["/en/careers/graphic.artist.html"] = "/fr/carrieres/graphiste.html";
		pagesList["/en/careers/data.verification.agent.html"] = "/fr/carrieres/commis.a.la.verification.de.donnees.html";
		pagesList["/en/careers/sales.support.agent.html"] = "/fr/carrieres/prepose.support.aux.ventes.html";
		
		pagesList["/en/products/"] = "/fr/produits/";
		pagesList["/en/products/index.html"] = "/fr/produits/index.html";
		pagesList["/en/products/regional.directories.html"] = "/fr/produits/annuaires.regionaux.html";
		pagesList["/en/products/montreal.directory.html"] = "/fr/produits/annuaire.montreal.html";
		pagesList["/en/products/quebec.directory.html"] = "/fr/produits/annuaire.quebec.html";
		pagesList["/en/products/canoe411.html"] = "/fr/produits/canoe411.html";
		
		pagesList["/en/social.responsibilities/index.html"] = "/fr/engagements.sociaux/index.html";
		pagesList["/en/social.responsibilities/environment.html"] = "/fr/engagements.sociaux/environnement.html";

		
		pagesList["/en/legal/privacy.statement.html"] = "/fr/juridique/confidentialite.html";
		pagesList["/en/legal/terms.of.use.html"] = "/fr/juridique/conditions.html";
		
	
	// French to English
	pagesList["/fr/apropos/"] = "/en/about/";
	pagesList["/fr/apropos/index.html"] = "/en/about/index.html";
	pagesList["/fr/apropos/nous.joindre.html"] = "/en/about/contact.us.html";
	pagesList["/fr/apropos/profil.entreprise.html"] = "/en/about/company.profile.html";
	pagesList["/fr/apropos/dirigeants.html"] = "/en/about/management.team.html";
	pagesList["/fr/apropos/nouvelles.communiques.html"] = "/en/about/new.at.mediapages.html";
	pagesList["/fr/apropos/publicites.html"] = "/en/about/adverts.html";
	
	pagesList["/fr/annoncez/"] = "/en/advertise/";
	pagesList["/fr/annoncez/index.html"] = "/en/advertise/index.html";
	
	pagesList["/fr/carrieres/"] = "/en/careers/";
	pagesList["/fr/carrieres/index.html"] = "/en/careers/index.html";
	pagesList["/fr/carrieres/travailler.chez.qmp.html"] = "/en/careers/working.at.qmp.html";
	pagesList["/fr/carrieres/postuler.en.ligne.html"] = "/en/careers/apply.online.html";
	pagesList["/fr/carrieres/conseiller.en.publicite.centre.contact.affaires.html"] = "/en/careers/advertising.advisor.business.contact.centre.html";
	pagesList["/fr/carrieres/rep.ventes.et.solutions.publicitaires.html"] = "/en/careers/advertising.solutions.sales.rep.html";
	pagesList["/fr/carrieres/specialiste.de.produits.canoe411.ca.html"] = "/en/careers/product.specialist.canoe411.ca.html";
	pagesList["/fr/carrieres/receptionniste.html"] = "/en/careers/receptionist.html";
    pagesList["/fr/carrieres/infographiste.graphiste.html"] = "/en/careers/computer.graphics.designer.graphic.artist.html";
    pagesList["/fr/carrieres/prepose.support.aux.ventes.produits.en.ligne.html"] = "/en/careers/sales.support.agent.online.products.html";
	pagesList["/fr/carrieres/coordinnateur.service.clientele.html"] = "/en/careers/customer.service.coordinator.html";
	pagesList["/fr/carrieres/programmeur.integrateur.flex.html"] = "/en/careers/flex.programmer.integrator.html";
	pagesList["/fr/carrieres/graphiste.html"] = "/en/careers/graphic.artist.html";
	pagesList["/fr/carrieres/commis.a.la.verification.de.donnees.html"] = "/en/careers/data.verification.agent.html";
	pagesList["/fr/carrieres/prepose.support.aux.ventes.html"] = "/en/careers/sales.support.agent.html";
	
	pagesList["/fr/engagements.sociaux/index.html"] = "/en/social.responsibilities/index.html";
	pagesList["/fr/engagements.sociaux/environnement.html"] = "/en/social.responsibilities/environment.html";

	
	pagesList["/fr/produits/"] = "/en/products/";
	pagesList["/fr/produits/index.html"] = "/en/products/index.html";
	pagesList["/fr/produits/annuaires.regionaux.html"] = "/en/products/regional.directories.html";
	pagesList["/fr/produits/annuaire.montreal.html"] = "/en/products/montreal.directory.html";
	pagesList["/fr/produits/annuaire.quebec.html"] = "/en/products/quebec.directory.html";
	pagesList["/fr/produits/canoe411.html"] = "/en/products/canoe411.html";
	
	pagesList["/fr/juridique/confidentialite.html"] = "/en/legal/privacy.statement.html";
	pagesList["/fr/juridique/conditions.html"] = "/en/legal/terms.of.use.html";
	
	
	// if there is no match go to the language home page (not language selection)
	if (pagesList[match[4]] != null) {
		thereToGo = pagesList[match[4]];
	}
	
	encor.href = thereToGo;
	
	return true;
}
