$(document).ready(function(){

	$('#services').mouseover(function(){
		$('#dropDown').fadeIn(250);
	});
	$('#services').mouseleave(function(){
		$('#dropDown').fadeOut(250);
	});	

    // rotate quotes
    $(function() {
        var current_quote = 0;        
        $("#quote" + current_quote).fadeIn(2500);
        setInterval(function() {
            $("#quote" + current_quote).fadeOut(2500, function() {
                current_quote++;
                if (current_quote + 1 > $("#quotes p").length) current_quote = 0;
                $("#quote" + current_quote).fadeIn(2500);
            });
        }, 12000);
    });


//Initialize All Data for Each Portfolio Item
$(".samples .display").each(function(i) {

$(this).find('.pictureContainer:first').fadeIn(350);

var imgs = $(this).children('.pictureContainer');

var num_imgs = imgs.length;

var active = 0;

$(this).data('imgs', imgs);
$(this).data('num_imgs', num_imgs);
$(this).data('active', active);

});



$('.leftButton, .rightButton').click(function() {

	var parent = $(this).parents('.samples .display'),
	active = parent.data('active');
	
	if ($(this).hasClass('rightButton')) {
		$(parent.data("imgs")[active]).fadeOut(350, function() {
		parent.data("active", ++active % parent.data("num_imgs"));
		$(parent.data("imgs")[parent.data("active")]).fadeIn(350);
		});
		
	} else if ($(this).hasClass('leftButton')) {
		$(parent.data("imgs")[active]).fadeOut(350, function() {
		parent.data("active", Math.abs(--active % parent.data("num_imgs")));
		$(parent.data("imgs")[parent.data("active")]).fadeIn(350);
		});
	} else {
		var thisCircle = $(this);
		$(parent.data("imgs")[active]).fadeOut(350, function() {
		parent.data("active", thisCircle.attr('class').substring(13));
		$(parent.data("imgs")[parent.data("active")]).fadeIn(350);
		 });
	}
});


}); //end doc ready
