function openContent(element, nb){	
	for(i=1;i<=nb;i++){
		closeContent('content'+i);
	}	
	
	var obj = document.getElementById(element);
	obj.style.display = "block";	
	
	dojo.animateProperty({
		node:obj,
		duration: 500,
		properties: {
			opacity: {start: 0, end: 1}
		}
	}).play();		
}

function closeContent(element){
	var obj = document.getElementById(element);		
	dojo.animateProperty({
		node:obj,
		duration: 500,
		properties: {
			opacity: {start: 1, end: 0}
		}
	}).play();	
	obj.style.display = "none";	
}

function envoyerForm(){
	
}

function activeLink(source, cible){
	
}

function agrandirCadre(element){
	var papa = "blocAccueilNews"+element;
	var papaHidden = "blocAccueilNewsHidden"+element;
	var fils = "blocAccueilNewsTexte"+element;
	var filsHidden = "blocAccueilNewsTexteHidden"+element;
	var papaHiddenHeight = document.getElementById(papaHidden).offsetHeight+10;
	var papaHeight = document.getElementById(papa).offsetHeight;
	var filsHiddenHeight = document.getElementById(filsHidden).offsetHeight+10;
	var filsHeight = document.getElementById(fils).offsetHeight;
	if(papaHiddenHeight < papaHeight){
		papaHiddenHeight = papaHeight;
		filsHiddenHeight = filsHeight;
	}
	if(papaHiddenHeight > papaHeight){
		dojo.animateProperty({
			node:papa,
			duration: 200,
			properties: {
				height: {start: '172', end: papaHiddenHeight, unit:'px' }
			},onEnd:function(){
				dojo.animateProperty({
					node:fils,
					duration: 200,
					properties: {
						height: {start: '128', end: filsHiddenHeight, unit:'px' }
					}
				}).play();
			}
		}).play();
	}else{
		dojo.animateProperty({
			node:fils,
			duration: 200,
			properties: {
				height: {end: '128', unit:'px' }
			},onEnd:function(){
				dojo.animateProperty({
					
					node:papa,
					duration: 200,
					properties: {
						height: {end: '172', unit:'px' }
					}							
				}).play();
			}
		}).play();		
	}
}

function checkOption(div_id, nb){
	for(i=0;i<nb;i++){
		if(document.getElementById("option"+i)){
			document.getElementById("option"+i).style.display = "none";
		}
	}	
	if(document.getElementById("option"+div_id)){
		if(document.getElementById("check"+div_id).checked==true){
			document.getElementById("option"+div_id).style.display = "block";
		}
	}
}

function checkOption2(debut, div_id, nb){
	for(i=debut;i<debut+nb;i++){
		if(document.getElementById("option"+i)){
			document.getElementById("option"+i).style.display = "none";
		}
	}	
	if(document.getElementById("option"+div_id)){
		if(document.getElementById("check"+div_id).checked==true){
			document.getElementById("option"+div_id).style.display = "block";
		}
	}
}


function majSupport(cible, support_id){
	dojo.xhrPost({
		url:"/formulaires/ajax/majSupport.php5",
		content: {
			"support_id":support_id
		},
		load: function(data,ioargs){
			document.getElementById(cible).innerHTML = data;
		}
	});	
}

function majBoitier(cible, boitier_id){
	dojo.xhrPost({
		url:"/formulaires/ajax/majBoitier.php5",
		content: {
			"boitier_id":boitier_id
		},
		load: function(data,ioargs){
			document.getElementById(cible).innerHTML = data;
		}
	});	
}

function majCond(cible, cond_id){
	dojo.xhrPost({
		url:"/formulaires/ajax/majCond.php5",
		content: {
			"cond_id":cond_id
		},
		load: function(data,ioargs){
			document.getElementById(cible).innerHTML = data;
		}
	});	
}

function majLivret(cible, livret_id, format){
	dojo.xhrPost({
		url:"/formulaires/ajax/majLivret.php5",
		content: {
			"livret_id":livret_id
		},
		load: function(data,ioargs){
			document.getElementById(cible).innerHTML = data;
		}
	});	
}

function majJaquette(cible, livret_id){
	dojo.xhrPost({
		url:"/formulaires/ajax/majJaquette.php5",
		content: {
			"livret_id":livret_id
		},
		load: function(data,ioargs){
			document.getElementById(cible).innerHTML = data;
		}
	});	
}

function majMode(cible, mode_id){
	dojo.xhrPost({
		url:"/formulaires/ajax/majMode.php5",
		content: {
			"mode_id":mode_id
		},
		load: function(data,ioargs){
			document.getElementById(cible).innerHTML = data;
		}
	});	
}

function controle(f){
	var i = 0;
	for (i = 0; i < f.coche.length; i++){
		if (f.coche[i].checked) return true;
	}
	return false;
} 

