window.addEvent('domready', function() {

	(function(){
		
		//Set the active tab and insert the required css based on directory name
		
		try{$E('.'+section()).addClass('here');}catch(e){};
		
		function section(){
			var name = location.pathname;
			//alert(name); 
			name=unescape(name.slice(0,name.lastIndexOf('/',name.length-1)));
			name=name.slice(name.lastIndexOf('/')+1, name.length);
            //alert(name);                      
			if(name==""){
				name='home';
				if(window.ie7){
					new Asset.css('/styles/ie7.css');
				}
				if(navigator.platform.toLowerCase().match('mac')){
					$E('#products div img').setStyle('top', '-14px');
					$E('#laundry_tips div img').setStyle('top', '-10px');
				}	
			}
			
			new Asset.css('/styles/'+name+'.css');
			
			return name;
			
		}
		
	})();
	
	//Extend the Mootools Acordian Class so that you can close and open all items
	
	Accordion.implement({
		showAll: function() {
			var obj = {};
			this.previous = -1;
			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;
			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);
		}
	});
});