// scripts by SophieWeb http://sophieweb.com unless stated otherwise

// emailContact(), modified version of http://www.dynamicdrive.com/emailriddler/
var a = new Array(99,111,110,116,97,99,116,64,109,97,114,105,101,45,116,104,101,114,101,115,101,45,108,101,45,118,101,114,116,46,99,111,109);
var b = '';
for (var i=0; i < a.length; i++)
	b += String.fromCharCode(a[i]);

function emailContactFooter() {
	document.write('<p>&copy; <' + 'a href="mailto:' + b + '?subject=Site%20Marie-Therese%20Le%20Vert" title="Contacter Marie-Th&eacute;r&egrave;se Le Vert par e-mail">Marie-Th&eacute;r&egrave;se Le Vert<' + '/a> 2009 &mdash; Tous droits r&eacute;serv&eacute;s</p>');
}
function emailContactMenu() {
	document.write('<' + 'a href="mailto:' + b + '?subject=Site%20Marie-Therese%20Le%20Vert" title="Contacter Marie-Th&eacute;r&egrave;se Le Vert par e-mail">Contact<' + '/a>');
	return false;
}

function emailContactFooterEN() {
	document.write('<p>&copy; <' + 'a href="mailto:' + b + '?subject=Marie-Therese%20Le%20Vert%20website" title="Contact Marie-Th&eacute;r&egrave;se Le Vert by e-mail">Marie-Th&eacute;r&egrave;se Le Vert<' + '/a> 2009 &mdash; All rights reserved</p>');
}
function emailContactMenuEN() {
	document.write('<' + 'a href="mailto:' + b + '?subject=Marie-Therese%20Le%20Vert%20website" title="Contact Marie-Th&eacute;r&egrave;se Le Vert by e-mail">Contact<' + '/a>');
	return false;
}

var c = new Array(119,101,98,109,97,115,116,101,114,64,109,97,114,105,101,45,116,104,101,114,101,115,101,45,108,101,45,118,101,114,116,46,99,111,109);
var d = '';
for (var i=0; i < c.length; i++)
	d += String.fromCharCode(c[i]);

function emailWebmaster() {
	document.write('<p>Commentaires, remarques et suggestions&nbsp;: <' + 'a href="mailto:' + d + '?subject=Site%20Marie-Therese%20Le%20Vert" title="Contacter le webmaster par e-mail">' + d + '</a></p>');
}
function emailWebmasterEN() {
	document.write('<p>Comments, remarks and suggestions: <' + 'a href="mailto:' + d + '?subject=Marie-Therese%20Le%20Vert%20website" title="Contact the webmaster by e-mail">' + d + '</a></p>');
}

// language detection
function detectLanguage() {
	var cookieLang = readCookie("mtlv-lang");
	if (cookieLang != "") {
		switch (cookieLang) {
			case "EN" :
				window.top.location = "index.en.html";
				break;
			default :
				window.top.location = "index.fr.html";
		}
	}
	else if (navigator.userLanguage) {
		if(navigator.userLanguage.indexOf("en") != -1 ) {
			createCookie("mtlv-lang", "EN", 8760);
			window.top.location = "index.en.html";
		}
		if(navigator.userLanguage.indexOf("fr") != -1 ) {
			createCookie("mtlv-lang", "FR", 8760);
			window.top.location = "index.fr.html";
		}
	}	
	else if (navigator.language) {
		if(navigator.language.indexOf("en") != -1 ) {
			createCookie("mtlv-lang", "EN", 8760);
			window.top.location = "index.en.html";
		}
		if(navigator.language.indexOf("fr") != -1 ) {
			createCookie("mtlv-lang", "FR", 8760);
			window.top.location = "index.fr.html";
		}
	}
}

function switchLanguage(langue) {
	createCookie("mtlv-lang", langue, 8760);
}

// This script based on Paul Snowden's work described on A List Apart
// <http://www.alistapart.com/stories/alternate/>
function createCookie(name,value,hours) {
	if (hours) {
		var date = new Date();
		date.setTime(date.getTime()+(hours*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


