var Site = {

	start: function(waited) {
		if($('product-categories')) Site.productCategoriesSlidey();
		else if (waited == null) setTimeout("Site.start(1)", 100);
	},
	
	productCategoriesSlidey: function() {
		var slidey = new Fx.Slide('product-categories');
		if (document.getElementById('product-categories').className != "expanded") {
			slidey.hide();
			
		} else {
			$('product-categories-open').setStyles({
				backgroundPosition: 'left bottom',
				cursor: 'default'
			});
		}
		
		function openSlidey() {
			$('product-categories-open').setStyles({
				backgroundPosition: 'left bottom',
				cursor: 'default'
			});
			slidey.slideIn();
		}

		$('product-categories-open').addEvent('click', function(e){
			e = new Event(e);
			openSlidey();
			e.stop();
		});
		
		$('product-categories-close').addEvent('click', function(e){
			e = new Event(e);
			slidey.slideOut().chain(function() {
				$('product-categories-open').setStyles({
					backgroundPosition: 'left top',
					cursor: 'pointer'
				});
			});
			e.stop();
		});
	}

};

window.addEvent('domready', Site.start);