$(document).ready(function() {
	
	// Slideshows ----->
	
	$('#slideshow').cycle({ 
		fx: 'fade',
		speed: 'normal',
		timeout: 0, 
		next: '#slideshow-nav .next', 
		prev: '#slideshow-nav .prev'
	});
	
	$('#slideshow-gallery').cycle({
		fx: 'fade',
		speed: 'normal',
		timeout: 0,
		next: '#slideshow-nav .next', 
		prev: '#slideshow-nav .prev',
		pager: '#slideshow-gallery-thumbs',
		pagerAnchorBuilder: function(idx, slide) {
			if ((idx+1) % 6 == 0) {
				return '<div class="thumb last"><a href="#"><img src="' + slide.src + '" width="100" /></a></div>';
			}
			else {
				return '<div class="thumb"><a href="#"><img src="' + slide.src + '" width="100" /></a></div>';	
			}
		}
    });
	
	// Tooltips ----->
	
	$('img.has-caption[title]').qtip({
		position: {
			target: 'mouse',
			corner: {
				tooltip: 'bottomLeft'
			},
			adjust: {
				screen: true
			}
		},
		style: { 
			width: 220,
			padding: 8,
			background: 'url(http://rachofskyhouse.org/dev/media/site/qtip-bg.png)', // Fallback
			color: '#FFFFFF',
			textAlign: 'left',
			border: {
				width: 0
			}
		}
	})
	
	// Installation image/text hover ----->
	
	$('.installation-image').hover(function() {
		$(this).siblings('.installation-title').children('a').addClass('hover');
	}, function() {
		$(this).siblings('.installation-title').children('a').removeClass('hover');
	});
	
	// Email capture ----->
	
	$(".newsletter-form .input-text").focus(function(){	
		if($(this).val() == 'Email'){
			$(this).val('');
		}
	});

	$(".newsletter-form .input-text").blur(function(){
		if($(this).val() == ''){
			$(this).val('Email');
		}
	});
	
});
