window.addEvent('domready',function(){
	window.fireEvent('asvRefresh');
});

function autoCorrectURL(selector, preserveClass){
	$$(selector).each(function(el){
		if(el.hasClass(preserveClass)==false) 
		    el.setProperty('href',el.getProperty('href').replace('index.php', 'index2.php'));
	});
}
function SmoothToolTips(selector){
	$$('.asv_tips'+selector).each(function(el){	el.setProperty('title2', el.title); }); // pour slimbox
	return new Tips($$('.asv_tips'+selector), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 400, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	});
}

Accordion.implement({
    showAll: function() {
        var obj = {};
        this.previous = -1;                  //  Added this line
        this.elements.each(function(el, i){
            obj[i] = {};
            this.fireEvent('onActive', [this.togglers[i], el]);
            for (var fx in this.effects) obj[i][fx] = el[this.effects[fx]];
        }, this);
        return this.start(obj);
    },
    hideAll: function() {
        var obj = {};
        this.previous = -1;                  //  Added this line
        this.elements.each(function(el, i){
            obj[i] = {};
            this.fireEvent('onBackground', [this.togglers[i], el]);
            for (var fx in this.effects) obj[i][fx] = 0;
        }, this);
        return this.start(obj);
    }
});
