function show_faq(id, display) {
	var question_obj = document.getElementById("q" + id);
	var answer_obj = document.getElementById("a" + id);

	if (answer_obj != null && question_obj != null) {
		if ( typeof( display ) == "undefined" ) {
			if (answer_obj.style.display == "none") {
				answer_obj.style.display = "block";
			} else {
				answer_obj.style.display = "none";
			}
		} else {
			if ( display ) {
				answer_obj.style.display = "block";
			} else {
				answer_obj.style.display = "none";
			}
		}
	}
}

var expanded = false;
var icominus = '<img src="' + static_path + 'img/ico-minus.gif" width="16" height="16"  border="0" alt="Hide All" title="Hide All">';
var icoplus = '<img src="' + static_path + 'img/ico-plus.gif" width="16" height="16"  border="0" alt="Expand All" title="Expand All">';

function show_all_faqs(count) {
	if ( expanded ) {
		$('#expand_all_link').html(icoplus);
		expanded = false;
	} else {
		$('#expand_all_link').html(icominus);
		expanded = true;
	}
	for( i = 1; i <= count; i++ ) {
		show_faq(i, expanded);		
	}
}

//If article id setted open answer of this question
var opened_article_id = "";
if (opened_article_id != "{" + "article_id" + "}" && opened_article_id > 0) {
	toggle_block_visibility(opened_article_id);
}

$(document).ready(function() {
	$('#expand_all_link').html(icoplus);
});
