function prechargimg()
{
	var doc=document;
	if(doc.images){ if(!doc.precharg) doc.precharg=new Array();
	var i,j=doc.precharg.length,x=prechargimg.arguments; for(i=0; i<x.length; i++)
	if (x[i].indexOf("#")!=0){ doc.precharg[j]=new Image; doc.precharg[j++].src=x[i];}}
}

function checkSoutienForm()
{
	var err = '';

	if (document.getElementById('nom').value == '') err += '\n- Votre nom';
	if (document.getElementById('prenom').value == '') err += '\n- Votre prénom';

	var email = document.getElementById('email').value;

	if (email == '') err += '\n- Votre e-mail';

	if (email != '' &&
		(email.indexOf("@") == "-1" ||
		email.indexOf(".") == "-1"))
		err += '\n- Votre e-mail est incorrect';

	if (document.getElementById('type_idee').checked == false &&
		document.getElementById('type_question').checked == false) err += '\n- Le type de contribution';
	if (document.getElementById('commentaires').value == '') err += '\n- Votre message';

	if (err != '')
	{
		alert('Les champs suivants sont obligatoires :\n' + err);
		return false;
	}

	return true;
}

var modSoutienBg;

function showModSoutien(groupe)
{
	if (!modSoutienBg)
		initModSoutien();

	var modSoutienGroupe = document.getElementById('mod_soutien_groupe');

	if (modSoutienGroupe)
		modSoutienGroupe.value = groupe;

	var modSoutien = document.getElementById('mod_soutien');

	modSoutienBg.style.top = document.documentElement.scrollTop + 'px';
	modSoutienBg.style.display = 'block';
	modSoutien.style.top = ((document.documentElement.clientHeight / 2) - 100) + document.documentElement.scrollTop + 'px';
	modSoutien.style.display = 'block';
}

function hidewModSoutien()
{
	var modSoutien = document.getElementById('mod_soutien');

	modSoutienBg.style.display = 'none';
	modSoutien.style.display = 'none';
}

function initModSoutien()
{
	var modSoutien = document.getElementById('mod_soutien');

	modSoutienBg = document.createElement('div');
	modSoutienBg.className = 'mod_soutien_bg';
	modSoutienBg.style.width = document.body.clientWidth + 'px';
	modSoutienBg.style.height = document.documentElement.clientHeight + 'px';
	modSoutienBg.style.opacity = 0.5;
	modSoutienBg.style.filter = 'alpha(opacity=' + 50 + ')';

	modSoutien.style.left = ((document.body.clientWidth / 2) - 200) + 'px';
	modSoutien.style.top = ((document.documentElement.clientHeight / 2) - 100) + 'px';

	window.onscroll = function()
	{
		hidewModSoutien();
	}

	document.body.appendChild(modSoutienBg);

	if (modSoutien.className == 'sent' || modSoutien.className == 'error')
		showModSoutien();
}

