function showHideInfo()
{
	if (!document.getElementById("info")) { return false; }
	
	if (document.getElementById("info").style.display == "none")
	{
		document.getElementById("info").style.display = "block";
		document.getElementById("info").style.visibility = "visible";
		document.getElementById("infoSwitch").innerHTML = "cacher les détails";
	}
	else
	{
		document.getElementById("info").style.display = "none";
		document.getElementById("info").style.visibility = "hidden";
		document.getElementById("infoSwitch").innerHTML = "détails...";
	}
	
	document.getElementById("infoSwitch").blur();
}

function button(myLabel, myOnClick)
{
	var HTML = "";

	HTML += "<table cellpadding=0 cellspacing=0 border=0 onclick=" + myOnClick + " class=button>";
	HTML += "<tr>";
	HTML += "<td><img src=../graphics/button_g0.gif></td>";
	HTML += "<td background=../graphics/button_g1.gif style='padding-bottom:2px;padding-left:4px;padding-right:4px;'>" + myLabel + "</td>";
	HTML += "<td><img src=../graphics/button_g2.gif></td>";
	HTML += "</tr>";
	HTML += "</table>";
	
	document.write(HTML);
}

function whiteButton(myLabel, myOnClick)
{
	var HTML = "";

	HTML += "<table cellpadding='0' cellspacing='0' border='0' onclick=" + myOnClick + " style='display:inline; cursor:default; cursor:pointer; margin-left: 5px; margin-right: 5px;'>\n";
	HTML += "<tr>\n";
	HTML += "<td><img src='graphics/wButtonLeft.gif'></td>\n";
	HTML += "<td class='wButton'>" + myLabel + "</td>\n";
	HTML += "<td><img src='graphics/wButtonRight.gif'></td>\n";
	HTML += "</tr>\n";
	HTML += "</table>\n";
	
	document.write(HTML);
}

function isValid(myType, myWord)
{
	switch (myType)
	{
		case "word":
			if (!myWord.match(/^[àâéèêëîôöùüçÉa-zA-Z0-9\.\-\'\s]+$/)) { return false; }
		break;
		
		case "mail":
			if (!myWord.match(/^[a-zA-Z0-9@\.\-\_\s]+$/)) { return false; }
		break;
		
		case "url":
			if (!myWord.match(/^[a-zA-Z0-9\.\-\_\/\:\?\=\,]+$/)) { return false; }
		break;
		
		case "year":
			if (!myWord.match(/^[0-9]{4}$/)) { return false; }
			var myTime = new Date();
			var myYear = myTime.getFullYear();
			if ((myWord > myYear) || (myWord < 1900)) { return false; }
		break;
		
		case "month":
			if (!myWord.match(/^[0-9]{2}$/)) { return false; }
		break;
		
		case "number":
			if (!myWord.match(/^[0-9]{2,4}$/)) { return false; }
		break;
		
		case "phone":
			if (!myWord.match(/^[0-9]{10}$/)) { return false; }
		break;
		
		case "text":
			if (myWord.search(/[\<\>\=]/) != -1) { return false; }
		break;
		
		case "address":
			if (!myWord.match(/^[àâéèêëîôöùüçÉa-zA-Z0-9()\.\-\'\,\s]+$/)) { return false; }
		break;
		
		case "zip":
			if (!myWord.match(/^[0-9]{5}$/)) { return false; }
		break;
	}
	return true;
}

function displayError(myText)
{
	var myButton = "";
	
	document.getElementById("errorDIV").innerHTML  = myText;
	// document.getElementById("errorDIV").innerHTML += myButton;
	document.getElementById("errorDIV").style.display = "block";
	document.getElementById("errorDIV").style.visibility = "visible";
}

function onEnter(e, myHandler)
{
	var key;
	var keychar;
	myHandler = unescape(myHandler);
	
	if (window.event) { key = window.event.keyCode; }
	else if (e) { key = e.which; }
	else { return true; }
	
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	
	// ENTER key
	if (key==13)
	{
		setTimeout(myHandler, 1);
		// alert(myHandler);
		return false;
	}
	// EVERY OTHER key
	return true;
}

function detect(Event)
{
	// Event appears to be passed by Mozilla
	// IE does not appear to pass it, so lets use global var
	if(Event==null)
	{
			alert('null');
		Event=event;
		}
	cod = Event.keyCode;
	switch (cod)
	{
			case 13: show_id("typed"); break;
	}
}
