/*
son of suckerfish menu script from:
http://www.htmldog.com/articles/suckerfish/dropdowns/
 */
 
 sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			this.style.zIndex=200; //this line added to force flyout to be above relatively positioned stuff in IE
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function verifSelection() {
	var ses = document.getElementsByName('sessions[]');
	var i = 0;
	for (; i < ses.length; i++)
		if (ses[i].checked == true)
			break;
	if (i == ses.length) {
		alert("Vous devez s\351lectionner au moins une session.");
		return false;
	}
	return true;
}

function changeSelection(id, check) {
	var e = document.getElementById(id);
	if (e) {
		var n = e.childNodes;
		for (i=0; i < n.length; i++) {
			if (n[i].nodeName == "INPUT") {
				n[i].checked = check;
			}
			if (n[i].nodeName == "DIV") {
				var nn = n[i].childNodes;
				for (j=0; j < nn.length; j++) {
					if (nn[j].nodeName == "INPUT") {
						nn[j].checked = check;
					}
				}
			}
		}
	}
}

function generePDF() {
	var r = '';
	var rArr = Form.getInputs('frm_catalogue', 'checkbox');
	for (i = 0; i < rArr.length; i++)
		if (rArr[i].checked)
			r += rArr[i].value+",";
	$('resultat_pdf').innerHTML = "<img src='images/loading.gif' alt='loading...' />";
	new Ajax.Updater(
						'resultat_pdf',
						'ajax_trt.php',
						{
							method: 'post',
							parameters: 'ajaction=generePDF&rub='+r
						}
					);
}
