var breadCrumbsLookup = {
	fr: 'Accueil',
	guides: 'Guides et formulaires',
	news: 'Nouvelles'
};

function createBreadCrumbs() {
	// Create breadcrumbs
	var location = window.location.pathname;
	var locationArray = location.split(/\//);
	var breadCrumbsString = '';
	var breadCrumbsPath = '';
	var first = true; 
	for (var i in locationArray) {
		// Skip if array member undefined or has a dot (i.e. it's a filename)
		if ( (typeof(locationArray[i]) == 'undefined') || (locationArray[i].match(/news/)) || (locationArray[i].match(/about/)) ||(locationArray[i].length < 1) || (locationArray[i].match(/\./)) ) {
			continue;
		} else {
			if (first) {
				breadCrumbsPath = '/' + locationArray[i] + '/';
				if ( (typeof(breadCrumbsLookup[locationArray[i]]) == 'undefined') || (breadCrumbsLookup[locationArray[i]] == null) ) {
					breadCrumbsString = '<a href="' + breadCrumbsPath + '">' + locationArray[i] + '</a>';
				} else {
					breadCrumbsString = '<a href="' + breadCrumbsPath + '">' + breadCrumbsLookup[locationArray[i]] + '</a>';
				}
				first = false;
			} else {
				breadCrumbsPath += locationArray[i] // + '/';
				if ( (typeof(breadCrumbsLookup[locationArray[i]]) == 'undefined') || (breadCrumbsLookup[locationArray[i]] == null) ) {
					breadCrumbsString += '&nbsp;>>&nbsp;<a href="' + breadCrumbsPath + '.shtml">' + locationArray[i] + '</a>';			
				} else {
					breadCrumbsString += '&nbsp;>>&nbsp;<a href="' + breadCrumbsPath + '.shtml">' + breadCrumbsLookup[locationArray[i]] + '</a>';
				}
			}
		}
	}
	if (breadCrumbsString.length > 0) {
		breadCrumbsString += "&nbsp;>>&nbsp;" + document.title;
	} else {
		breadCrumbsString = document.title;
	}
	var breadCrumbsDiv = document.getElementById('breadCrumbs');
	breadCrumbsDiv.innerHTML = breadCrumbsString;
}
window.onload = createBreadCrumbs;

function switch2English() {
	var url = window.location.href;
	var newUrl = url.replace(/\/fr\//, "/en/");
	window.location = newUrl;
	return false;
}