$(document).ready(function() {	
	// homepage image fade					   
	$('#masthead').innerfade({ 
		speed: 4000, 
		timeout: 4000, 
		containerheight: '424px' 
	});
	// client page image fade
	$('.galleryid-18').innerfade({ 
		speed: 4000, 
		timeout: 4000, 
		containerheight: '159px' 
	});
	// project page hover animation	
	$('#contact-pics li').hover(function () {
		$('.picTxt', this).stop().animate({ top: '0px' }, { queue: false, duration: 400 });
	}, function () {
		$('.picTxt', this).stop().animate({ top: '155px' }, { queue: false, duration: 1000 });
	});
	// project page hover animation	
	$('#projects li').hover(function () {
		$('.projectTxt', this).stop().animate({ top: '0px' }, { queue: false, duration: 400 });
	}, function () {
		$('.projectTxt', this).stop().animate({ top: '155px' }, { queue: false, duration: 1000 });
	});
	// share drop down in share bar - top
	$('#share a').click(function() {
		$('#shareOptions').slideToggle();
		$(this).toggleClass('minus');
		return false;
	});
	// share drop downs on post index page
	$('.sharePostLink').click(function() {
		$(this).next().slideToggle();							   	
		//$next('.sharePostOptions').slideToggle();
		$(this).toggleClass('sharePostLinkMinus');
		return false;
	});
	// newsletter tickboxes should be ticked on page load
	//$('input[type=checkbox]').attr('checked', true);
	$('input[name="checkbox-656[]"]').attr('checked', true);
	$('input[name="checkbox-588[]"]').attr('checked', false);
	$('#address').hide();
	// clicking tickbox parent will also tick the box!
	// depending on what tick box you select will result in what form elements are displayed
	$('input[name="checkbox-656[]"]').click(function() {
        if ( $('input[name="checkbox-656[]"]:checked').length > 0) {
            $('#email').slideDown();
        } else {
            $('#email').slideUp();
        }
    }); 	
	$('input[name="checkbox-588[]"]').click(function() {
        if ( $('input[name="checkbox-588[]"]:checked').length > 0) {
            $('#address').slideDown();
        } else {
            $('#address').slideUp();
        }
    }); 	
	$("#projects li").click(function(event) { 
		window.location = $(this).find("a").attr("href");
		return false;
	}); 
	$("#contact-pics li").click(function(event) { 
		window.location = $(this).find("a").attr("href");
		return false;
	}); 
});
