// JavaScript Document
// SITE DU SQUARE
// Fonction de DOM communes à toutes les pages

function makeInfoAlt(obj, sel) {
	//ensuite on doit trouver le div où afficher les infos. Il porte l'id info_user_name, info_user_pass, etc
	var targetElement = document.getElementById(obj);
	//Donc au mouseover, on affiche le texte dans ce div
	if(targetElement.style.display=="none")
	{
		targetElement.style.display = "block";		
	}
	sel.onmouseover = function() {	
		targetElement.style.display = "block";
	}
	//Au mouseout on masque le div
	sel.onmouseout = function() {
		targetElement.style.display = "none";
	}
}
// Pour changer la couleur au focus
function changeFocus(obj)
{
	/*obj.style.color='#a8bfc2';*/
	obj.style.backgroundColor='#ebf5f7';
}

function changeSelect(optiona, optionb)
{
	opt = document.getElementById(optiona);
	opt.selected = true;
	opt2 = document.getElementById(optionb);
	opt2.selected = true; 
}

function couleur(obj) {
     obj.style.backgroundColor = "#cce7eb";
}

function check_contact($random) {
	var msg = "";

	if (document.contact_form.entreprise.value == "Votre entreprise *")	{
		msg += "- Votre entreprise\n";
		document.contact_form.entreprise.style.backgroundColor = "#ff0000";
	}
	if (document.contact_form.nom.value == "Votre nom *")	{
		msg += "- Votre nom\n";
		document.contact_form.nom.style.backgroundColor = "#ff0000";
	}
	if (document.contact_form.mail.value == "Votre mail *")	{
		msg += "- Votre mail\n";
		document.contact_form.mail.style.backgroundColor = "#ff0000";
	}
	if (document.contact_form.captcha.value == "Code de vérification *")	{
		msg += "- Le code de v\351rification\n";
		document.contact_form.captcha.style.backgroundColor = "#ff0000";
	}
	else {
		if($random==1) {
			if (document.contact_form.captcha.value != "2AKNXW" && document.contact_form.captcha.value != "2aknxw")	{
			msg += "- Le code de v\351rification est incorect";
			document.contact_form.captcha.style.backgroundColor = "#ff0000";
			}
		}
		else if($random==2) {
			if (document.contact_form.captcha.value != "XKNQKD" && document.contact_form.captcha.value != "xknqkd")	{
			msg += "- Le code de v\351rification est incorect";
			document.contact_form.captcha.style.backgroundColor = "#ff0000";
			}
		}
		else if($random==3) {
			if (document.contact_form.captcha.value != "8CAWGZ" && document.contact_form.captcha.value != "8cawgz")	{
			msg += "- Le code de v\351rification est incorect";
			document.contact_form.captcha.style.backgroundColor = "#ff0000";
			}
		}
	}

	if (msg == "") return(true);
	else	{
		alert("Veuillez remplir les champs suivants : \n\n" +msg);
		return(false);
	}
}