/*JQUERY*/
$(document).ready(function(){

});

function showOther(qId, index, index_max)
{
	if (index == index_max)
		document.getElementById('other_' + qId).style.display='block';
	else
		document.getElementById('other_' + qId).style.display='none';
}
 
function showQuestion(qId)
{
	$("#linked_" + qId).show("slow");
}
function hideQuestion(qId)
{
	$("#linked_" + qId).hide("slow");
}
/*FIN JQUERY*/
/*AJAX*/
function createRequestObjectReponse() {
	var ro;
	ro = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
	return ro;
}
var httpReponse = createRequestObjectReponse();

function getXhr(){
					var xhr = null;
	if(window.XMLHttpRequest) // Firefox et autres
	   xhr = new XMLHttpRequest();
	else if(window.ActiveXObject){ // Internet Explorer
	   try {
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
	}
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   xhr = false;
	}
	return xhr
}
function getNext(champ,paysId,questionId){

    var xhr = getXhr()
    xhr.onreadystatechange = function(){
        if(xhr.readyState == 4 && xhr.status == 200){
 			document.getElementById('nextChamp_'+questionId).innerHTML = xhr.responseText;
 			document.getElementById('nextChamp_'+questionId).style.display="block";
        }
    }
    var cp = document.getElementById("question_"+questionId).value;
    xhr.open("GET","/_assets/ajax/getNext.cfm?cp=" + cp + "&champ=" + champ + "&paysId=" + paysId ,true);
    xhr.send(null);
}

function checkRadio(radioId)
{
	document.getElementById(radioId).checked=true;
}

function showDiv(divId,nbGroupe)
{
	for(var i=1; i<=nbGroupe;i++)
	{
		document.getElementById("onglet_"+i).style.backgroundImage = 'url("")';
		document.getElementById("onglet_"+i).className = "";
		document.getElementById("contenu_"+i).style.display = "none";
	}
	document.getElementById("onglet_"+divId).style.backgroundImage = 'url("/_assets/images/fond_onglet.jpg")';
	document.getElementById("onglet_"+divId).className = "fond_gris";
	document.getElementById("contenu_"+divId).style.display = "block";
}
/*function checkEmail(questionId){
    var xhr = getXhr()
    xhr.onreadystatechange = function(){
        if(xhr.readyState == 4 && xhr.status == 200){
 			document.getElementById('check_'+questionId).innerHTML = xhr.responseText;
 			document.getElementById('check_'+questionId).style.display="block";
        }
    }
    var email = document.getElementById("question_"+questionId).value;
    xhr.open("GET","/_assets/ajax/check_email.cfm?questionId=" + questionId + "&email=" + email ,true);
    xhr.send(null);
}

function checkDate(questionId,dateFormat)
{
	var xhr = getXhr()
    xhr.onreadystatechange = function(){
        if(xhr.readyState == 4 && xhr.status == 200){
 			document.getElementById('check_'+questionId).innerHTML = xhr.responseText;
 			document.getElementById('check_'+questionId).style.display="block";
        }
    }
    var date = document.getElementById("question_"+questionId).value;
    xhr.open("GET","/_assets/ajax/check_date.cfm?questionId=" + questionId + "&formatDate=" + dateFormat + "&date=" + date ,true);
    xhr.send(null);

}*/
