function toggle_menu(div,hide,show)
{
	var choix1 = document.getElementsByName('toggleul');
	for(i=0;i<choix1.length;i++)	
	{
		choix1[i].style.display = "none";
	}
	
	var choix2 = document.getElementsByName('toggleli');
	for(i=0;i<choix2.length;i++)	
	{
		choix2[i].className = ""
	}	
	
	
	
	//document.getElementById('li' + i).className = ""		
	/*
	for(i=1;i<hide;i++)
	{
		//alert(div + i);
		document.getElementById(div + i).style.display = "none";
		
	}

	document.getElementById(div + '6').style.display = "none";
	document.getElementById('li' + 6).className = ""
		*/
	document.getElementById(div + show).style.display = "block";
	document.getElementById('li' + show).className = "current"
	
}

function hide_menu(div,hide)
{
	/*
	alert('lol');

	{
		if (choix.getAttribute('toggle') == "1"
		
	}
	*/
	
	/*
	for(i=1;i<hide;i++)
	{
		//alert(div + i);
		document.getElementById(div + i).style.display = "none";
	}
	document.getElementById(div + '6').style.display = "none";
	*/
}

function status(what)
{
	window.status = what;
}

function popupimage(chemin)
{	
	var html;
	html = '<HTML>\n'
	+ '<HEAD>\n'
	+ '<TITLE>D&eacute;tail de la photo</TITLE>\n'
	+ '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n'
	+ '<link rel="stylesheet" href="/charte/style.css" type="text/css">\n'
	+ '</HEAD>\n'
	+ '<BODY onLoad="window.focus();window.resizeTo(document.imageTest.width+35,document.imageTest.height+58);" bgcolor="#FFFFFF" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">\n'
	+ '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">\n'
	+ '<tr><td align="center" valign="middle">'
	+ '<img src="'+chemin+'" border="0" name="imageTest"></td></tr>\n'
	+ '</table>\n'
	+ '</BODY>\n'
	+ '</HTML>'
	
	var popup;
	popup = window.open('','popupgo','left=200,top=100,width=10,height=10,toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popup.document.write(html);
	popup.document.close();
}

function sktype()
{
	var allbox = document.getElementById('rtall');
	var choix = document.getElementById('form_contact').getElementsByTagName('input');
		//alert(choix.length);
		
		for (var i=0;i<choix.length;i++)
		{
			if (choix[i].getAttribute('what') == 'rt' && allbox.checked == true)
			{
				choix[i].checked = false;
			}
			else if (choix[i].getAttribute('what') == 'rt' && allbox.checked == false)
			{
				choix[i].disabled = false;
				
			}
		}
	verifrt();
}


function unsktype(rtinput)
{
	var toclick = document.getElementById(rtinput);
	
	if (toclick.checked==true)
	{
		var allbox = document.getElementById('rtall');
		allbox.checked=false;

	}
	unchecktype();
	verifrt();
}

function unchecktype()
{
	var choix = document.getElementById('form_contact').getElementsByTagName('input');

	for (var i=0;i<choix.length;i++)
	{
		if (choix[i].getAttribute('what') == 'rt')
		{
			choix[i].checked == false;
		}
	}		
	//verifrt();
}



function verifrt()
{
	//alert('lol');
	var allbox = document.getElementById('rtall');
	var choix = document.getElementById('form_contact').getElementsByTagName('input');
	var allchecked = 0; //verif sur le type ALL est checked
	var rtchecked = 0; //compte le nombre de type checked
	var numrt = 0;
	for (var i=0;i<choix.length;i++)
	{
		if (choix[i].getAttribute('what') == 'rt')
		{
			numrt++;			
		}
		if (choix[i].getAttribute('what') == 'rt' && choix[i].checked == true)
		{
			rtchecked++; 
		}
		if (choix[i].getAttribute('what') == 'rtall' && choix[i].checked == true)
		{
			allchecked = 1;
		}		
	}	
	
	if (allchecked == 1)
	{
		unchecktype();
		//alert('lol4');
	}
	else if (allchecked == 0 && rtchecked == 0)
	{
		allbox.checked=true;
		//alert('lol3');
	}
	else if (rtchecked == numrt)
	{
		//alert('lol');
		allbox.checked=true;
		sktype();
		
	}
	//else if (allchecked == 0 && rtchecked > 0)
	
}


function quizzcheck(id)
{
	qdiv = 'quest_' + id;
	okdiv = 'ok_' + id;
	kodiv = 'ko_' + id;
	
	descdiv = 'rep2_' + id;
		
	document.getElementById(okdiv).style.display = "none";
	document.getElementById(kodiv).style.display = "none";	
	
	form = document.getElementById(qdiv);
	choix = form.getElementsByTagName('input');
	//alert(choix.length);
	var errno = 0;
	for (var i=0;i<choix.length;i++)
	{
		plop = choix[i].id.split('_');
		if (plop[3] == 0 && choix[i].checked == true) errno++;
		if (plop[3] == 1 && choix[i].checked == false) errno++;
	}
	if (errno == 0)
		document.getElementById(okdiv).style.display = "block";
	else		
		document.getElementById(kodiv).style.display = "block";
	
	
	document.getElementById(descdiv).style.display = "block";
	
	//alert(errno);
}