$(document).ready(function(){
	$('#about').hide();
	
	//Full Caption Sliding (Hidden to Visible)
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'10px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
	});
	
	$('ul#filter a').click(function() {
		//hide "about" and "contact" content
		$('#about').hide();
		$('#contact').hide();
		$('section#brands').show();
		
		//show/hide brand logos
		var filterVal = $(this).text().toLowerCase().replace(/\s/g,'-');

		if(filterVal == 'all-brands') {
			$('section#brands>div.hidden').show().removeClass('hidden');
		} else {
			$('section#brands>div').each(function() {
				if(!$(this).hasClass(filterVal)) {
					$(this).hide().addClass('hidden');
				} else {
					$(this).show().removeClass('hidden');
				}
			});
		}
		
		//check for submenu
		if($(this).parent().find('ul').length != 0){
			//show/hide menu below this link
			if($(this).parent().hasClass('down')){
				$(this).parent().removeClass('down').find('ul').slideUp('fast');
			}else{
				$(this).parent().addClass('down').find('ul').slideDown('fast');
			}
		}
		
		//change breadcrumb text
		var btext = $(this).text();
		
		$(this).parents('li').each(function (){
			var stext = $(this).find('a:first').text();
			if(btext != stext){
				btext = stext + ' > ' + btext;
			}
		});

		$('.breadcrumb').text(btext);
		
		return false;
	});
	
	$('a.about').click(function() {
		//show about content
		$('#about').slideDown('fast');
		$('section#brands').hide();
		
		//header text
		$('.breadcrumb').text('COLE Mart - the Wastewater Superstore');
		
		return false;
	});
	
	console.log(page + " balh");
	//check for page variable
	if(page == "about"){
		//initiate click
		$('#about').show();
		$('section#brands').hide();
		
		//header text
		$('.breadcrumb').text('COLE Mart - the Wastewater Superstore');
	}
});
