/**
* Simule le target="_blank"
*/
function a_ext()
{
	var liens = document.getElementsByTagName('a');

	for (var i = 0; i < liens.length; ++i)
	{
		if(liens[i].className == 'target')
		{
			liens[i].onclick = function()  {
				window.open(this.href);
				return false;
			};
		}
	}
}

/**
* Affiche le sous menu correspondant
*/
function sous_menu(num_id) {

	document.getElementById('sous_menu').innerHTML = document.getElementById('sous_menu' + num_id).innerHTML;

}
function all_check(id)
{
	var inputs = document.getElementById(id).getElementsByTagName('input');

	for (var i = 0; i < inputs.length; ++i)
	{
		inputs[i].checked = 'checked';
	}
}

function display_com(id1, id2, i)
{
	var img = document.getElementById(id1+i);
	var div = document.getElementById(id2+i);
	
	if(div.style.display == 'block')
	{
		img.src='/images/croix-off.gif';
		div.style.display='none';
	}
	else
	{
		img.src='/images/croix-on.gif';
		div.style.display='block';
	}
}

window.onload = a_ext;

	if(window.XMLHttpRequest)
		var xhr = new XMLHttpRequest();
		
    else if(window.ActiveXObject)
		var xhr = new ActiveXObject('Microsoft.XMLHTTP');
		
function calendar(html_id, year, month) {
	
	xhr.open('POST', '/xhr.php?type=calendar', true);
	xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
		
	xhr.send('year='+escape(year)+'&month='+escape(month));
	xhr.onreadystatechange = function()
        {
			if (xhr.readyState == 4)
			{
					document.getElementById(html_id).innerHTML=xhr.responseText;
			}				
			else
				return(false);

		}
}