
function toggleDiv(id) {
	$('#'+id).slideToggle("fast");
}

function toggleTab(id, idx) {
	var tabElem = $('#'+id+idx);
	var labelElem = $('#'+id+idx+'_label');
	
	if (tabElem.css('display') != 'none') {
		tabElem.hide();
		labelElem.css('backgroundColor', '');
	} else {
		$('#more_infos_tab .tab').each(function () {
			var elem = $(this);
			if (elem.css('display') != 'none') {
				elem.hide();
				var otherLabelElem = $('#'+this.id+'_label');
				otherLabelElem.css('backgroundColor', '');
			}
		});
		
		tabElem.show();
		labelElem.css('backgroundColor', tabElem.css('backgroundColor'));
	}
}

function selectPrMaterialKategorie(elem, base) {
	if (elem.value > 0) {
		document.location.href = base+"pr_material/"+escape(elem.value);
	}
}

function selectPartnerMaterialKategorie(elem, base) {
	if (elem.value > 0) {
		document.location.href = base+"partner/"+escape(elem.value);
	}
}

if ($) {
	$(document).ready(function() {
		$(".more_infos .tab").hide();
		$([1, 2]).each(function () {
			$("#more_infos_tab"+this+"_label a").attr("href", "javascript:toggleTab('more_infos_tab', "+this+");");
		});
		
		$(".answer_hidden").hide();
		$(".question a").each(function(i) {
			id = $(this).attr("href");
			if (id) {
				id = id.substr(1);
				$(this).attr("href", "javascript:toggleDiv('"+id+"');");
			}
		});
	});
}
