$(document).ready(function() {
	// Most fonts
	Cufon.replace('.home h2.title, .white h2.title, #twitter h3.title span, h1.title, body.forum table th, #post_comment .header .title, body.events table th, #store.white .section.categories .listing li a, body.events .section.event.venue .header .title, .section.campaign.terms .title, .store #store .section.categories .listing .item span, #profilelist #comments > .header .title');
	
	// Child nav elements
	Cufon.replace('.navigation .child a',{
		hover: true
	});
	
	// Small titles /w gradient
	Cufon.replace('.section .header h4.title',{
		color: '-linear-gradient(#f7e9c7, #000)'
	});
	
	// Album Art gallery
	$('.section.extras.media .details a').fancybox();
	
	// Featured news carousel
	
	if(jQuery().scrollable) {
		$(".news.featured").scrollable({
			items : ".listing", 
			easing : "swing"
		});
	}
	
	roachDash();
	
	function roachDash() {

		//get ref
		if ($('#roachDashboard')) var el = $('#roachDashboard');
		else return;
	
		//respect choice
		if (!el.find('a.toggle')) return; //if they're not logged in, there won't be this button
		el.find('a.toggle').click(toggleRoachDash);
		el.data('offset', el.css('margin-left'));
		if ($.cookie('dashboard_open') == 1) {
			el.css('margin-left','0px');
			el.data('open', 1);
		}
	}
	
	function toggleRoachDash(event) {
	
		//get element
		event.preventDefault();
		var el = $('#roachDashboard');
	
		//close
		if (el.data('open') == 1) {
			$('#roachDashboard').animate({marginLeft: el.data('offset')}, 300);
			el.data('open', 0);
		
		//open
		} else {
			$('#roachDashboard').animate({marginLeft: '0px'}, 300);
			el.data('open', 1);
		}
	
		//save state
		$.cookie('dashboard_open', el.data('open'), { expires: 14, path: '/' });
	}

    // Add a Banner To The Store
    

    var storeCats = $('.categories .detail'),
        storeBanner = $('<span class="store_ad"><img src="http://groundctrl.s3.amazonaws.com/clients/papa_roach/store/sidebar_ad.jpg" /></span>');

    storeCats.append( storeBanner );

});
