	//global variables
	var currentgallery = "golf";
	var currentpic = "";
	var counter,x,i = 0;
	var place = 0;
	var arrlength = 0;
	var range = 0;
	var hold_over = "";
	var show_toggle = 0;
	var videocode = "";
	var videotit = "";
	var videosubtit = "";
	var videocontent = "";
	var results = "";
	var thumb1 = "";
	var thumb2 = "";
		
	// set the arrays 
	// home page images
	var gallery_array=[["images/swing_sequence/1_address_dl.jpg", "Address", "Down the Line Swing Sequence", "<ul><li> Straight back</li><li> Slight knee flex</li><li> Clubshaft perpendicular to the spine angle</li><li> Shoulders, hips, knees and feet in alignment</li><li> Weight on the balls of feet</li><li> Arms hanging relaxed from the shoulders</li></ul>"],["images/swing_sequence/2_takeaway_dl.jpg", "Takeaway", "Down the Line Swing Sequence", "<ul><li> Clubshaft taken back on the same plane as the original shaft angle</li><li> Lower body resists as the upper body begins to turn</li><li> Left arm connects to the body</li></ul>"],["images/swing_sequence/3_parallel_dl.jpg", "Parallel to ground and target line", "Down the Line Swing Sequence", "<ul><li> Clubshaft is on plane as it is parallel to the ground and target line</li><li> Clubhead is in line with the hands</li><li> The leading edge of the clubface matches the spine angle (square clubface)</li><li> Left arm has fully connected to the torso</li><li> Lower body begins to turn as a result of the upper body coiling</li><li> Right elbow is even with the seam on the side of the shirt</li></ul>"],["images/swing_sequence/4_halfway_back_dl.jpg", "Half way back", "Down the Line Swing Sequence", "<ul><li>Left arm remains tight to the chest</li><li>Clubshaft is on plane, parallel to the original shaft angle</li><li>Hips are resisting as the upper body turns</li></ul>"],["images/swing_sequence/5_top_dl.jpg", "Top of backswing", "Down the Line Swing Sequence", "<ul><li> Clubface is square as it matches the angle of the left forearm</li><li> The left arm, clubshaft and shoulder are all on the same plane</li><li> The knees have remained flexed</li></ul>"],["images/swing_sequence/6_halfway_dl.jpg", "Half way down", "Down the Line Swing Sequence", "<ul><li> The shaft remains on plane</li><li> The left arm remains attached to the torso</li><li> The right elbow is on the seam of the shirt</li><li> The hands are close to the right hip to deliver the clubhead from the inside</li><li> Notice that the right heel is off the ground as the weight has begun to shift into the left side</li></ul>"],["images/swing_sequence/7_impact_dl.jpg", "Impact", "Down the Line Swing Sequence", "<ul><li> The hips have turned out of the way </li><li> The chest has turned as well as it moves around to the left</li><li> The clubface is square at impact</li><li> Notice how the clubhead is left of the tee showing that the swing shape has moved back to the inside</li></ul>"],["images/swing_sequence/8_halfway_dl.jpg", "Half way through", "Down the Line Swing Sequence", "<ul><li> The right arm is now on the shoulder line</li><li> The original spine angle has been maintained</li><li> Notice that the ball has gone straight but the swing has gone around to the left of the target (You do not hit it straight by swinging straight. You hit it straight by swinging on a circle)</li></ul>"],["images/swing_sequence/9_finish_dl.jpg", "Finish", "Down the Line Swing Sequence", "<ul><li> Up on the tip toe of the right foot showing that the weight has transferred to the left side</li><li> Spine angle still in tact</li><li> The head has come up with the shot allowing for a full release of the body. Do not keep your head down in the follow through!</li></ul>"],["images/swing_sequence/10_address_fo.jpg", "Address", "Face On Swing Sequence", "<ul><li> Wider stance for a driver</li><li> 55% of the weight on the trailing foot</li><li> The ball position is opposite the left heel to enable an ascending hit</li><li> Neutral grip shows the V's pointing towards the right ear</li><li> The right shoulder is below the left the same amount that the right hand is below the left on the grip</li><li> The right foot points straight ahead to create some resistance</li><li> The left foot is flared out towards the target to allow the hip to release</li></ul>"],["images/swing_sequence/11_takeaway_fo.jpg", "Takeaway", "Face On Swing Sequence", "<ul><li> Stable lower body allows to help create a coil</li><li> Notice the wrinkles in the back of the shirt, the coiling has begun</li></ul>"],["images/swing_sequence/12_halfway_fo.jpg", "Half way back", "Face On Swing Sequence", "<ul><li> 'L' position of the left arm and clubshaft show a full loading of the wrists</li><li> The shoulders have rotated much more than the hips thereby storing more energy</li></ul>"],["images/swing_sequence/13_backswing_fo.jpg", "Top of Backswing", "Face On Swing Sequence", "<ul><li> The left arm has remained extended maintaining the radius of the swing</li><li> The shoulders have turned over 90 degrees while the hips have turned less than 45 degrees, this stores power</li><li> The head has remained steady allowing the weight to remain centered</li></ul>"],["images/swing_sequence/14_halfway_down_fo.jpg", "Half way down", "Face On Swing Sequence", "<ul><li> 'L' position in tact half way down delaying the hit (The change of direction from backswing to downswing coupled with relaxation leads to this position. I am NOT holding on with tension)</li><li> The hip and shoulder have begun the unwinding process</li><li> The head has held steady</li></ul>"],["images/swing_sequence/15_impact_fo.jpg", "Impact", "Face On Swing Sequence", "<ul><li> The left arm and clubshaft have lined up</li><li> The right wrist is slightly bent</li><li> The clubface is square</li><li> The hips are slightly more open than my chest</li><li> The head has stayed back</li><li> Left leg is straight, hitting into a firm left side</li></ul>"],["images/swing_sequence/16_halfway_fo.jpg", "Halfway through", "Face On Swing Sequence", "<ul><li> The weight is transferring through to the left side</li><li> Full release of the club</li><li> The chest has caught up to my hips and will soon pass them</li></ul>"],["images/swing_sequence/17_finish_fo.jpg", "Finish", "Face On Swing Sequence", "<ul><li> The right shoulder is closer to the target than the left showing that the chest has passed my hips and is pointing left of the target</li><li> Complete transfer of weight to the left side</li></ul>"]];

