// JavaScript Document

function virtualTour()
{
	// description and image of the holes
	var description = document.getElementById("desc");
	var lgImage = document.getElementById("lgimage");
	
	
	// next and previous buttons
	var next = document.getElementById("next");
	var previous = document.getElementById("previous");
		
	// IDs of each thumbnail
	var img01 = document.getElementById("01");
	var img02 = document.getElementById("02");
	var img03 = document.getElementById("03");
	var img04 = document.getElementById("04");
	var img05 = document.getElementById("05");
	var img06 = document.getElementById("06");
	var img07 = document.getElementById("07");
	var img08 = document.getElementById("08");
	var img09 = document.getElementById("09");
	var img10 = document.getElementById("10");
	var img11 = document.getElementById("11");
	var img12 = document.getElementById("12");
	var img13 = document.getElementById("13");
	var img14 = document.getElementById("14");
	var img15 = document.getElementById("15");
	var img16 = document.getElementById("16");
	var img17 = document.getElementById("17");
	var img18 = document.getElementById("18");
	
	var golfContent = 
					{
						'content' :
									[
									 	{
											'heading' : 'Hole #01',
											'image' : 'golf/images/01-VRW-hole.jpg',
											'content' : 'Your choice of two tee shot locations on this double fairway, long par 4. Pick your poison: challenge the right side and be rewarded with a better shot angle to an elevated green or play left to the larger landing area and face a long shot over a deep diagonal bunker protecting the green complex.  Par is an excellent score if you can avoid the “cyclops” fairway bunker.'
										},
										{
											'heading' : 'Hole #02',
											'image' : 'golf/images/02-VRW-hole.jpg',
											'content' : 'A mid-length par 4 with a tee shot out of a chute.  Favor a shot to the right side of the fairway challenging the bunker.  Be conservative on your approach shot as trouble in the form of a pond lurks on the right.  Beware the “eyebrow” bunkers short and long of the “punchbowl” green.'
										},
										{
											'heading' : 'Hole #03',
											'image' : 'golf/images/03-VRW-hole.jpg',
											'content' : 'Visually intimidating – many have asked if they should photograph this hole or play it.  Distance control is critical as there is a full carry over the pond and an “Arnold Palmer” beach bunker.  A bail out area is to the left of the green.  Wind conditions and pin placement will determine the severity of the hole on a given day.'
										},
										{
											'heading' : 'Hole #04',
											'image' : 'golf/images/04-VRW-hole.jpg',
											'content' : 'This lengthy, 3 shot, par 5 requires a long, straight drive.  The accomplished player may try to reach the green in two, but this requires a daunting second shot over the gaping waste bunker on the left.  Or lay up right of the waste area and make par - a good score here.'
										},
										{
											'heading' : 'Hole #05',
											'image' : 'golf/images/05-VRW-hole.jpg',
											'content' : 'This short, par 3 requires you to hit the green or suffer the consequences, featuring an island green surrounded by a necklace of treacherous bunkers.  This is definitely one of the most difficult contoured greens on the course, so make sure you are on the correct level or a three putt is a certainty.'
										},
										{
											'heading' : 'Hole #06',
											'image' : 'golf/images/06-VRW-hole.jpg',
											'content' : 'This is a demanding 3 shot, long par 5.  Enjoy your tee shot as it flies over the large diagonal waste area on this cape-style hole to a wide fairway.  The conservative player should lay up the second shot short of the “bottleneck” created by vineyards on the right and waste area and pond on the left.  For the adventurous, successfully challenge the bottleneck and find yourself set up for a birdie opportunity.  As you enter the breathtaking green setting meandering through grapevines, allow yourself to relish the essence of true vineyard golf.'
										},
										{
											'heading' : 'Hole #07',
											'image' : 'golf/images/07-VRW-hole.jpg',
											'content' : 'Vineyard golf at its best - a visually exciting right to left hole that emphasizes strategy.  There is no one correct way to play this hole, but taming it requires awareness of yardage, proper club selection, and precise execution of shots.  Spectacular views abound from the floating tees overlooking vineyards, ponds, and rolling terrain.'
										},
										{
											'heading' : 'Hole #08',
											'image' : 'golf/images/08-VRW-hole.jpg',
											'content' : 'This breathtaking hole speaks for itself.  A classic risk/reward theme allows the faint of heart to bail out right.  A second shot must carry the severely contoured false front in order to hold the green.  The opportunity exists to challenge the left side waste area and come in from the left to a much more accommodating “bump and run” shot.  Or be a hero and play straight away, however, your drive will have to carry 260 yards.  But beware, this hole could spoil many a great round.'
										},

										{
											'heading' : 'Hole #09',
											'image' : 'golf/images/09-VRW-hole.jpg',
											'content' : 'Mackenzie-inspired” tough dogleg right to left featuring diagonal carry bunkers and wide fairway landing areas that will test your physical and mental golfing skills.  This hole challenges you to carry as much of the bunkers as you dare for the best angle into this very narrow green.  The mirage bunker appears to be greenside, but is actually 40 yards short of the green.  With a green bunkered left and right, there is no bail out area.  It is only fitting that this strong par 4 sets the stage for the back nine at the vineyards.'
										},
										{
											'heading' : 'Hole #10',
											'image' : 'golf/images/10-VRW-hole.jpg',
											'content' : 'A  hole that combines most of the strategic elements encountered throughout the Vineyards.  Challenging the bunkers on the left side rewards you with the best-shot angle to this two-tiered green.  Left of the green, a “Donald Ross style” bentgrass hollow may swallow you up.'
										},
										{
											'heading' : 'Hole #11',
											'image' : 'golf/images/11-VRW-hole.jpg',
											'content' : 'One really strong par 4.  This straight ahead uphill hole with an amphitheatre green emphasizes power and strategy.  Positioning your tee ball to the right of the fairway will give you the best angle into the green complex.  Be sure to take one extra club in order to carry the tier approximately 20 yards short of the green.'
										},
										{
											'heading' : 'Hole #12',
											'image' : 'golf/images/12-VRW-hole.jpg',
											'content' : 'From its soaring 31-foot elevation, this classic par 4 offers panoramic views of the vineyards, orchards, and Tuscany House Hotel.  With your choice of two tees shots, this hole takes you back to the origins of classic golf.  Choose to challenge the ominous diagonal bunkers and be rewarded with a shorter open shot to the tiered green set perilously close to a pond.'
										},
										{
											'heading' : 'Hole #13',
											'image' : 'golf/images/13-VRW-hole.jpg',
											'content' : 'One of the prettiest holes at the Vineyards.  Relish the view as you hit off the bluff overlooking the pond into the left to right sloping green.  For the conservative player, the bail out area on the left may carry balls towards the green.  Or challenge the pond to a back right pin position that may result in a birdie.'
										},
										{
											'heading' : 'Hole #14',
											'image' : 'golf/images/14-VRW-hole.jpg',
											'content' : 'This truly spectacular dogleg right may be the toughest hole on the course and will challenge you to hit two excellent shots in order to make par.  Favor the right side of the fairway for the shortest shot to this runaway green.  The second shot dictates a bump and run “Scottish style” shot that may require less club.'
										},
										{
											'heading' : 'Hole #15',
											'image' : 'golf/images/15-VRW-hole.jpg',
											'content' : 'Relax and enjoy this scenic, tree-lined, reachable par 5 that can produce a birdie.  Avoid the bunkers on the right and out of bounds on the left as you hit your tee shot to the large fairway landing area and you have successfully completed the first step towards hitting this hole in two.  If you lay up, the third shot to a swale green puts a premium on accuracy.'
										},
										{
											'heading' : 'Hole #16',
											'image' : 'golf/images/16-VRW-hole.jpg',
											'content' : 'What you see is what you get on this attractive, mid-length par 3.  Shot selection into the two-tiered green is vital.  This large green could also cause problems for even the best of putters.  Par is a good score here.'
										},
										{
											'heading' : 'Hole #17',
											'image' : 'golf/images/17-VRW-hole.jpg',
											'content' : 'This reachable par 4 short birdie hole will reward the smart shot.  Lured by an unusually wide landing area for its length the big hitter may try to drive the green, but beware of the quarry fescue area on the right.  The distance is deceptive, requiring pinpoint accuracy and yardage control from every golfer.  A short, delicate second shot may not be as easy as it appears – watch out for the falloff left and heavily bunkered pin position on the right.  A definite birdie opportunity, but beware or the “bogey man” might grab you.'
										},
										{
											'heading' : 'Hole #18',
											'image' : 'golf/images/18-VRW-hole.jpg',
											'content' : 'This tough, double dogleg, mid-length par 5 features vineyards, bunkers, ponds, and rolling terrain.  Options abound as a tee shot favoring the left side of the fairway will leave you with visually intimidating alternatives for the second shot.  For the brave or foolish, hit the green in two; for the more conservative, lay up short of the pond or hit into the progressively narrowing neck.  Two shot swings will be a common occurrence here.'
										}
									]
					};

	var i = 0;
	
	// make first image and hole description default
	lgImage.innerHTML = "<img src=\"" + golfContent.content[i].image + "\" />";
	description.innerHTML = "<p>" + golfContent.content[i].heading + "</p><p>" + golfContent.content[i].content + "</p>";
	
	
	// event handler for the 'Next' link
	next.onclick = function()
	{
		i += 1;		
		lgImage.innerHTML = "<img src=\"" + golfContent.content[i].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[i].heading + "</p><p>" + golfContent.content[i].content + "</p>";
		if (i == 17)
		{
			i = -1;
		}
	};
	
	// event handler for the 'Previous' link
	previous.onclick = function()
	{
		i -= 1;
		lgImage.innerHTML = "<img src=\"" + golfContent.content[i].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[i].heading + "</p><p>" + golfContent.content[i].content + "</p>";
		if (i == 0)
		{
			i = 17;
		}
	};
	
	
	// event handlers for the thumbnail images
	img01.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[0].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[0].heading + "</p><p>" + golfContent.content[0].content + "</p>";
		i = 0;
		return i;
	};
	img02.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[1].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[1].heading + "</p><p>" + golfContent.content[1].content + "</p>";
		i = 1;
		return i;
	};
	
	img03.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[2].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[2].heading + "</p><p>" + golfContent.content[2].content + "</p>";
		i = 2;
		return i;
	};
	img04.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[3].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[3].heading + "</p><p>" + golfContent.content[3].content + "</p>";
		i = 3;
		return i;
	};
	img05.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[4].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[4].heading + "</p><p>" + golfContent.content[4].content + "</p>";
		i = 4;
		return i;
	};
	img06.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[5].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[5].heading + "</p><p>" + golfContent.content[5].content + "</p>";
		i = 5;
		return i;
	};
	img07.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[6].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[6].heading + "</p><p>" + golfContent.content[6].content + "</p>";
		i = 6;
		return i;
	};
	img08.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[7].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[7].heading + "</p><p>" + golfContent.content[7].content + "</p>";
		i = 7;
		return i;
	};
	img09.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[8].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[8].heading + "</p><p>" + golfContent.content[8].content + "</p>";
		i = 8;
		return i;
	};
	img10.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[9].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[9].heading + "</p><p>" + golfContent.content[9].content + "</p>";
		i = 9;
		return i;
	};
	img11.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[10].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[10].heading + "</p><p>" + golfContent.content[10].content + "</p>";
		i = 10;
		return i;
	};
	img12.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[11].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[11].heading + "</p><p>" + golfContent.content[11].content + "</p>";
		i = 11;
		return i;
	};
	img13.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[12].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[12].heading + "</p><p>" + golfContent.content[12].content + "</p>";
		i = 12;
		return i;
	};
	img14.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[13].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[13].heading + "</p><p>" + golfContent.content[13].content + "</p>";
		i = 13;
		return i;
	};
	img15.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[14].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[14].heading + "</p><p>" + golfContent.content[14].content + "</p>";
		i = 14;
		return i;
	};
	img16.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[15].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[15].heading + "</p><p>" + golfContent.content[15].content + "</p>";
		i = 15;
		return i;
	};
	img17.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[16].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[16].heading + "</p><p>" + golfContent.content[16].content + "</p>";
		i = 16;
		return i;
	};
	img18.onclick = function()
	{
		lgImage.innerHTML = "<img src=\"" + golfContent.content[17].image + "\" />";
		description.innerHTML = "<p>" + golfContent.content[17].heading + "</p><p>" + golfContent.content[17].content + "</p>";
		i = 17;
		return i;
	};
}


// preloader function
function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}

// preload virtualTour
addLoadEvent(virtualTour);