$(document).ready(function() {
	
	$('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });

	$(".gal-pw").hover(function(){ var text1 = $('h4',this).text() == 'Patios and Walkways' ? 'Click to view Gallery' : 'Patios and Walkways';
		$('h4', this)
		.text(text1)	});
	$(".gal-dw").hover(function(){ var text2 = $('h4',this).text() == 'Driveways' ? 'Click to view Gallery' : 'Driveways';
		$('h4', this)
		.text(text2)	});
	$(".gal-pc").hover(function(){ var text3 = $('h4',this).text() == 'Patterns and Colors' ? 'Click to view Gallery' : 'Patterns and Colors';
		$('h4', this)
		.text(text3)	});
	  
	// process and gallery  
	$(".process-content, .gallery-content").hide(); //Hide all content
	$("ul.process li:first, ul.gallery li:first").addClass("active").show(); //Activate first tab
	$(".process-content:first, .gallery-content:first").show(); //Show first tab content

	$("ul.process li").click(function() {
		$("ul.process li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".process-content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	$("ul.gallery li").click(function() {
		$("ul.gallery li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".gallery-content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	
    $(".gal-pw").click(function() {
		$.fancybox([
			{ 'href'	: 'images/galleries/patios-walkways/pw1.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw2.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw3.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw4.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw5.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw6.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw7.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw8.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw9.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw10.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw11.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw12.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw13.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw14.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw15.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw16.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw17.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw18.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw19.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw20.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw21.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw22.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw23.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw24.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw25.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw26.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw27.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw28.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw29.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw30.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw31.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw32.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw33.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw34.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw35.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw36.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw37.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw38.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw39.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw40.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw41.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw42.jpg' },
			{ 'href'	: 'images/galleries/patios-walkways/pw43.jpg' }
		], {
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
			}			
		});
	});

    $(".gal-dw").click(function() {
		$.fancybox([
			{ 'href'	: 'images/galleries/driveways/dw1.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw2.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw3.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw4.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw5.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw6.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw7.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw8.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw9.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw10.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw11.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw12.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw13.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw14.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw15.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw16.jpg' },
			{ 'href'	: 'images/galleries/driveways/dw17.jpg' }
		], {
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
			}			
		});
	});

    $(".gal-pc").click(function() {
		$.fancybox([
			{ 'href'	: 'images/galleries/colors-patterns/cp1.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp2.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp3.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp4.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp5.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp6.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp7.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp8.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp9.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp10.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp11.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp12.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp13.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp14.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp15.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp16.jpg' },
			{ 'href'	: 'images/galleries/colors-patterns/cp17.jpg' }
		], {
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
			}			
		});
	});

	$("a.gallery-fb").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
			}			
	});
		$('.gallery-content a:nth-child(4n)').addClass('last');

});
