window.addEvent('domready', function() {

	//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), 'h3.toggler', 'div.element', {
		opacity: false,
		onActive: function(toggler, element) {
			toggler.setStyle('backgroundColor', mod_marketplace_colour_active);
		},
		onBackground: function(toggler, element) {
			toggler.setStyle('backgroundColor', mod_marketplace_colour_inactive);
		}
	});
});

function marketplace_active(tab) {
	if(atab = document.getElementById('jobs_tab')) {atab.className = ''; atab.style.backgroundColor = mod_marketplace_colour_inactive;}
	if(atab = document.getElementById('classified_tab')) {atab.className = ''; atab.style.backgroundColor = mod_marketplace_colour_inactive;}
	if(atab = document.getElementById('buyersguide_tab')) {atab.className = ''; atab.style.backgroundColor = mod_marketplace_colour_inactive;}
	if(atab = document.getElementById('html_tab')) {atab.className = ''; atab.style.backgroundColor = mod_marketplace_colour_inactive;}

	document.getElementById(tab + '_tab').className = 'active';
	if(mod_marketplace_colour_active) document.getElementById(tab + '_tab').style.backgroundColor = mod_marketplace_colour_active;

	if(content = document.getElementById('jobs_content')) content.style.display = 'none';
	if(content = document.getElementById('classified_content')) content.style.display = 'none';
	if(content = document.getElementById('buyersguide_content')) content.style.display = 'none';
	if(content = document.getElementById('html_content')) content.style.display = 'none';
	document.getElementById(tab + '_content').style.display = 'block';

}
