$(document).ready(function(){
	
	//#boxes
	$('.fourbox').hover(function(){
		$(this)
			.click(function(){
				document.location = $(this).find('a:eq(0)').attr('href');						 
			})
			.addClass('hover')
			.css('cursor', 'pointer')
	}, function(){
		$(this).removeClass('hover');
	});
	
	//#quotes
	$('#quotesCycle, .quotesCycle').cycle({
		fx: 'fade',
		timeout: 10000,
		random: 1
	});
	
	//#header
	if ($('#header li').size() > 0){
		$('#header').cycle({
			fx: 'fade',
			delay: 4000
		});
	}
	
	//gallery
	if ($("#album-pg").length > 0){
		var gallery = $('#thumbs').galleriffic({
			delay:                     2500,
			numThumbs:                 12,
			preloadAhead:              10,
			enableTopPager:            true,
			enableBottomPager:         false,
			maxPagesToShow:            10,
			imageContainerSel:         '#slideshow',
			controlsContainerSel:      '#controls',
			captionContainerSel:       '#caption',
			loadingContainerSel:       '#loading',
			renderSSControls:          false,
			renderNavControls:         true,
			playLinkText:              'Play Slideshow',
			pauseLinkText:             'Pause Slideshow',
			prevLinkText:              'Prev',
			nextLinkText:              'Next',
			nextPageLinkText:          'More Images',
			prevPageLinkText:          'Prev Images',
			enableHistory:             false,
			autoStart:                 false,
			syncTransitions:           true,
			defaultTransitionDuration: 900,
			onPageTransitionOut:       function(callback) {
				this.fadeTo('fast', 0.0, callback);
			},
			onPageTransitionIn:        function() {
				this.fadeTo('fast', 1.0);
			}
		});
	}
	
	//contact maps
	if ($('.node-contact').size() > 0){
		$('#brentwoodmap').colorbox({
			title: '<p><strong class="office">Head Office, Brentwood</strong> <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Essex+CM13+1TJ&aq=&sll=52.059127,1.158156&sspn=0.007903,0.030899&ie=UTF8&hq=&hnear=Brentwood,+Essex+CM13+1TJ,+United+Kingdom&z=16" target="_blank">View location on Google Maps</a></p>',
			opacity: .7,
			speed: 600,
			initialWidth: 320,
			intitialHeight: 400
		});
		$('#londonmap').colorbox({
			title: '<p><strong class="office">Central London Office</strong> <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=London+W1J+8DJ&aq=&sll=51.637695,0.356302&sspn=0.007977,0.030899&ie=UTF8&hq=&hnear=London+W1J+8DJ,+United+Kingdom&z=16" target="_blank">View location on Google Maps</a></p>',
			opacity: .7,
			speed: 600,
			initialWidth: 320,
			intitialHeight: 400
		});
		$('#kentmap').colorbox({
			title: '<p><strong class="office">Chislehurst Office, Kent</strong> <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Kent+BR7+6LH&aq=&sll=51.507473,-0.142045&sspn=0.008,0.030899&ie=UTF8&hq=&hnear=Chislehurst,+Kent+BR7+6LH,+United+Kingdom&ll=51.413233,0.077934&spn=0.008016,0.030899&z=16" target="_blank">View location on Google Maps</a></p>',
			opacity: .7,
			speed: 600,
			initialWidth: 320,
			intitialHeight: 400
		});
		$('#ipswichmap').colorbox({
			title: '<p><strong class="office">Ipswich Office</strong> <a href="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=Suffolk+IP4+2BN&sll=53.800651,-4.064941&sspn=15.581897,46.538086&ie=UTF8&hq=&hnear=Ipswich,+Suffolk+IP4+2BN,+United+Kingdom&ll=52.059127,1.158156&spn=0.007903,0.030899&z=16" target="_blank">View location on Google Maps</a></p>',
			opacity: .7,
			speed: 600,
			initialWidth: 320,
			intitialHeight: 400
		});
	}

});
