﻿	// external script -- gaits.js"			function doKeyDwn(pEvnt) { // called by keyboard key press			//alert("In doKeyDwn"); // debug alert			mID = document.getElementById("stepsDiv");			if (mID.style.display!="block") return; // ignore keydown unless in Individual Step mode			evntRef = (pEvnt) ? pEvnt : ((window.event) ? event : null); // get ref to event object					//alert("evntRef.keyCode = " + evntRef.keyCode); // debug alert			if (evntRef.keyCode == 37)  oneStep('back'); // keyboard < pressed, go one step back			if (evntRef.keyCode == 39)  oneStep('for'); // keyboard > pressed, go one step forward					if (evntRef.stopPropagation()) evntRef.stopPropagation; // stops Sarfari double action				}		function goPage(pWhere) { // called by navigation table buttons					// alert("In goPage"); // debug alert					document.location.href = pWhere;		}		function classChange(pElemRef, pClass) { // called by target element to change its class			//alert("In classChange");// debug alert			pElemRef.className=pClass;		}				function butChange(pElemRef, pClass) { // called by motion buttons to change class if not target class			//alert("In classChange");// debug alert			if (pElemRef.className != "target") pElemRef.className=pClass;		}								function butOther(pID, pClass) { // called by other motion button to exit target state			//alert("In butOther");// debug alert			var mID=document.getElementById(pID);			mID.className=pClass;		}				function switchMotion(pID,pSrc) {			//alert ("switchMotion, pID = " + pID); // debug alert			var mID = document.getElementById(pID);			mID.src=pSrc;		}		function doSteps() {  // called by Individual button			//alert ("In doSteps"); // debug alert			var mSrc = "images/" + gPrefix + gCurrStp + "-Opt.gif"; // generate name of current image file (eg, Rot3-Opt.gif)			var mID = document.getElementById("motionDiv");			mID.style.display="none"; // hide the motion <div>			mID = document.getElementById("stepsDiv");			mID.style.display="block"; // show the steps <div>			mID = document.getElementById("stepsGif");						mID.src=mSrc; // display the current step <img>						mID = document.getElementById("stepsCycleDiv");			mID.style.display="block"; // show the steps cyccle pattern <div>		}		function doMotion() {  // called by Show Motion button			//alert ("In doMotioon"); // debug alert			var mID = document.getElementById("motionDiv");			mID.style.display="block"; // show the motion <div>			mID = document.getElementById("stepsDiv");			mID.style.display="none"; // hide the steps <div>			mID = document.getElementById("stepsCycleDiv");			mID.style.display="none"; // hide the steps cyccle pattern <div>		}		function oneStep(pDirection) {  // called by Step Back/Forward buttons			//alert ("In oneStep, pDirection = " + pDirection); // debug alert			if (pDirection == "for") { // step forward				if (gCurrStp == gMaxStp) { gCurrStp = 1;} // at last, go to first				else {gCurrStp++;} // increment current step			}			if (pDirection == "back") { // step backward				if (gCurrStp == 1) { gCurrStp = gMaxStp;} // at first, jump to last				else {gCurrStp--;}// decrement current step			}			var mSrc = "images/" + gPrefix + gCurrStp + "-Opt.gif";// generate name of current image file (eg, Rot3-Opt.gif)			//alert ("mSrc = " + mSrc); // debug alert			var mID = document.getElementById("stepsGif"); // get reference to <img>			mID.src = mSrc; //define new src for <img>				}