// JavaScript Document
		var picCount=0;
		var picList = new Array();
		var carouselWidth = "600";
		var firstTop = "54";
		var firstLeft = "10";
		var currentLeft = firstLeft;
		var currentTop = firstTop;
		var direction = "right";
		var priorHeight;
		var picNo=0;
		var spacer = 20; 
		var spacer2 = 40;
		var boundary = new Array();	
		var firstRowCnt;
		var backTop;



	function runCarousel() {
		// Setup
		picList[0] = new Array("zapato power.jpg", 92, 126, "zapato.htm");
		picList[1] = new Array("zapato2.jpg", 92, 126, "zapato second.htm");
		picList[2] = new Array("zapato3.jpg", 88, 126, "zapato third.htm");
//		picList[3] = new Array("zapato power 4.jpg", 88, 126, "zapato fourth.htm");
		picList[3] = new Array("campshalom.jpg", 151, 126, "camp.htm");
// picList[3] = new Array("campshalom.jpg", 92, 76);
		picList[4] = new Array("duck.jpg", 101, 126, "duck.htm");
		picList[5] = new Array("unite.jpg", 97, 126, "unite.htm");
		picList[6] = new Array("SarahLaughs.jpg", 111, 126, "Sarah.htm");
		picList[7] = new Array("noenglish.jpg", 113, 126, "NoEnglish.htm");
//		picList[8] = new Array("Miriam.jpg", 127, 126, "Miriam.htm");
		picList[8] = new Array("hardestword.jpg", 99, 126, "hardestword.htm");
		picList[9] = new Array("zapato power 4.jpg", 88, 126, "zapato fourth.htm");
		picCount = picList.length;
		boundary[0] = carouselWidth/(picCount/2);
		boundary[1] = 2*boundary[0];
		boundary[2] = 3*boundary[0];
		boundary[3] = 4*boundary[0];
		boundary[4] = 5*boundary[0];
		firstRowCnt = Math.round(picCount/2);
		var totalPicWidth = 0;

		for (i = 0; i < firstRowCnt; i++){
			totalPicWidth = totalPicWidth + parseInt(picList[i][1]);
		}
		spacer = Math.round((carouselWidth-totalPicWidth)/(firstRowCnt-1));
		for (i = 0; i <= picCount-1; i++){ 
			picNo = i+1;
			myPic = document.getElementById("pic"+picNo);
			myPic.onclick = Function ("document.location = '" + picList[i][3] + "'");
			myPic.style.display="inline";
			myPic.className = "front";
			myPic.src = "images/" +picList[i][0];
			myPic.width = picList[i][1];
			myPic.height = picList[i][2];
			myPic.widFull = myPic.width;
			myPic.htFull = myPic.height;
			myPic.htSmall = myPic.height*.5;
			myPic.widSmall = myPic.width*.5;
			myPic.htMed = myPic.height*.9;
			myPic.widMed = myPic.width*.9
			myPic.direction = "right";
			if ((picNo+1) <= picCount) {
				myPic.picinway = "pic" + (picNo+1) ;
			} else {
				myPic.picinway = "pic1";
			}
			switch(true) {
				case i==0: 
//					myPic.className = "front";
					myPic.width=myPic.widMed;
 					myPic.height=myPic.htMed;
					myPic.style.left = currentLeft+'px';
					myPic.style.top = currentTop+'px';
					myPic.style.zIndex=1000;
					myPic.direction = "down";
					
					break;
				case i > 0:
					switch (direction) {
						case "right": 
							if((currentLeft+priorWidth+spacer+myPic.width)<carouselWidth){
								myPic.style.left = (currentLeft+priorWidth +spacer)+'px';
								myPic.style.top = currentTop +'px';
								myPic.style.zIndex=1000;
								break;
							} else { 
							/*	myPic.width = myPic.width/2;
								myPic.height = myPic.height/2; */
							//	myPic.style.left = carouselWidth-myPic.width + 'px';
								myPic.width = myPic.widMed;
								myPic.height = myPic.htMed;
								myPic.style.left = (currentLeft+priorWidth + spacer)+'px';
								myPic.style.top = currentTop +'px';
								myPic.style.zIndex = 500;
								direction = "back";
								break;
							}
							
						case "back":
								myPic.width = myPic.widSmall;
								myPic.height = myPic.htSmall;
								myPic.style.zIndex=1;
								backTop = firstTop-10;
								myPic.direction = "left";

/*						if (currentTop - priorHeight >0) {
							if (currentTop - myPic.height > 0) {
								currentTop = currentTop-priorHeight-spacer;
								currentTop = currentTop - myPic.height; */
								myPic.style.top = backTop+'px';
								myPic.style.left = currentLeft+'px';
								direction="left";
								break;
/*							} else {
								currentTop = firstTop-20;
								myPic.style.top = currentTop+'px';
								myPic.style.left = (currentLeft - priorWidth - spacer)+'px';
								break;
							}*/
						case "left":
							myPic.width=myPic.widSmall;
							myPic.height=myPic.htSmall;
							myPic.style.top = backTop+'px';
							currentLeft = currentLeft-priorWidth*2-spacer;
							if(currentLeft<firstLeft) currentLeft = firstLeft;
							myPic.style.left = currentLeft+'px';
							myPic.direction="left";
							myPic.loc = 0;


							break;

					} // end switch 2

			} // end switch 1
			priorWidth=myPic.width;
			priorHeight=myPic.height
			currentLeft = parseInt(myPic.style.left);
			myPic.loc = i+1;
		} //end for loop
// Setup complete
// Begin moving

		var m = doMove();
	} // end function carousel

	function doMove() {
		for (i=1; i<=10; i++){
			myPic = document.getElementById("pic"+i);
			myPic.right = parseInt(myPic.style.left)+myPic.width+1;
			switch(myPic.direction) {
				case "down":
					if (parseInt(myPic.style.top) < firstTop){
						myPic.style.top = (parseInt(myPic.style.top)+1)+'px';

					} else {

						var picInWay = document.getElementById(myPic.picinway);

						myPic.right = parseInt(myPic.style.left)+myPic.width;
						if(parseInt(picInWay.style.left)- myPic.right >= spacer){
						myPic.height = myPic.htMed;
						myPic.width = myPic.widMed;
						if(myPic.id=="pic1") {
							
							document.getElementById("pic"+picCount).style.zIndex = 500;		

						}
		
						myPic.direction = "right";
						myPic.loc = 1;
						moveRight();
					}
				}
				break;
				case "right": 
					myPic.style.zIndex = 1000;
myPic.height = myPic.htFull;
myPic.width = myPic.widFull;
					if (myPic.loc == 5){
						if (myPic.right < carouselWidth-spacer){
							moveRight();
						} else {
							myPic.style.zIndex = 500;
							if (parseInt(myPic.style.top)>backTop){
								myPic.style.top = (parseInt(myPic.style.top)-1)+'px';
							} else {
//								myPic.direction = "left";
								myPic.direction = "back";
								myPic.loc = 0;
								myPic.style.zIndex = 1;
								myPic.height=myPic.htSmall;
								myPic.width=myPic.widSmall;

							}
						}// end if
					}// end if

					if (myPic.loc < 5) {
						moveRight();
						switch (true){
							case myPic.right == boundary[1]-spacer:
								myPic.loc = 2;
							break;
							case myPic.right == boundary[2]-spacer:
								myPic.loc = 3;
							break;
							case myPic.right == boundary[3]-spacer:
								myPic.loc = 4;
							break;
							case myPic.right == boundary[4]-spacer:
								myPic.loc = 5;
							break;
						} // end switch
					} // end if
				break; //case right

				case "left":
					myPic.style.zIndex = 1;
					if(myPic.style.left>firstLeft){
						myPic.style.left = (parseInt(myPic.style.left)-1)+'px';
					} else {
						myPic.direction = "down";
						myPic.height = myPic.htMed;
						myPic.width = myPic.widMed;

myPic.style.zIndex = 500;
if(myPic.id == "pic10") myPic.style.zIndex = 400;


/*						if (parseInt(myPic.style.top) < firstTop){
							myPic.style.top = (parseInt(myPic.style.top)+1)+'px';
						} else {
							myPic.direction = "right";
							myPic.loc = 1;
						}*/
							
					}
						
				break;
				case "back":
					// Wait for space to move
					// Get prior pic id

					var myId = myPic.id;
					var picNum = myId.slice(3);
					var picInWayNum;
					var picInWay;
					if(parseInt(picNum) + 1 <= picCount){
						picInWayNum = parseInt(picNum)+1;
					} else {
						picInWayNum = 1;
					}
				picInWayId = "pic"+picInWayNum;
				var picInWay = document.getElementById(picInWayId);
				picInWay.right = parseInt(picInWay.style.left)+picInWay.width;
				if(parseInt(myPic.style.left)-picInWay.right >= spacer){
					myPic.direction = "left";
				}
				break;

			} // end switch

		} // end for
//		myPic.style.left = 100+'px';


		setTimeout("doMove()", 40);
	} // end function doMove


	function moveRight(picid, picleft){
		myPic.style.left = (parseInt(myPic.style.left)+1)+'px';
	}

	
	



