function switch_tab(v2){
	//alert("tentative passage de "+current_tab+" a "+v2);
	if(one_checked()){
		$("#inscr_etape_"+current_tab).fadeOut("fast",function(){
			//alert("#inscr_etape_"+v2);
			$("#inscr_etape_"+v2).fadeIn("slow");
			current_tab = v2;
		});
	}else{
		alert("Choisissez une catégorie");
	}
}
function one_checked(){
	return is_candidat()
		|| is_entrepreneur()
		|| is_investisseur()
		|| is_organisation();
}
function is_candidat(){
	return $("#CLI_TCL_ID_1").is(":checked");
}
function is_entrepreneur(){
	return $("#CLI_TCL_ID_10").is(":checked")
		|| $("#CLI_TCL_ID_11").is(":checked")
		|| $("#CLI_TCL_ID_12").is(":checked")
		|| $("#CLI_TCL_ID_19").is(":checked")
		|| $("#CLI_TCL_ID_20").is(":checked")
		;
}
function is_investisseur(){
	return $("#CLI_TCL_ID_4").is(":checked")
		|| $("#CLI_TCL_ID_5").is(":checked")
		|| $("#CLI_TCL_ID_6").is(":checked")
		|| $("#CLI_TCL_ID_7").is(":checked")
		|| $("#CLI_TCL_ID_8").is(":checked")
		|| $("#CLI_TCL_ID_9").is(":checked");
}
function is_organisation(){
	return $("#CLI_TCL_ID_2").is(":checked")
		|| $("#CLI_TCL_ID_3").is(":checked")
		|| $("#CLI_TCL_ID_13").is(":checked")
	;
}
function type_cat(){
	var res="";
	if(is_candidat()){
		res="candidat";
		//$("#LABEL_CLI_MONTANT_FOND").html("");
		$("#LABEL_CLI_MONTANT_FOND").hide();
		$("#LABEL_CLI_MONTANT_FOND2").hide();
	}else if(is_entrepreneur()){
		res="entrepreneur";
		//$("#LABEL_CLI_MONTANT_FOND").html("Fonds demand&eacute;s");
        $("#LABEL_CLI_MONTANT_FOND").show();
		$("#LABEL_CLI_MONTANT_FOND2").hide();
	}else if(is_investisseur()){
		res="investisseur";
		//$("#LABEL_CLI_MONTANT_FOND").html("Fonds disponibles");
        $("#LABEL_CLI_MONTANT_FOND").hide();
		$("#LABEL_CLI_MONTANT_FOND2").show();
	}else if(is_organisation()){
		res="organisation";
		//$("#LABEL_CLI_MONTANT_FOND").html("");
        $("#LABEL_CLI_MONTANT_FOND").hide();
		$("#LABEL_CLI_MONTANT_FOND2").hide();
	}
	return res;
}
/*****************************
a: choix de la cat
b: secteur marché
c: nom societe + presentation société
c2: description projet
d: experience
e: diplomes
f: business plan
g: previsionnel
h: equipe fondatrice
i: clause confidentialité
fin: valider formulaire
******************************/
var current_tab="a";
var tabs=new Array(
	"a",
	"b",
	"c",
	"d",
	"e",
	"f",
	"g",
	"h",
	"j",
	"k",
	"l1","l2","l3","l4","l5","l6",
	"m1","m2","m3","m4","m5","m6","m7","m8","m9","m10","m11",
	"n",
	"o",
	"o2",
	"fin",
	"info_1",
	"info_2",
	"info_3",
	"info_4",
	"info_5",
	"info_6"
);
var etapes=new Array();
etapes["candidat"]=new Array("a","info_2","info_1","j","g","o","o2","e","fin");
etapes["entrepreneur"]=new Array("a",/*"b","info_3",*/"info_1","j",/*"g","l1","l2",*/"d","l3","c","l4","l5","e","f",/*"h",*/"l6",/*"info_6","k",*/"fin");
etapes["investisseur"]=new Array("a",/*"b","info_4",*/"info_1","j",/*"g","n",*/"e","f","fin");
etapes["organisation"]=new Array("a",/*"b",*/"info_1","m1","m2","m3","m4","m5","m6","m7","m8","m9","m10","m11","fin");
function tab_apres(lettre){
	var qui=type_cat();
	//alert("apres qui: " + qui);
	if(qui!=""){
		var tab = etapes[qui];
		var ok=false;
		for(var j=0;j<tab.length;j++){
			//alert(tab[j]+" "+lettre);
			if(ok){
				switch_tab(tab[j]);
				ok=false;
			}else if(tab[j]==lettre){
				//alert("ok");
				ok=true;
			}
		}
	}else{
		alert("Choisissez une catégorie");
	}
}
function tab_avant(lettre){
	var qui=type_cat();
	//alert("apres qui: " + qui);
	if(qui!=""){
		var tab = etapes[qui];
		var ok="";
		for(var j=0;j<tab.length;j++){
			if(tab[j]==lettre){
				switch_tab(tab[ok]);
				ok="";
			}
			ok=j;
		}
	}else{
		alert("Choisissez une catégorie");
	}
}
$(document).ready(function(){
	var lettre;
	var t;
	for(var i=0;i<tabs.length;i++){
		t=tabs[i];
		lettre = "#inscr_etape_"+t;
		$(lettre+" .etape-suivante").click(function(){
			tab_apres($(this).attr("alt"));
		})
		$(lettre+" .etape-precedente").click(function(){
			tab_avant($(this).attr("alt"));
		})
	}
});
