<!--

pics=[
"/images/home_pic_1.jpg",
"/images/home_pic_2.jpg",
"/images/home_pic_3.jpg"
];

spacer=1;
speed=25;
pause=4000;
autoReverse=0; // 0 = no, 1 = yes

function initSldShow6h(){

		jsContainer=document.getElementById("cont");
		elOne=document.getElementById("pic_one");
		elTwo=document.getElementById("pic_two");
		elTwo.style.visibility="hidden";
		elOne.src=pics[0];
		running=0;
		dir="left";
		aniLeft="";
		aniRight="";
		nextLeft="";
		nextRight="";
		rev="";
		nextPic=0;
		picNum=1;
		runRate=50;
		initToLeft();
}

function initToLeft(){

	if(dir=="right"&&running==1){
		stopMe();
		setTimeout("initToLeft()",50);
	}

	if(running==1){ return; }

	running=1;

	if(dir=="right"){
		nextPic+=2;
		if(nextPic>=pics.length){
			nextPic=0;
		}
		if(picNum==1){
			elOne.src=pics[nextPic];
			elOne.style.left=jsContainer.offsetWidth+spacer+"px";
			elOne.style.top=0;
		}
		if(picNum==2){
			elTwo.src=pics[nextPic];
			elTwo.style.left=jsContainer.offsetWidth+spacer+"px";
			elTwo.style.top=0;
		}
	}

	dir="left";
	moveLeft();
	
}

function moveLeft(){

	if(picNum==1){
		elPos=parseInt(elOne.style.left);
		elOne.style.zIndex=2;
	} else{
		elPos=parseInt(elTwo.style.left);
		elTwo.style.zIndex=2;
	}

	elPos-=speed;
	aniLeft=setTimeout("moveLeft()",runRate);

	if(picNum==1){
		elOne.style.left=elPos+"px";
		elTwo.style.left=elPos-jsContainer.offsetWidth-spacer+"px";
		if(elPos<=0){
			elOne.style.left=0+"px";
			elOne.style.zIndex="";
			elTwo.style.left=jsContainer.offsetWidth+spacer+"px";
			elTwo.style.visibility="visible";
			nextPic++;
			if(nextPic>=pics.length){
				if(autoReverse==1&&running==1){
					rev=setTimeout("initToRight()",pause-500);
				} else {
					nextPic=0;
				}
			}
			elTwo.src=pics[nextPic];
			clearTimeout(aniLeft);
			if(running==1){
				nextLeft=setTimeout("moveLeft()",pause);
			}
			picNum=2;
		}
	} else {
		elTwo.style.left=elPos+"px";
		elOne.style.left=elPos-jsContainer.offsetWidth-spacer+"px";
		if(elPos<=0){
			elTwo.style.left=0+"px";
			elTwo.style.zIndex="";
			elOne.style.left=jsContainer.offsetWidth+spacer+"px";
			nextPic++;
			if(nextPic>=pics.length){
				if(autoReverse==1&&running==1){
					rev=setTimeout("initToRight()",pause-500);
				} else {
					nextPic=0;
				}
			}
			elOne.src=pics[nextPic];
			clearTimeout(aniLeft);
			if(running==1){
				nextLeft=setTimeout("moveLeft()",pause);
			}
			picNum=1;
		}
	}
}

function initToRight(){
	clearTimeout(nextLeft);
	if(dir=="left"&&running==1){
		stopMe();
		setTimeout("initToRight()",50);
	}
	if(running==1){ return; }
	running=1;

	if(dir=="left"){
		nextPic-=2;
		/* if moving left and stopped on last image then right dir chosen nextPic has passed pic.length and is reset to 0 
		additional step back is require to show correct image */
		if(nextPic== -2){ // additional step back
			nextPic=pics.length-2;
		}
		if(nextPic<0){
			nextPic=pics.length-1;
		}
		if(picNum==1){
			elOne.src=pics[nextPic];
			elOne.style.left= -jsContainer.offsetWidth+"px";
			elOne.style.top=0+"px";
			picNum=1;
		}
		if(picNum==2){
			elTwo.src=pics[nextPic];
			elTwo.style.left= -jsContainer.offsetWidth+"px";
			elTwo.style.top=0+"px";
			picNum=2;
		}
	}
	dir="right";
	moveRight();
}

function moveRight(){
	if(picNum==1){
		elPos=parseInt(elOne.style.left);
		elOne.style.zIndex=2;
	} else {
		elPos=parseInt(elTwo.style.left);
		elTwo.style.zIndex=2;
	}

	elPos+=speed;
	aniRight=setTimeout("moveRight()",runRate);

	if(picNum==1){
		elOne.style.left=elPos+"px";
		elTwo.style.left=elPos+jsContainer.offsetWidth+"px";
		if(elPos>=0){
			elOne.style.left=0+"px";
			elOne.style.zIndex="";
			elTwo.style.left= -jsContainer.offsetWidth+"px";
			nextPic--;
			if(nextPic<0){
				if(autoReverse==1&&running==1){
					rev=setTimeout("initToLeft()",pause-500);
				} else {
					nextPic=pics.length-1;
				}
			}
			elTwo.src=pics[nextPic];
			clearTimeout(aniRight);
			if(running==1){
				nextRight=setTimeout("moveRight()",pause);
			}
			picNum=2;
		}
	} else {
		elTwo.style.left=elPos+"px";
		elOne.style.left=elPos+jsContainer.offsetWidth+"px";
		if(elPos>=0){
			elTwo.style.left=0+"px";
			elTwo.style.zIndex="";
			elOne.style.left= -jsContainer.offsetWidth+"px";
			nextPic--;
			if(nextPic<0){
				if(autoReverse==1&&running==1){
					rev=setTimeout("initToLeft()",pause-500);
				} else {
					nextPic=pics.length-1;
				}
			}
			elOne.src=pics[nextPic];
			clearTimeout(aniRight);
			if(running==1){
				nextRight=setTimeout("moveRight()",pause);
			}
			picNum=1;
		}
	}
}

function stopMe(){
	running=0;
	clearTimeout(rev);
	clearTimeout(nextRight);
	clearTimeout(nextLeft);
}


// -->
