/**
 * toggle Lien Items
 *
 * @param id 		the id of the Lien item to hide or show
 * @param single	true to show only one item at a time, false the open as many as you want
 */
function toggleLien(id, single, hash) {	
		
	if(single) {
		//show only one Q+A at a time
		toggleAll(false, hash);		
		showHideLien(id, true, hash);
	}
	else {
		//open as many Q+A as you like		
		if(document.getElementById('lien_a_'+id+'_'+hash)){
			if(document.getElementById('lien_a_'+id+'_'+hash).style.display == 'none') {
				showHideLien(id, true, hash);
			}
			else {
				showHideLien(id, false, hash);
			}
		}			
	}	
}

/**
 * shows or hides a Lien item at a time depending on the given status
 *
 * @param id 		the id of the Lien item to hide or show
 * @param status	true to show the item, false to hide it
 */
function showHideLien(id, status, hash) {
	var Lien_id = 'lien_a_'+id+'_'+hash; //answer
	var pm_id  = 'lien_pm_'+id+'_'+hash; // plus/minus icon
	
	if(status) {
		if(document.getElementById(Lien_id)) document.getElementById(Lien_id).style.display = 'inline';
		if(document.getElementById(pm_id)) document.getElementById(pm_id).src = tx_liens_pi1_iconMinus;
	}
	else {
		if(document.getElementById(Lien_id)) document.getElementById(Lien_id).style.display = 'none';	
		if(document.getElementById(pm_id)) document.getElementById(pm_id).src = tx_liens_pi1_iconPlus;
	}
}

/**
 * shows or hides all Lien items with one click
 *
 * @param mode	true to show the items, false to hide them
 */
function toggleAll(mode, hash, count) {
	for(i = 0; i < count; i++) {
		showHideLien(i+1, mode, hash);
	}				
}
