$(document).ready(function() {

	$('#slider').cycle({
		fx:     'fade', 
 		timeout:  7000
	});

	$('.quotes').cycle({
		fx:     'fade', 
 		timeout:  17000,
 		random:	1,
 		height: 'auto'
	});
	
	$('#magento-web-design-slideshow #slides').cycle({
		fx:     'fade', 
 		timeout:  8000	
	});		

	// Show/Hide Frequently Asked Questions	
	$('.faqs dd').hide();
	$('.faqs dt').hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')}).click(function(){
	  $(this).next().slideToggle('normal');
	});		
		
	// animate affiliate logos
	
	$('.affiliate-logos li').hover(function() { //On hover...

		var thumbOver = $(this).find('img').attr('src'); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).find('a.affiliate-logo').css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

		//Animate the image to 0 opacity (fade it out)
		$(this).find('span').stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find('span').stop().fadeTo('normal', 1).show();
	});	
	
	// add class to first and last 'featured projects' items
	$('ul.featured-projects li:first').addClass('alpha');
	$('ul.featured-projects li:last').addClass('omega');
	
	// add class to first and last list item in the clients list
	$('ul#clients li:nth-child(3n+2)').css('margin-right', 20);
	$('ul#clients li:nth-child(3n+2)').css('margin-left', 20);	
});