// video page youtube links
	var video_array=[["3v0vsK-0Crc", "Hitting it straight", "Understand how your irons and your driver require slightly different swing paths for hitting a straight shot.", "images/video/3v0vsK-0Crc.jpg"],["ddz-Pxj5WTU", "One plane backswing", "Learn the correct one-plane backswing.", "images/video/ddz-Pxj5WTU.jpg"],["USCXUhkilRU", "The grip and ball flight", "Understand how the grip affects ball flight and learn the right grip for you.", "images/video/USCXUhkilRU.jpg"],["ZJnBwRJ8VZI", "Maintaining good posture", "How to maintain good posture throughout the golf swing to ensure consistently good ball flight.", "images/video/ZJnBwRJ8VZI.jpg"],["53DaCUuj1Bo", "Releasing the club head", "Understanding the two most common swing releases in golf, the rolling release and the stable release.", "images/video/53DaCUuj1Bo.jpg"],["dXq5SXGbSS0", "The rough", "Golf instruction on hitting approach shots from the rough.", "images/video/dXq5SXGbSS0.jpg"],["6Dy6ewFs_F0", "Release the putterhead", "Golf instruction on releasing the putterhead when putting.", "images/video/6Dy6ewFs_F0.jpg"],["KOLiJmC4AhU", "Short game alignment", "How square alignment for your short game can improve your play.", "images/video/KOLiJmC4AhU.jpg"],["EdNDVHuX8kM", "Left wrist position", "The final say on the correct wrist position at the top of your backswing.", "images/video/EdNDVHuX8kM.jpg"],["gqnBGPTVmbU", "Impact position", "Learn what should be happening at the moment of truth.", "images/video/gqnBGPTVmbU.jpg"],["NnKsuPOoVYE", "Hip turn", "Learn to turn and avoid the dreaded sway.", "images/video/NnKsuPOoVYE.jpg"],["CHryMoGJ6lY", "Your eyes and your swingpath", "Understanding how alignment of your eyes affects swingpath.", "images/video/CHryMoGJ6lY.jpg"],["3T-SHXKywag", "Ball flight variation", "Understanding the variations of ball flight and how to use them to your advantage.", "images/video/3T-SHXKywag.jpg"],["KjqrEP-BJRM", "High ball flight", "How to hit high golf shots.", "images/video/KjqrEP-BJRM.jpg"],["exoyIb3T7hs", "Distance control in putting", "Golf instruction on developing good putting distance control.", "images/video/exoyIb3T7hs.jpg"],["g05hvTvXc5U", "Shots from greenside rough","Golf instruction on pitch and chip shots from greenside rough.", "images/video/g05hvTvXc5U.jpg"],["a2rPZX4IvyA", "High bunker shot", "Instruction on how to hit a high shot from a greenside bunker.", "images/video/a2rPZX4IvyA.jpg"],["r7_I1cgnn6U", "Low ball flight", "Golf instruction on how to hit low shots.", "images/video/r7_I1cgnn6U.jpg"],["3oBUullQCEw", "chip shot", "How to make consistently good contact on chip shots.", "images/video/3oBUullQCEw.jpg"],["leEFrRyMASY", "Alignment", "How to align properly to hit a golf shot.", "images/video/leEFrRyMASY.jpg"],["KKUNm8San9g", "Shot shaping", "Instruction on how to hit draws, fades and straight golf shots.", "images/video/KKUNm8San9g.jpg"],["hjJlCHM1SYM", "Pitch shot, understanding the bounce", "How to hit a pitch shot in golf even from a tight lie by understanding the bounce on the club.", "images/video/hjJlCHM1SYM.jpg"],["Zqj0nam0pfA", "Swing path, swing in-to-in", "Instruction for a proper in-to-in golf swing path.","images/video/Zqj0nam0pfA.jpg"],["j4p_RKocII0", "Head still putting", "Putting a golf ball with your head still.", "images/video/j4p_RKocII0.jpg"]];
	
	function get_gallery(galname,state){
		switch (galname) { 
			case "golf" :
				if (state==0) {
					place = 0;
					currentgallery = "golf";
					arrlength = gallery_array.length - 1;	
				}				
				document.gallerypic.src = gallery_array[place][0];
				document.gallerypic.alt = gallery_array[place][1];
				document.getElementById('seqtitle').innerHTML = gallery_array[place][2];
				document.getElementById('pictitle').innerHTML = gallery_array[place][1];
				document.getElementById('instruct').innerHTML = gallery_array[place][3];
				break;
				
			case "video" :
			
				if (state==0) {
					place = 0;
					currentgallery = "video";
					arrlength = video_array.length - 1;
				}
				
				videotit = video_array[place][1];
				videosubtit = video_array[place][2];
				videocode = video_array[place][0];
				paint_video(videocode,videotit,videosubtit);
				break;

		   default:  alert("Unexpected value encountered.");
		}		
	}
	
	function get_video(vcode,gal) {
		var i = 0;
		videocode = vcode;
		current_gallery = gal;
		arrlength = video_array.length - 1;
		
		for (i=0;i<=arrlength;i++) {
			var vtemp = video_array[i][0];
			if (videocode == vtemp) {
				place = i;
				// thumb tests
				// test for previous image
				if (i-1 >= 0) {
					// not at beginning of array
					thumb1 = i-1;
				} else {
					// at the beginning of array					
					thumb1 = arrlength;
				}
				// test for next image
				if (i+1 <= arrlength) {
					// not at end of array
					thumb2 = i+1;
				} else {
					// end of array
					thumb2 = 0
				}
				videocode = video_array[i][0];
				videotit = video_array[i][1];
				videosubtit = video_array[i][2];
				
			}
		}
		paint_video(videocode,videotit,videosubtit);

	}
	
	function paint_video(code,vt,vst) {

		// empty the video div
		results = document.getElementById('fullsize');
		while (results.hasChildNodes()) {
			results.removeChild(results.lastChild);
		}
		//get the new video div content
		videocontent = "<object width='450' height='375'><param name='movie' value='http://www.youtube.com/v/'";
		videocontent = videocontent + code + "&rel=1&color1=0x2b405b&color2=0x6b8ab6&border=1&fs=1'></param>";
		videocontent = videocontent + "<param name='allowFullScreen' value='false'></param>";
		videocontent = videocontent + "<embed src='http://www.youtube.com/v/" + code;
		videocontent = videocontent + "&rel=1&color1=0x2b405b&color2=0x6b8ab6&border=1&fs=1'";
		videocontent = videocontent + "type='application/x-shockwave-flash' width='450' height='375'";
		videocontent = videocontent + "allowfullscreen='false'></embed></object>";
		
		document.getElementById('vtitle').innerHTML = vt;
		document.getElementById('vsubtitle').innerHTML = vst;
		document.getElementById('fullsize').innerHTML = videocontent;
	}
	
	function get_this_pic(code,counter) {
		// get new video code
		get_video(code,'video');
		
	}
	
	function paint_video_thumb() {
		var bodytext;
		
		bodytext = 	'<td><a href="videodetail.html?' + video_array[thumb1][0] +
								'"><img src="' + video_array[thumb1][3] + 
								'" height="50" alt="thumb1" border="0" /></a></td>' +
								'<td><img src="images/assets/spacer.gif" width="10" alt="" border="0" /></td>' +
								'<td><a href="videodetail.html?' + video_array[thumb2][0] +
								'"><img src="' + video_array[thumb2][3] + 
								'" height="50" alt="thumb2" border="0" /></a></td>';
								
		document.write (bodytext);								
	
	
	}

	function get_next_pic() {				
		place = place + 1;		
		if (place <= arrlength) {
			get_gallery(currentgallery,1);
			
		} else {
			place=0;
			get_gallery(currentgallery,1);
		}
	}
	
	function get_pic(planno) {
		place = planno;
		if (planno<=arrlength && planno>=0) {
			get_gallery(currentgallery,1);
		}
	}

	function put_pic(which) {
		place=which;
		document.gallerypic.src = gallery_array[place][0];
		document.gallerypic.alt = gallery_array[place][1];
		document.getElementById('seqtitle').innerHTML = gallery_array[place][2];
		document.getElementById('pictitle').innerHTML = gallery_array[place][1];
		document.getElementById('instruct').innerHTML = gallery_array[place][3];
	}

	function openFixedWindow(where,big,resize) {
		var theUrl;
		var theSize;
		var bigger;
		if (where=="" || where==null) {
			theUrl = plan_array[place][2];
			theSize = 'width=625,height=740'
		} else {
			theUrl = where;
			theSize = big;
		}	
		if (resize=="" || resize==null) {
			//do nothing
		} else {
			theSize=theSize+',resizable=yes,menubar=yes,scrollbars=yes';
		}	
		//alert (theUrl + " " + theSize);
		window.open(theUrl,'floorplan',theSize);
	}
	function get_prev_pic() {
		place = place - 1;		
		if (place >= 0) {
			get_gallery(currentgallery,1);
		} else {
			place=arrlength;
			get_gallery(currentgallery,1);
		}		
	}

	function 	toggle_show() {
		if (show_toggle==0) {
			show_toggle=1;
		} else {
			show_toggle=0;
		}
		run_show();
	}

	function run_show() {
				
		if (show_toggle==1) {
			place = place + 1;		
			if (place <= arrlength) {
				get_gallery(currentgallery,1);				
			} else {
				place=0;
				get_gallery(currentgallery,1);
			}
			setTimeout("run_show()",5000);
		}
	}
				
	function nav_swap_over(navname,imgroot,imgswap) {
		hold_over=imgroot;
		document.images[navname].src=imgswap;
				
	}
	function nav_swap_out(navname) {
		document.images[navname].src=hold_over;
	}

	function nav_painter() {
		var bodyText;
						
		bodyText = 	'<div id="Layer1" style="position:absolute; width:700px; height:23px; left: 0px; top: 110px;">' +
	  						'<table width="700" border="0">' +
	          		'<tr valign="top">' +
	          		'<td width="10">&nbsp;</td>' +
		            '<td width="79"><a href="aboutus.html" class="banner">About Us</a></td>' +
		            '<td width="149"><a href="corp.html" class="banner">Corporate Outings</a></td>' +
		            '<td width="69"><a href="lessons.html" class="banner">Lessons</a></td>' +
		            '<td width="65"><a href="articles.html" class="banner">Articles</a></td>' +
		            '<td width="62"><a href="videos.html" class="banner">Videos</a></td>' +
		            '<td width="89"><a href="testimonials.html" class="banner">Testimonials</a></td>' +
		            '<td width="130"><a href="swingsequence.html" class="banner">Swing Sequence</a></td>' +
		            '<td width="79"><a href="contactus.html" class="banner">Contact Us</a></td>' +
			          '</tr>' +
			        	'</table>' +
		        		'</div>';
		document.write (bodyText);
	}
	function foot_painter() {
		var bodyText;
						
		bodyText = 	'<tr><td colspan="3" align="left" valign="top"><div align="center">' +
								'<img src="logo/sub_pgai.gif" width="51" height="53" alt="PGA Professional" />' +
								'<img src="images/assets/spacer.gif" width="10" alt="" />' +
								'<img src="images/front/gd.gif" alt="Golf Digest" align="top" />' +								
								'<img src="images/assets/spacer.gif" width="10" alt="" />' +
								'<img src="logo/tpi_cert_logo_foot.jpg" alt="TPI Certification" />' +
								'<img src="images/assets/spacer.gif" width="10" alt="" />' +
								'<img src="logo/tpt_1_foot.jpg" alt="TPT Certification" />' +
								'</div></td></tr>' +
								'<tr><td colspan="3" align="left" valign="top"><div align="center">' +
                '<a href="default.asp" class="footer">Home</a> | <a href="aboutus.html" class="footer">About Us</a> | ' +
                '<a href="corp.html" class="footer">Corporate Outings</a> | ' +
                '<a href="lessons.html" class="footer">Lessons</a> | ' +
                '<a href="articles.html" class="footer">Articles</a> | ' +
                '<a href="videos.html" class="footer">Videos</a> | '+
                '<a href="testimonials.html" class="footer">Testimonials</a> | '+
                '<a href="contactus.html" class="footer">Contact Us</a><br />' +
								'<span class="smalltxt">Zander Golf copyright 2000 - 2009 </span><br />' +
								'<a href="default.asp" class="footer">www.zandergolf.com</a>' +
                '</div></td></tr>';
		document.write (bodyText);
	}	

	function foot_painter_sub() {
		var bodyText;
						
		bodyText = 	'<tr><td colspan="3" align="left" valign="top"><div align="center">' +
								'<img src="../logo/sub_pgai.gif" width="51" height="53" alt="PGA Professional" />' +
								'<img src="../images/assets/spacer.gif" width="10" alt="" />' +
								'<img src="../images/front/gd.gif" alt="Golf Digest" align="top" />' +								
								'<img src="../images/assets/spacer.gif" width="10" alt="" />' +
								'<img src="../logo/tpi_cert_logo_foot.jpg" alt="TPI Certification" />' +
								'<img src="../images/assets/spacer.gif" width="10" alt="" />' +
								'<img src="../logo/tpt_1_foot.jpg" alt="TPT Certification" />' +
								'</div></td></tr>' +
								'<tr><td colspan="3" align="left" valign="top"><div align="center">' +
                '<a href="../default.asp" class="footer">Home</a> | '+
                '<a href="../aboutus.html" class="footer">About Us</a> | ' +
                '<a href="../corp.html" class="footer">Corporate Outings</a> | '+
                '<a href="../lessons.html" class="footer">Lessons</a> | ' +
                '<a href="../articles.html" class="footer">Articles</a> | '+
                '<a href="../videos.html" class="footer">Videos</a> | '+
                '<a href="../testimonials.html" class="footer">Testimonials</a> | '+
                '<a href="../contactus.html" class="footer">Contact Us</a><br />' +
								'<span class="smalltxt">Zander Golf copyright 2000 - 2009 </span><br />' +
								'<a href="../default.asp" class="footer">www.zandergolf.com</a>' +
                '</div></td></tr>';
		document.write (bodyText);
	}	
	
	function nav_painter_sub() {
		var bodyText;
						
		bodyText = 	'<div id="Layer1" style="position:absolute; width:700px; height:23px; left: 0px; top: 110px;">' +
	  						'<table width="700" border="0">' +
	          		'<tr valign="top">' +
	          		'<td width="10">&nbsp;</td>' +
		            '<td width="79"><a href="../aboutus.html" class="banner">About Us</a></td>' +
		            '<td width="149"><a href="../corp.html" class="banner">Corporate Outings</a></td>' +
		            '<td width="79"><a href="../lessons.html" class="banner">Lessons</a></td>' +
		            '<td width="73"><a href="../articles.html" class="banner">Articles</a></td>' +
		            '<td width="101"><a href="../testimonials.html" class="banner">Testimonials</a></td>' +
		            '<td width="130"><a href="../swingsequence.html" class="banner">Swing Sequence</a></td>' +
		            '<td width="79"><a href="../contactus.html" class="banner">Contact Us</a></td>' +
			          '</tr>' +
			        	'</table>' +
		        		'</div>';
		document.write (bodyText);
	}	
	
