function bouton_modifier() {
	hide("but_modifier");
	hide("afficher");
	hide("ajouter");
	showblock("cache_modifier");
	showblock("modifier");
}

function cache_modifier() {
	hide("cache_modifier");
	hide("modifier");
	showblock("but_modifier");
	showblock("afficher");
	showblock("ajouter");
}

function changetype() {
	var ids = new Array('extra0','extra10','extra20','extra30');
	var type = getSelectValue('select_type');
	switchid("extra"+type, ids);
}

function getSelectValue(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		var index = document.getElementById(id).selectedIndex;
		return document.getElementById(id).options[index].value;
	}
	else {
		if (document.layers) { // Netscape 4
			return document.id.options[document.id.selectedIndex].value;
		}
		else { // IE 4
			return document.all.id.options[document.all.id.selectedIndex].value;
		}
	}
}

function switchid(id, ids) {	
	hideallids(ids);
	for (var i in ids) {
		if (ids[i] == id) {
			showtr(id);
			break;
		}
	}
	// Cacher image pour dossiers
	if (id == 'extra0') {
		hide('limage');
	}
	else {
		showtr('limage');
	}
}

function hideallids(ids) {
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hide(ids[i]);
	}		  
}

function hide(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showtr(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'table-row';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'table-row';
		}
		else { // IE 4
			document.all.id.style.display = 'table-row';
		}
	}
}

function showblock(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