function checkUnique(){
	if(parseInt(document.getElementById("quantite").value)>499){
		var i = 0;
		for (i = 0; i < document.formListe.check.length; i++){
			if (document.formListe.check[i].checked){
				document.getElementById("divSuivant1").style.display = "block";
				return true;
			}
		}
		document.getElementById("divSuivant1").style.display = "none";
		return false;
	}
	document.getElementById("divSuivant1").style.display = "none";
	return false;
}
function checkEnsemble(){
	if(parseInt(document.getElementById("quantiteB").value)>499){
		var i = 0;
		for (i = 0; i < document.formListe.check.length; i++){
			if (document.formListe.check[i].checked){
				for (i = 0; i < document.formListe.checkB.length; i++){
					if (document.formListe.checkB[i].checked){
						document.getElementById("divSuivant2").style.display = "block";
						return true;						
					}
				}				
			}
		}
		document.getElementById("divSuivant2").style.display = "none";
		return false;
	}
	document.getElementById("divSuivant2").style.display = "none";
	return false;
}

function checkIndiv(){
	if(parseInt(document.getElementById("quantiteC").value)>499&&parseInt(document.getElementById("quantite2").value)>499){
		var i = 0;
		for (i = 0; i < document.formListe.check.length; i++){
			if (document.formListe.check[i].checked){
				for (i = 0; i < document.formListe.checkC.length; i++){
					if (document.formListe.checkC[i].checked){
						document.getElementById("divSuivant3").style.display = "block";
						return true;						
					}
				}				
			}
		}
		document.getElementById("divSuivant3").style.display = "none";
		return false;
	}
	document.getElementById("divSuivant3").style.display = "none";
	return false;
}

function checkUniqueEtape2(){
		var i = 0;
		for (i = 0; i < document.formListe.check2.length; i++){
			if (document.formListe.check2[i].checked){
				for (i = 0; i < document.formListe.check2b.length; i++){
					if (document.formListe.check2b[i].checked){
						document.getElementById("divSuivant1").style.display = "block";
						return true;
					}
				}
			}
		}
		document.getElementById("divSuivant1").style.display = "none";
		return false;
}

function checkEnsembleEtape2(){
	var i = 0;
	for (i = 0; i < document.formListe.check2.length; i++){
		if (document.formListe.check2[i].checked){
			for (i = 0; i < document.formListe.check2c.length; i++){
				if (document.formListe.check2c[i].checked){
					for (i = 0; i < document.formListe.check2b.length; i++){
						if (document.formListe.check2b[i].checked){
							document.getElementById("divSuivant1").style.display = "block";
							return true;
						}
					}
				}
			}
		}
	}
	document.getElementById("divSuivant1").style.display = "none";
	return false;
}

function checkIndivEtape2(){
	var i = 0;
	for (i = 0; i < document.formListe.check2.length; i++){
		if (document.formListe.check2[i].checked){
			for (i = 0; i < document.formListe.check2c.length; i++){
				if (document.formListe.check2c[i].checked){
					for (i = 0; i < document.formListe.check2b.length; i++){
						if (document.formListe.check2b[i].checked){
							for (i = 0; i < document.formListe.check2cb.length; i++){
								if (document.formListe.check2cb[i].checked){
									document.getElementById("divSuivant1").style.display = "block";
									return true;
								}
							}
						}
					}
				}
			}
		}
	}
	document.getElementById("divSuivant1").style.display = "none";
	return false;
}

function checkUniqueEtape3(){
	var i = 0;
	for (i = 0; i < document.formListe.check3.length; i++){
		if (document.formListe.check3[i].checked){
			for (i = 0; i < document.formListe.check3b.length; i++){
				if (document.formListe.check3b[i].checked){
					document.getElementById("divSuivant1").style.display = "block";
					return true;
				}
			}
		}
	}
	document.getElementById("divSuivant1").style.display = "none";
	return false;
}

function checkIndivEtape3(){
	var i = 0;
	for (i = 0; i < document.formListe.check3.length; i++){
		if (document.formListe.check3[i].checked){
			for (i = 0; i < document.formListe.check3b.length; i++){
				if (document.formListe.check3b[i].checked){
					for (i = 0; i < document.formListe.check3c.length; i++){
						if (document.formListe.check3c[i].checked){
							for (i = 0; i < document.formListe.check3cb.length; i++){
								if (document.formListe.check3cb[i].checked){
									document.getElementById("divSuivant1").style.display = "block";
									return true;
								}
							}
						}
					}
				}
			}
		}
	}
	document.getElementById("divSuivant1").style.display = "none";
	return false;
}

function activeSelect(id){
	for(i=0;i<3;i++){
		if(i==id){
			document.getElementById("supportG"+i).disabled="";
		}else{
			document.getElementById("supportG"+i).disabled="true";
		}
	}	
}
		
