function slideSwitch(direction) {
	var $active = $('#slide_bathroom .singleslide.active') || $('#slide_bathroom .singleslide:first-child');

	if ( $active.length == 0 ) $active = $('#slide_bathroom .singleslide:first-child');

	// use this to pull the images in the order they appear in the markup
	if(direction == "next"){
		var $next = $active.next().length ? $active.next() : $('#slide_bathroom .singleslide:first-child');
	}
	else if(direction == "prev"){
		var $next =  $active.prev().length ? $active.prev() : $('#slide_bathroom .singleslide:last-child');
	}
	else {
		var $next = $('#slide_bathroom .singleslide:nth-child('+direction+')');
	}
	
	if($next.is('.active')) { return; }
	
	$active.removeClass('active').addClass('last-active');

	$('.markers a')
		.removeClass('active')
		.filter('[data-pos='+$next.attr('data-pos')+']')
		.addClass('active')
		;
	$next
		.find('h2, .description, .getmore li')
		.css({opacity: 0.0})
		.hide()
		;
	$next
		.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 500, function() {
			$active
				.removeClass('last-active')
				.find('h2, .description, .getmore li')
				.css({opacity: 0.0})
				.hide()
				;
			$next
				.find('h2')
				.show()
				.animate({opacity: 1.0},300)
				;
			$next
				.find('.description')
				.show()
				.animate({opacity: 1.0},1000)
				;
			$next
				.find('.getmore li:nth-child(1)')
				.show()
				.animate({opacity: 1.0},1000)
				.next('li:nth-child(2)')
				.show()
				.delay(200)
				.animate({opacity: 1.0},1000)
				.next('li')
				.show()
				.delay(200)
				.animate({opacity: 1.0},1000)
				;
		});
}

$(function() {
	
	var auto = setInterval( "slideSwitch('next')", 5000 );
	
	$('.markers a').click(function () {
		clearInterval(auto);
		slideSwitch($(this).attr('data-pos'));
		auto = setInterval( "slideSwitch('next')", 5000 );
		return false;
	});
	$('.getmore li').hover(function () {
		$(this).animate({
			paddingRight: "30px",
			opacity: 0.6
		}, {queue: false});
	}, function () {
		$(this).animate({
			paddingRight: "15px",
			opacity: 1
		}, {queue: false});
	});
	
});
