

function changeDisplay(elem){
	
	
	if(displayed != null){
		document.getElementById(displayed).style.display = 'none'}
	
	displayed = elem;
	document.getElementById(elem).style.display = 'block';

}

function toggleYear(id, single, hash) {	
	
		
	if(single) {
		//show only one Q+A at a time
		toggleAll(false, hash);		
		showHide(id, true, hash);
	}
	else {
		//open as many Q+A as you like		
		if(document.getElementById('listnews_'+id+'_'+hash).style.display != 'none') {
			showHideYear(id, false, hash);
		}
		else {
			showHideYear(id, true, hash);
		}			
	}	
}

/**
 * shows or hides a Year item at a time depending on the given status
 *
 * @param id 		the id of the Year item to hide or show
 * @param status	true to show the item, false to hide it
 */
function showHideYear(id, status, hash) {
	var Year_id = 'listnews_'+id+'_'+hash; //answer
	var pm_id  = 'irnews_'+id+'_'+hash; // plus/minus icon
	var tx_irYear_pi1_iconMinus = '/images/software/minus.gif';
	var tx_irYear_pi1_iconPlus = '/images/software/plus.gif';
	
	if(status) {
		document.getElementById(Year_id).style.display = 'block';
		document.getElementById(pm_id).src = tx_irYear_pi1_iconMinus;
	}
	else {
		document.getElementById(Year_id).style.display = 'none';	
		document.getElementById(pm_id).src = tx_irYear_pi1_iconPlus;
	}
}

/**
 * shows or hides all Year 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++) {
		showHideYear(i+1, mode, hash);
	}				
}
