		
		var ktr     		= 1;	// Counter used to access image arrays
		var maxPics 		= 0;	// Necessary to keep track of max images in each array
		var maxTransPics	= 6;	// Max trans images
		var maxPhotoPics	= 5;	// Max photo images
		var maxLocatePics	= 6;	// Max locate images
		var dir;			// Necessary to get directory of where images are located


		

		trans = new Array();		// for transaxle images
		photo = new Array();		// for gallary images
		locate = new Array();		// for map images

		  // Transaxle images and info
		trans[1]=  new Array("md4e.jpg"		,"MD4E         Price:  $6,395");
		trans[2]=  new Array("md4s-2d.jpg"	,"MD4S-2D      Price:  $7,395");
		trans[3]=  new Array("md5.jpg"		,"MD5          Price:  $7,500");
		trans[4]=  new Array("sandrailbus.jpg"	,"Sandrail Bus Price:  $499 - $2,725");
		trans[5]=  new Array("albins.jpg"	,"Albins - Call for Price");
		trans[6]=  new Array("customTran.jpg"	,"Custom Transaxles Available");


		photo[1]=  new Array("Sandrail-1.jpg","Mike James logging ATE frequent flyer miles");
		photo[2]=  new Array("Sandrail-2.jpg","Do NOT try this at home!");
		photo[3]=  new Array("Sandrail-3.jpg","ATE tranny's fly high over the competition!");
		photo[4]=  new Array("Sandrail-4.jpg","PRA Record Holder - 943ET @ 143.8");
		photo[5]=  new Array("Sandrail-5.jpg","Troy Smith tests his ATE transaxle.");


		  // map images
		locate[1]= new Array("location1.jpg","1x Min");
		locate[2]= new Array("location2.jpg","2x");
		locate[3]= new Array("location3.jpg","3x");
		locate[4]= new Array("location4.jpg","4x");
		locate[5]= new Array("location5.jpg","5x");
		locate[6]= new Array("location6.jpg","6x Max");


		  // This function controls the 'Show Next Image Sequence'
		function next(dir,inPhoto){
			
				//whatever image gallery we are dealing with set appropiate one
				 if (inPhoto == 'trans'){maxPics=maxTransPics;fnSwapObjZ('relElement'+ 1,'absElement'+ 1);}		//are we dealing with transaxle images?
				 if (inPhoto == 'photo'){maxPics=maxPhotoPics;fnSwapObjZ('relElement'+ 1,'absElement'+ 1);}						//are we dealing with gallery images?
				 if (inPhoto == 'locate'){maxPics=maxLocatePics;fnSwapObjZ('relElement'+ 1,'absElement'+ 1);}					//are we dealing with map images?
														
			if (ktr <= maxPics-1){										// as long as ktr is less than the number of images we have in array do this

				ktr = ktr +1;										//increment ktr
		
		
				 if (inPhoto == 'trans'){document.tranny.src =dir+trans[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ ktr);}	//if we are dealing with the transaxle images show tranny pics
				 if (inPhoto == 'photo'){document.tranny.src =dir+photo[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ ktr);}  				//if we are dealing with the gallery images show gallery pics
				 if (inPhoto == 'locate'){									//if we are dealing with map images
					if ( ktr >= maxPics+1){			//if we reach the last map image in the map array 			
						ktr = maxPics;			//keep ktr pointed to last image of map array
						return;				//exit
					}
					document.tranny.src =dir+locate[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ ktr);			//show map images
				 }	// end locate [map images]
			
			return ktr;	
			} else {								//if ktr is greater than the max pics 
				ktr = 1;							//reset ktr to point to first image
				 if (inPhoto == 'trans'){document.tranny.src =dir+trans[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ 1);}	//if dealing with tranny images show tranny images
				 if (inPhoto == 'photo'){document.tranny.src =dir+photo[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ 1);}	//if dealing with gallery images show gallery images
				 if (inPhoto == 'locate'){					//if dealing with map images
					if ( ktr <= maxPics+1){					//check to see if ktr less than maxpics
						ktr = maxPics;
						return;
					}
					document.tranny.src =dir+locate[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ ktr);

				  }//end locate
			return ktr;
			}//end ktr check
			
		}//end function

		  // This function controls the 'Show Prev Image Sequence'
		function prev(dir,inPhoto){

				 if (inPhoto == 'trans'){maxPics=maxTransPics;fnSwapObjZ('relElement'+ maxTransPics,'absElement'+ maxTransPics);}
				 if (inPhoto == 'photo'){maxPics=maxPhotoPics;fnSwapObjZ('relElement'+ maxPhotoPics,'absElement'+ maxPhotoPics);}
				 if (inPhoto == 'locate'){maxPics=maxLocatePics;fnSwapObjZ('relElement'+ maxLocatePics,'absElement'+ maxLocatePics);}

			
			if (ktr > 1){
				ktr = ktr -1;
				 if (inPhoto == 'trans'){document.tranny.src =dir+trans[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ktr);}
				 if (inPhoto == 'photo'){document.tranny.src =dir+photo[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ktr);}
				 if (inPhoto == 'locate'){

					if(ktr <= maxPics-maxPics-1){
						ktr=1;
						return;
					}
					document.tranny.src =dir+locate[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ktr);
				  }
			} else {
				ktr = maxPics;
				 if (inPhoto == 'trans'){document.tranny.src =dir+trans[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ktr);}
				 if (inPhoto == 'photo'){document.tranny.src =dir+photo[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ktr);}
				 if (inPhoto == 'locate'){

					if(ktr >=maxPics-maxPics-1){
						ktr=1;
						return;
					}
					document.tranny.src =dir+locate[ktr][0];fnSwapObjZ('relElement'+ ktr,'absElement'+ktr);

				 }
			}
		}




		  //This function sets up the appropaite amount of divs necessary to hold the text strings of photos
		function getDivClass(inDivClass) {

				var val=whichArray(inDivClass);

				
				setDivClass('relElement','relative',0,0,10,dispMainWidth,'','');

				for(a=1;a<=val;a++)
				{

					setDivClass('absElement'+a,'absolute',0,10,20,dispMainWidth,'#EFFFFC','black');
				}
		}


		  //This function write the class necessary for the divs that will hold the text strings of each photo
		function setDivClass(className,position,left,top,height,width,bggcolor,fggcolor,zindex,marginLeft,marginRight,marginTop) {

			document.writeln('.'+className+' {');
				document.writeln('position:'+position+';');
				document.writeln('left:'+left+'px;');
				document.writeln('top:'+top+'px;');
				document.writeln('height:'+height+';');
				document.writeln('width:'+width+';');
				document.writeln('background-color:'+bggcolor+';');
				document.writeln('color:'+fggcolor+';');
				document.writeln('z-index:'+zindex+';');
				document.writeln('margin-left:'+marginLeft+';');
				document.writeln('margin-right:'+marginRight+';');
				document.writeln('margin-top:'+marginTop+';');
				
			document.writeln('}');
		}

		  //this function writes the divs to the webpage
		function setDiv(inDiv,inStr) {
			
			var val=whichArray(inDiv);

			document.write('<div id="relElement" class="relElement">');
				for(a=1;a<val+1;a++){
				     document.write('<div id="absElement'+a+'" class="absElement'+a+'"    >');
					 document.writeln('<center>');
					 document.writeln('<b>');
					
					 if(inDiv=='trans'){document.writeln(trans[a][1]);}
					 if(inDiv=='photo'){document.writeln(photo[a][1]);}
					 //if(inDiv=='locate'){document.writeln(locate[a][1]);}

					 document.writeln('</b>');
					 document.writeln('</center>');					
					

				     document.write('</div>')
				}
			document.write('</div>');
		}



		  //check to see what array we are using		
		function whichArray(inArray) {

			var val;

			val=inArray;

			//whatever image gallery we are dealing with set appropiate one
			 if (inArray == 'trans'){val=maxTransPics;}		//are we dealing with transaxle images?
			 if (inArray == 'photo'){val=maxPhotoPics;}		//are we dealing with gallery images?
			 if (inArray == 'locate'){val=maxLocatePics;}		//are we dealing with map images?

			 return val;
		}



		//This function is used to set ktr so that we can access the desired element within an array
		function setKtr(inVal) {
			ktr = inVal;

		}






















