// Do all of this stuff after the page has loaded.
window.addEvent('domready', function(){
	
	DD_roundies.addRule('h2.coltop', '10px 0 0 0', true);
	DD_roundies.addRule('#featured_story', '10px 0 10px 0', true);
	
	// Remove 'click' for homepage headings
	$$('.col h2 a').each(function(item){
		item.addEvent('click', function(e){
			e = new Event(e).stop();
		});
	});
	
	// Set tabindex for column contents so we can set focus to them later.
	$$('div.col_content').each(function(item){
		item.setProperty('tabindex','-1');
	});
	
	// Initiate the accordians on homepage
	var accordion = new Accordion('#col1 h2 a', '#col1 div.content', {
		alwaysHide:true,
		onActive: accordionAcive,
		onBackground: function(toggler, element){
			toggler.setProperty('class','');
		}
	});
	var accordion2 = new Accordion('#col2 h2 a', '#col2 div.content', {
		alwaysHide:true,
		onActive: accordionAcive,
		onBackground: function(toggler, element){
			toggler.setProperty('class','');
		}
	});
	
	(function() {
	
	var accordion3 = new Accordion('#col3 h2 a', '#col3 div.content', {
		alwaysHide:true,
		onActive: accordionAcive,
		onBackground: function(toggler, element){
			toggler.setProperty('class','');
		},
		onComplete: function(){
	        //this.display(1).delay(1000);
	    },
	    show: 1
	});
	}).delay(50);

});

function accordionAcive(toggler, element)
{
	// If it's the active option, give it a background and make it visible to keyboard/screen readers
	toggler.setProperty('class','active');
	
	var logOpen = new Request.HTML().get('/tabs/' + toggler.name);

}