/**
 * toggle FAQ Items
 *
 * @param id 		the id of the FAQ item to hide or show
 * @param single	true to show only one item at a time, false the open as many as you want
 */
 
var faqDuration = 1;

function toggleFaq(id, single, hash) {	
		
	if(single) {
		//show only one Q+A at a time
		toggleAll(false, hash);		
		showHideFaq(id, true, hash);
	}
	else {
		//open as many Q+A as you like	
		if(document.getElementById('irfaq_a_'+id+'_'+hash).style.display == 'none') {
			showHideFaq(id, true, hash);
		}
		else {
			showHideFaq(id, false, hash);
		}			
	}	
}

/**
 * shows or hides a FAQ item at a time depending on the given status
 *
 * @param id 		the id of the FAQ item to hide or show
 * @param status	true to show the item, false to hide it
 */
function showHideFaq(id, status, hash, all) {
	if (all == undefined) all=false;
	var faq_id = 'irfaq_a_'+id+'_'+hash; //answer
	var pm_id  = 'irfaq_pm_'+id+'_'+hash; // plus/minus icon
	/* ***** aemka edit start ***** */
	var i = 1; //counter
	
	if (status) {
		if (! all) {
		while (document.getElementById('irfaq_q_'+i+'_'+hash)) {
			if (i!=id)
			  document.getElementById('irfaq_q_'+i+'_'+hash).style.display = 'none';
			  //Effect.Fade('irfaq_q_'+i+'_'+hash, {duration: faqDuration, afterFinish:function(){inProgress = false;}});
			++i;
			}
		}
		document.getElementById(faq_id).style.display = 'inline';
		//Effect.BlindDown(faq_id, {duration: faqDuration, afterFinish:function(){inProgress = false;}}); 
		document.getElementById(pm_id).src = tx_irfaq_pi1_iconMinus;
	}
	else {
		if (! all) {
		while (document.getElementById('irfaq_q_'+i+'_'+hash)) {
			if (i!=id)
			  document.getElementById('irfaq_q_'+i+'_'+hash).style.display = 'block';
			  //Effect.Appear('irfaq_q_'+i+'_'+hash, {duration: faqDuration, afterFinish:function(){inProgress = false;}});
			++i;
			}
		}
		document.getElementById(faq_id).style.display = 'none';	
		//Effect.BlindUp(faq_id, {duration: faqDuration, afterFinish:function(){inProgress = false;}});
		document.getElementById(pm_id).src = tx_irfaq_pi1_iconPlus;
	}
	/* ***** aemka edit stop ***** */
}

/**
 * shows or hides all FAQ items with one click
 *
 * @param mode	true to show the items, false to hide them
 */
function toggleAll(mode, hash, count) {
	/* ***** aemka edit start ***** */
	for (j=1 ;j<=count; ++j) {
		if (mode) {
			document.getElementById('irfaq_q_'+j+'_'+hash).style.display = 'block';
			//Effect.Appear('irfaq_q_'+j+'_'+hash, {duration: faqDuration, afterFinish:function(){inProgress = false;}});
			document.getElementById('irfaq_a_'+j+'_'+hash).style.display = 'inline';
			//Effect.BlindDown('irfaq_a_'+j+'_'+hash, {duration: faqDuration, afterFinish:function(){inProgress = false;}}); 
			document.getElementById('irfaq_pm_'+j+'_'+hash).src = tx_irfaq_pi1_iconMinus;
		}
		else {
			document.getElementById('irfaq_q_'+j+'_'+hash).style.display = 'block';
			//Effect.Appear('irfaq_q_'+j+'_'+hash, {duration: faqDuration, afterFinish:function(){inProgress = false;}});
			document.getElementById('irfaq_a_'+j+'_'+hash).style.display = 'none';	
			//Effect.BlindUp('irfaq_a_'+j+'_'+hash, {duration: faqDuration, afterFinish:function(){inProgress = false;}});
			document.getElementById('irfaq_pm_'+j+'_'+hash).src = tx_irfaq_pi1_iconPlus;
		}
	}				
	/* ***** aemka edit stop ***** */
}