function switch_sub_menu(tid){
	if(document.getElementById(tid).style.display=='none'){
		new Effect.SlideDown(tid,{duration:0.3});
	}
	else{
		new Effect.SlideUp(tid,{duration:0.3});
	}
}

function load_page(){
	toto=true;
	/*
	if(load_page.arguments.length<3 || load_page.arguments[2]=='' || load_page.arguments[2]==false){
	if(save){
	toto=false;
	toto=confirm("Are you sure you don't want to save the datas?");
	if(toto){
	save=false;
	}
	}
	}
	*/
	if(toto){
		thediv='content';
		if(load_page.arguments.length>1 && load_page.arguments[1]!=''){
			thediv=load_page.arguments[1];
		}
		document.getElementById(thediv).innerHTML='<img src="img/indicator.gif" width="16" height="16" border="0" />';
		//alert(load_page.arguments[0]);
		new Ajax.Updater(thediv,'/' + load_page.arguments[0] ,{method:'get', asynchronous:true, evalScripts:true});

	}
}

function send_form(form_name, targ, blo){
	datas='';
	save=false;
	for(i=0; i < document.getElementById(form_name).length;i++){
		if(datas!=''){
			datas = datas + '&';
		}
		datas = datas + URLencode(document.getElementById(form_name).elements[i].name) + '=' + URLencode(document.getElementById(form_name).elements[i].value);
	}
	new Ajax.Updater(blo ,'/' + targ ,{method:'post' , postBody: datas , asynchronous:true, evalScripts:true});
}

function URLencode(sStr) {
	return escape(sStr).
	replace(/\+/g, '%2B').
	replace(/\"/g,'%22').
	replace(/\'/g, '%27').
	replace(/\//g,'%2F');
}

function selection(){
	document.the_form.todo.value='';
	document.the_form.submit();
}

function del_user(id){
	var toto=false;
	toto=confirm("Etes vous certain de vouloir effacer cette entrée? Cette action est irreversible.");
	if(toto){
		document.the_form.del.value='delete';
		document.the_form.id.value=id;
		document.the_form.submit();
	}
}

function sortir(){
	document.log_out_form.todo.value='logout';
	document.log_out_form.submit();
}

function activ(id){
	document.the_form.del.value='active';
	document.the_form.id.value=id;
	document.the_form.submit();
}

function deactiv(id){
	document.the_form.del.value='deactive';
	document.the_form.id.value=id;
	document.the_form.submit();
}
