/*
combine this with kitebox for single HTTP request
same for for gallery and products pages
*/
YAHOO.util.Event.onDOMReady(function() {
	var con = $('galleryContainer');	//Gallery
	if(!con) con = $('stockList');		//Catalogue
	var kb = new KiteBox(con);
});

/* Combine with Brand Select for HTTP performance */
var brands = {
	
	init : function() {
		if(!$D.hasClass('brandContainer', 'noCollapse')) {
			$('brandContainer').style.display = 'none';
			YAHOO.util.Dom.addClass('brandToggle', 'clickable');
			YAHOO.util.Event.on('brandToggle', 'click', brands.toggleBrands);
		}
	},
	
	/**
	* Toggle Visibility of Brand Selector List
	* @param event ev click event
	*/
	toggleBrands : function(ev) {
		
		var c = $('brandContainer');
		
		//Show Brands
		if(c.style.display == 'none') {
			c.style.display = 'block';
			c.style.height = 'auto'; //Animate this
			
			var anim = new YAHOO.util.ColorAnim(
				c, 
				{
					backgroundColor: {to: '#dab85e'}
				},
				0.6
			);
			anim.animate();
		}
		
		//Hide Brands 
		else {
			c.style.display = 'none';
			c.style.backgroundColor = '#a87812'; //revert
		}
	}
};
var brandContainer = $('brandContainer');
if(brandContainer && brandContainer.parentNode) YAHOO.util.Event.onDOMReady(brands.init);