function switchBlocsOffline(idToShow,isConseil)
{
	var aIdOnglets = new Array('OL1','OL2','OL3');
	var aIdBlocs = new Array('blocQuestions','blocAlerte','blocAmi');
	for (var i=0;i<aIdBlocs.length;i++)
	{
		if (element = document.getElementById(aIdOnglets[i])) element.style.backgroundImage = "url('img/bckgrd_onglet"+(i==idToShow?'ON'+(isConseil?'2':''):'')+".jpg')";
		if (element = document.getElementById(aIdBlocs[i])) element.style.display = (i==idToShow?'block':'none');
	}
	return false;
}

function switchAgendaDay(idToShow)
{
	for (var i=16;i<21;i++)
	{
		switch (i)
		{
			case 16 : var dayLib = 'Lundi'; break;
			case 17 : var dayLib = 'Mardi'; break;
			case 18 : var dayLib = 'Mercredi'; break;
			case 19 : var dayLib = 'Jeudi'; break;
			case 20 : var dayLib = 'Vendredi'; break;
		}
		$dayL = dayLib.substr(0,1);
		//Maj du style du jour selectionné
		if (document.getElementById(i+'A'))
		{
			document.getElementById(i+'A').style.fontWeight = (idToShow==i?'bold':'normal');
			document.getElementById(i+'A').style.color = (idToShow==i?'#333333':'#ffffff');
		}
		//Maj des onglets Jour
		if (document.getElementById(i+'E'))
			document.getElementById(i+'E').style.backgroundImage = "url('img/bckgrd_jour1_"+$dayL+(idToShow==i?'on':'')+".gif')";
		if (document.getElementById(i+'C'))
			document.getElementById(i+'C').style.backgroundImage = "url('img/bckgrd_jour2_"+$dayL+(idToShow==i?'on':'')+".gif')";
		//Maj du libélle du jour selectionné
		if (i==idToShow)
		{
			if (document.getElementById('libDateE'))
				document.getElementById('libDateE').innerHTML = dayLib+' '+i;
			if (document.getElementById('libDateC'))
				document.getElementById('libDateC').innerHTML = dayLib+' '+i;
		}
		//Maj du contenu
		displayVal = (idToShow==i?'table-row':'none');
		var z = '0';
		while (element = document.getElementById('prog'+i+'-'+z))
		{
			element.style.display = displayVal;
			z++;
		}
	}
	return false;
}

function valide_sendContrib()
{
	if(trim(document.getElementById("input-pseudo").value) == "")
	{
		alert("Vous devez indiquer un pseudo pour envoyer une question.");
	 	return false;
	}
	if(trim(document.getElementById("input-contribution").value) == "")
	{
		alert("N'oubliez pas de remplir la question.");
		return false;
	}
	if (navigator.appName=="Microsoft Internet Explorer")
		document.getElementById("input-contribution").value = encode_utf8(document.getElementById("input-contribution").value);
	return true;
}

function trim(s){
		return s.replace(/^\s+/g,'').replace(/\s+$/g,'')
  }

function encode_utf8(contribution) 
{
	string = contribution.replace(/\r\n/g,"\n");
	var utftext = "";
	for (var n = 0; n < string.length; n++) 
	{
 		var c = string.charCodeAt(n);
 		if (c < 128) utftext += String.fromCharCode(c);
		else if((c > 127) && (c < 2048)) 
		{
			utftext += String.fromCharCode((c >> 6) | 192);
			utftext += String.fromCharCode((c & 63) | 128);
		}
		else 
		{
			utftext += String.fromCharCode((c >> 12) | 224);
			utftext += String.fromCharCode(((c >> 6) & 63) | 128);
			utftext += String.fromCharCode((c & 63) | 128);
		}
	}
 	return utftext;
}

function switchVideosUl(indexToShow)
{
	var varReturn = true;
	for (var i=1;i<=3;i++)
	{
		if (element = document.getElementById('ul'+i))
		{
			element.style.display = (i==indexToShow?'block':'none');
			if (elementOnglet = document.getElementById('ongletRep'+i))
			{
				//elementOnglet.style.backgroundImage = "url('../img/bckgrd_onglet+(i==indexToShow?'ON':'')+'.jpg)';
				elementOnglet.style.backgroundImage = "url(../img/bckgrd_onglet"+(i==indexToShow?'ON2':'')+".jpg)";
			}
			if (i==indexToShow) var varReturn = false;
		}
	}
	return varReturn;
}





