<!-- hide from non JavaScript browsers 
var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject() {
	var xmlHttp;
	
	try {
		xmlHttp = new XMLHttpRequest();
	}
	catch(e) {
		var XmlHttpVersions = new Array('MSXML2.XMLHTTP.6.0',
										'MSXML2.XMLHTTP.5.0',
										'MSXML2.XMLHTTP.4.0',
										'MSXML2.XMLHTTP.3.0',
										'MSXML2.XMLHTTP',
										'MICROSOFT.XMLHTTP');
		for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) {
			try {
					xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
			}
			catch(e) {}
		}
	}
	if (!xmlHttp) {
		alert("Error creating the XMLHttpRequest object.");
	} else {
		return xmlHttp;
	}
}

function sendemail(theemail)
{
	serverpage = "/functions/emailus.php";
	myDiv = document.getElementById('form_td');
	
	prenom = document.getElementById('fprenom').value;
	nom = document.getElementById('fnom').value;
	courriel = document.getElementById('fcourriel').value;
	fcaptcha = document.getElementById('fcaptcha').value;
	flang = document.getElementById('flang').value;
	quick = "fprenom=" + prenom + "&fnom=" + nom + "&fcourriel=" + courriel + "&fcaptcha=" + fcaptcha + "&flang=" + flang;
	
	/**
	This ensures that there are not multiple 
	requests made to the server by the same client
	**/
	if (xmlHttp.readyState == 1 ){
		myDiv.innerHTML = "<p>En envoi... / Sending ...</p>";
	} else if (xmlHttp.readyState == 2 ){
		myDiv.innerHTML = "<p>En envoi... / Sending ...</p>";
	} else if (xmlHttp.readyState == 3) {
		myDiv.innerHTML = "<p>En envoi... / Sending ...</p>";
	} else {
	/**
	If no requests are already pending, then we try sending the email.
	**/
		try {
			xmlHttp.open("POST", serverpage , true);
			xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
			xmlHttp.setRequestHeader("Content-length", quick.length);
			xmlHttp.setRequestHeader("Connection", "close");
			xmlHttp.onreadystatechange = handleEmail;
			xmlHttp.send(quick);
		}
		catch (e)
		{
			alert("Can't send email. Please try again.");
		}
	}

}

function handleEmail() {
	myDiv = document.getElementById('form_td');
		
	if (xmlHttp.readyState == 1 ){
		myDiv.innerHTML = "<p>En envoi...</p>";
	} else if (xmlHttp.readyState == 2 ){
		myDiv.innerHTML = "<p>En envoi...</p>";
	} else if (xmlHttp.readyState == 3) {
		myDiv.innerHTML = "<p>En envoi...</p>";
	} else if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			try {
				response = xmlHttp.responseText;
				myDiv.innerHTML = response;				
			}
			catch (e) {
				myDiv.innerHTML = "<p>Error reading the response: " + e.toString() + "</p>";
			}
		} else {
			myDiv.innerHTML = "<p>There was a problem retrieving the data:\n" + xmlHttp.statusText + "</p>";
		}
	}
}

function setTextSize(fontSize) {
	setCookie('baseFont',fontSize,365);
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}