function diveffect(div, value) {
	document.getElementById(div).style.display = value;
}


function Info(form) {
	var newloc=form.menu.options[form.menu.selectedIndex].value;
	if (newloc) self.location = newloc;
}


function startLoading() {
	
	obj1 = document.getElementById('onair');
	obj2 = document.getElementById('loading');

	if (obj1.style.display == 'none') {
		setTimeout("obj1.style.display = 'block'", 1240);
		setTimeout("obj2.style.display = 'none'", 1200);
	} else {
		// NOTHING 
	}
}

function showHideSelect(select)
{
    var objSelect = document.getElementById(select);
    objSelect.style.display = (objSelect.style.display == 'block') ? 'none' : 'block';
}

function validAndHide(txt, obj, input, select)
{
    document.getElementById(input).value = txt;
    obj.parentNode.parentNode.style.display = 'none';
    document.getElementById(select).innerHTML = obj.innerHTML;
}


function new_xhr(){
	var xhr_object = null;
	if(window.XMLHttpRequest)
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject){
	   try {
                xhr_object = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
            }
	}
	else {
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   xhr_object = false;
	}
	return xhr_object;
}

function getSession(page) {
	var xhr2 = new_xhr();
	xhr2.onreadystatechange = function() {
		if ( xhr2.readyState == 4 ) {
			if(xhr2.status  != 200) {
				xhr2.open("GET", page, true);
				xhr2.send(null);
			} else {
			}
		} else {
		}
	}
	xhr2.open("GET", "getSession.php", true);
	xhr2.send(null);
}


function load_page(select) {
	var xhr2 = new_xhr();
	xhr2.onreadystatechange = function(){
		if ( xhr2.readyState == 4 ){
			if(xhr2.status  != 200){
				// document.getElementById("layer").innerHTML = "Error code " + xhr2.status;
				xhr2.open("GET", "erreur.php", true);
				xhr2.send(null);
			} else {
				document.getElementById("layer").innerHTML = xhr2.responseText;
			}
		} else {
			document.getElementById("layer").innerHTML = "Chargement en cours ...<br /><img src='loading.gif' alt='' />";
		}
	}
	xhr2.open("GET", select.split('?')[1]+".php", true);
	xhr2.send(null);
}


