$(function() {
	
	// to prevent FOUC (Flash of Unstyled Content)
	$('body').addClass('js-enabled');
	
	// check if the container exists where all the magic happens
	if ($('#container_home').length) {
		
		// remove the class from our container that sets the background image for the js enabled
		$("#container_home").attr("class", "");
		
		// add our banners to the DOM
		$.each(cycleImages, function() {
			$('<img id="' + this.id +'" src="'+ this.src +'" />').appendTo("#rotator");
		});
		
		// spin the wheel
		$('#rotator').cycle({
			//fx:    'scrollDown',
			sync:   true,
			delay: -2000,
			speed: 200,
			// after each cycle, activate the corresponding quote
			after: function() {
				$('#quotes')
					.find('blockquote.selected').removeClass('selected')
					.end()
					.find('blockquote#quote_' + $(this).attr('id')).addClass('selected')
				;
				
				// Cufonize our quotes
				Cufon.replace('blockquote', {fontFamily:'Meta'});
			}
		});
	}
});