// Aon faqlist
// Created by Juda van Mourik, 2008
// Only to be used in Aon Products

function submitMe(url){
	if (url.value!=""){
		url = 'GetVragenAction.do?themaid='+url.value;
		document.themaForm.action=url;
		document.themaForm.submit();
	}
}

function closeAll(container){
	$(container).find("img").attr("src","images/icons/toggler_plus.gif");
	$(container).find("dd").hide();	
}

// options are not implemented in this release
jQuery.fn.aonfaqlist = function(options) {

	// Create a styling div
	$("select").wrap("<div class=\"selector\"></div>");

	// Generate change action
	$(this).find("select").change(function() {
		submitMe(this);
	});
	
	var container = this;
	
	// Don;t show any at startup
	closeAll(container);
	
	// Show one faq
	$(this).find("dl dt").click(function() {
		closeAll(container);
		if ($(this).attr("expanded") == "true") {
			$(this).find("img").attr("src","images/icons/toggler_plus.gif");
			$(this).next('dd').hide();
			$(this).attr("expanded", "false");
		} else {
			$(this).find("img").attr("src","images/icons/toggler_minus.gif");
			$(this).next('dd').show();
			$(this).attr("expanded", "true");
		}
	});
}