
var rotatingInterval = false;
function toggleRotating() {
  if (rotatingInterval) {
    clearInterval(rotatingInterval);
    rotatingInterval = false;
	setImage();
  } else {
	$.fancybox.next();
    rotatingInterval = setInterval($.fancybox.next, 5000);
	setImage();
  }
}

function setImage() {
	if (rotatingInterval) {
		$(".playpauseimg").removeClass("playimg");
		$(".playpauseimg").addClass("pauseimg");
	} else {
		$(".playpauseimg").removeClass("pauseimg");
		$(".playpauseimg").addClass("playimg");
	}
}

function setupAmerscotGallery() {
	$("span#fancybox-left-ico,#fancybox-left,span#fancybox-right-ico,#fancybox-right").click(function() {
		$(".playpauseimg").removeClass("pauseimg");
		setTimeout(setImage, 500);
	});
	
	$("a#fancybox-close").click(function() {
		if (rotatingInterval) {
			clearInterval(rotatingInterval);
			rotatingInterval = false;
		}
	});
	
	$(".gallery").click(function() {
		toggleRotating();
		
		var div = '<a class="pause" href="javascript:toggleRotating();"><div class="playpauseimg pauseimg"></div></a>';
		$.fancybox([
			{	'href'	: '/images/the_innkeeper/Innkeeper1.jpg',
				'title'	: '<div class="caption"><h2>The Innkeeper</h2><span>The <a href="/the_innkeeper.php">innkeeper Viki Carter</a> comes from a family of innkeepers and loves receiving guests in the newly refurbished Amerscot House Inn.</span>' + div + "</div>"  },

			{	'href'	: '/images/the_inn/Inn1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn</h2><span>Built in 1734, <a href="/the_inn.php">Amerscot House Inn</a> is a center chimney colonial home, one of several from that era that remain in Stow today.</span>' + div + "</div>"  },
			{	'href'	: '/images/the_inn/Inn2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn</h2><span>There are extensive <a href="/guest_areas.php">common areas</a> for guests to enjoy – the <a href="/sitting_room.php">Sitting Room</a>, the <a href="guest_areas">Screened Porch</a>, the <a href="guest_areas">Conservatory</a> and, of course, the nearly <a href="/the_grounds.php">3 acres of grounds</a>.</span>' + div + "</div>"  },
			{	'href'	: '/images/the_inn/Inn3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn</h2><span>The <a href="/the_inn.php">house</a> has been lovingly restored and extended. The spacious rooms are painted in cool, fresh colors, furnished with antique furniture and display original artwork.</span>' + div + "</div>"  },

			{	'href'	: '/images/grounds/Grounds1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Grounds</h2><span>Amerscot House Inn is situated on nearly 3 acres of <a href="/grounds.php">gardens and woodlands</a>.</span>' + div + "</div>"  },
			{	'href'	: '/images/grounds/Grounds2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Grounds</h2><span>Summer brings blazes of colors in the <a href="/grounds.php">flower beds</a> with dragonflies and butterflies attracted by the buddleia trees.</span>' + div + "</div>"  },
			{	'href'	: '/images/grounds/Grounds3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Grounds</h2><span><a href="/grounds.php">The grounds</a> are here for you to enjoy, so wander down our wooded trails, sit out at tables and chairs in the flower gardens or read a book whilst lying on a lounger under the trees.</span>' + div + "</div>"  },

			{	'href'	: '/images/guest_areas/GuestAreas1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Dining Room</h2><span>The <a href="/guest_areas">Dining Room</a> has a large pine dining table and a decorative fireplace with a brick oven.</span>' + div + "</div>"  },
			{	'href'	: '/images/guest_areas/GuestAreas2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Conservatory</h2><span>The <a href="/guest_areas">Conservatory</a>, which is planted with flowers and herbs, has a table and chairs and is a great place for an early evening cocktail.</span>' + div + "</div>"  },
			{	'href'	: '/images/guest_areas/GuestAreas3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Screened Porch</h2><span>The <a href="/guest_areas">Screened Porch</a> overlooking the meadow lawn at the back of the house is a wonderfully cool spot on a hot day.</span>' + div + "</div>"  },
				
			{	'href'	: '/images/home/SittingRoom.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Sitting Room</h2><span>The spacious <a href="/sitting_room">Sitting Room</a> has an original fireplace complete with baking oven.</span>' + div + "</div>"  },
			{	'href'	: '/images/sitting_room/SittingRoom2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Sitting Room</h2><span>Daily papers (New York Times and Boston Globe) are provided. There is a desk with a computer, printer and high-speed internet connection for your use. Complimentary Wi-Fi is available throughout the inn.</span>' + div + "</div>"  },
			{	'href'	: '/images/sitting_room/SittingRoom3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Sitting Room</h2><span>There are fruits, snacks and baked goods, as well as a glass-fronted refrigerator with cold drinks, beer and wine – available at all times and at no charge.</span>' + div + "</div>"  },

			{	'href'	: '/images/conant/Conant13.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Conant Suite</h2><span>This light, spacious <a href="/conant.php">3-roomed suite</a> is situated on the 2nd floor and has wonderful views of the gardens.</span>' + div + "</div>"  },
			{	'href'	: '/images/conant/Conant1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Conant Suite</h2><span>The <a href="/conant.php">Conant Suite</a> is named after Daniel Conant of Stow. He took part in the events of April 19th 1775 when the British soldiers were chased from Concord back to Charlestown at the start of the Revolutionary war.</span>' + div + "</div>"  },
			{	'href'	: '/images/conant/Conant2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Conant Suite</h2><span>The <a href="/conant.php">bedroom</a> contains a Queen, Four-Poster Bed, antique night stands and chest of drawers, two chairs and an original decorative fireplace.</span>' + div + "</div>"  },
			{	'href'	: '/images/conant/Conant3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Conant Suite</h2><span>The <a href="/conant.php">living room</a> is equipped with a flat-screen cable TV/DVD player, comfy sofa, coffee table and antique desk and has two spacious closets.</span>' + div + "</div>"  },
			{	'href'	: '/images/conant/Conant5.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Conant Suite</h2><span>The <a href="/conant.php">bathroom</a> has a decorative fireplace, whirlpool bath, and separate, tiled shower.</span>' + div + "</div>"  },
			{	'href'	: '/images/conant/Conant6.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Conant Suite</h2><span>Enjoy and relax in Conant\'s<a href="/conant.php"> spacious whirlpool bath</a>.</span>' + div + "</div>"  },
				
			{	'href'	: '/images/forbush/Forbush1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Forbush Room</h2><span>This <a href="/forbush.php">light and airy 2nd floor room</a> has a Queen four-poster bed and has views over the front gardens.</span>' + div + "</div>"  },
			{	'href'	: '/images/forbush/Forbush2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Forbush Room</h2><span> The <a href="/forbush.php">room</a> has antique night stands and a chest of drawers, two chairs as well as a flat screen cable TV/DVD player.</span>' + div + "</div>"  },
			{	'href'	: '/images/forbush/Forbush3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Forbush Room</h2><span>The spacious <a href="/forbush.php">private bathroom</a> has a tub/shower.</span>' + div + "</div>"  },
				
			{	'href'	: '/images/gardner/Gardner1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Gardner Room</h2><span>Situated on the <a href="/gardner.php">1st (ground) floor</a>, this room has a King Bed with an option of a twin-bedded arrangement.</span>' + div + "</div>"  },
			{	'href'	: '/images/gardner/Gardner2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Gardner Room</h2><span>The <a href="/gardner.php">room</a> looks out onto the garden on two sides, has a decorative fireplace, antique furniture, two comfortable armchairs for relaxation, as well as a flat screen cable TV/DVD player and a small closet.</span>' + div + "</div>"  },
			{	'href'	: '/images/gardner/Gardner3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Gardner Room</h2><span>The spacious, <a href="/gardner.php">private bathroom</a> has a tub/ shower.</span>' + div + "</div>"  },
				
			{	'href'	: '/images/gibson/Gibson1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Gibson Room</h2><span>Situated on the <a href="/gibson.php">1st (ground) floor</a> in the newer part of the house, this spacious room has recently been completely remodeled.</span>' + div + "</div>"  },
			{	'href'	: '/images/gibson/Gibson2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Gibson Room</h2><span> It has a <a href="/gibson.php">King Bed</a>, is fully carpeted, has a built-in desk/dressing table, an antique chest of drawers and two comfortable wing chairs.</span>' + div + "</div>"  },
			{	'href'	: '/images/gibson/Gibson3.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Gibson Room</h2><span>The <a href="/gibson.php">new bathroom</a> has double vanities & sinks.</span>' + div + "</div>"  },
			{	'href'	: '/images/gibson/Gibson4.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Gibson Room</h2><span>Enjoy the new <a href="/gibson.php">large (3ft x 4ft) shower</a>.</span>' + div + "</div>"  },
				
			{	'href'	: '/images/breakfast/Breakfast1.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Breakfast</h2><span>A <a href="/breakfast.php">full country breakfast</a> is served each morning at your choice of communal or individual tables. An extensive cold buffet is laid out for you to enjoy while your hot entrée is prepared by owner, Viki Carter.</span>' + div + "</div>"  },
			{	'href'	: '/images/breakfast/Breakfast2.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn Breakfast</h2><span>We use only the <a href="/breakfast.php">finest ingredients</a>; these are organic and produced locally whenever possible.</span>' + div + "</div>"  },

			{	'href'	: '/images/home/Inn.jpg',
				'title'	: '<div class="caption"><h2>Amerscot House Inn</h2><span>We welcome you to our inn.  Come enjoy the <a href="/sitting_room.php">Sitting Room</a>, the <a href="/guest_areas.php">Screened Porch</a>, the <a href="/guest_areas.php">Conservatory</a> and, of course, the nearly <a href="/grounds.php">3 acres of grounds</a>. So, pick your spot, find your favorite seat and relax with a cup of tea or coffee, or maybe a glass of wine or a beer. While you are our guest, Amerscot House Inn is your home!</span>' + div + "</div>"  }
		], {
			'titlePosition'	: 'over',
			'cyclic'		: 'true'
		})
	});	
}

