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

        parseQueryString: function() {
        
            var vars = this.split(/[&;]/);
            var rs = {};
            
            if (vars.length) vars.each(function(val) {

                var keys = val.split('=');
                if (keys.length && keys.length == 2) rs[decodeURIComponent(keys[0])] = decodeURIComponent(keys[1]);
            });

            return rs;
        }
    });
		  
		new CrossFadingPresentation('cross-fading-presentation', {transitionDuration: 1000,
                                                                           transitionInterval: 6000,
                                                                           transitionType: Fx.Transitions.linear});
		new SlidingPresentation('carousel', {transitionDuration: 1000,
                                                                           transitionInterval: 2500,
                                                                           transitionType: Fx.Transitions.linear});
var accordion = new Accordion('h3.atStart', 'div.atStart', {
opacity: false
}, $('accordion'));

if($('respond')){
	//then this is an article. 
	if($('openRespond')){
		//check that the link to open it is also there
		var commentForm = $('respond');
		var slide = new Fx.Slide(commentForm,{'link':'cancel'});
		slide.hide();
		
		var openLink = $('openRespond');
		openLink.addEvent('click', function(e){
			e = new Event(e);
			slide.toggle();
			e.stop();
		});
	};
};

if($('cross-fading-presentation')){
	if($('expandPresentation')){
		
		var presentation = $('cross-fading-presentation');
		var slide = new Fx.Tween(presentation);
		slide.set('height',275);
		
		var expandLink = $('expandPresentation');
		expandLink.addEvent('click', function(e){
			e = new Event(e);
			slide.start('height',600);
			e.stop();
		});
	};
};

});