pics=[
"fileadmin/images_sng/diashow/referenzen/diashow_4/1.jpg",
"fileadmin/images_sng/diashow/referenzen/diashow_4/2.jpg",
"fileadmin/images_sng/diashow/referenzen/diashow_4/3.jpg",
"fileadmin/images_sng/diashow/referenzen/diashow_4/4.jpg",
"fileadmin/images_sng/diashow/referenzen/diashow_4/5.jpg",
"fileadmin/images_sng/diashow/referenzen/diashow_4/6.jpg",
"fileadmin/images_sng/diashow/referenzen/diashow_4/7.jpg"
//"fileadmin/images_sng/diashow/referenzen/diashow_4/8.jpg",
//"fileadmin/images_sng/diashow/referenzen/diashow_4/9.jpg",
//"fileadmin/images_sng/diashow/referenzen/diashow_4/10.jpg", // no comma at end of last index

]

spacer=1
speed=15

function initSlideshow2(){
container=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=""
nextPic=0
divNum=1
runRate=50
initToLeft() // start on load
}

function initToLeft(){
if(dir=="right"&&running==1){
running=0
return
}

if(running==1){return}
running=1

if(dir=="right"){
nextPic+=2

if(nextPic>=pics.length){nextPic=0}

if(divNum==1){
elOne.src=pics[nextPic]
elOne.style.left=container.offsetWidth+spacer
elOne.style.top=0
}

if(divNum==2){
elTwo.src=pics[nextPic]
elTwo.style.left=container.offsetWidth+spacer
elTwo.style.top=0
}

}

dir="left"
moveLeft()
}

function moveLeft(){

if(divNum==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(divNum==1){
elOne.style.left=elPos
elTwo.style.left=elPos-container.offsetWidth-spacer

if(elPos<=0){
elOne.style.left=0
elOne.style.zIndex=""
elTwo.style.left=container.offsetWidth+spacer
elTwo.style.visibility="visible"
nextPic++

if(nextPic>=pics.length){nextPic=0}

elTwo.src=pics[nextPic]
clearTimeout(aniLeft)

if(running==1){running=0}

divNum=2
}

}
else{
elTwo.style.left=elPos
elOne.style.left=elPos-container.offsetWidth-spacer

if(elPos<=0){
elTwo.style.left=0
elTwo.style.zIndex=""
elOne.style.left=container.offsetWidth+spacer
nextPic++

if(nextPic>=pics.length){nextPic=0}

elOne.src=pics[nextPic]
clearTimeout(aniLeft)

if(running==1){running=0}

divNum=1
}

}

}


function initToRight(){

if(dir=="left"&&running==1){
running=0
return
}

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){nextPic=pics.length-2} // additional step back

if(nextPic<0){nextPic=pics.length-1}

if(divNum==1){
elOne.src=pics[nextPic]
elOne.style.left= -container.offsetWidth
elOne.style.top=0
divNum=1
}

if(divNum==2){
elTwo.src=pics[nextPic]
elTwo.style.left= -container.offsetWidth
elTwo.style.top=0
divNum=2
}

}

dir="right"
moveRight()
}

function moveRight(){

if(divNum==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(divNum==1){
elOne.style.left=elPos
elTwo.style.left=elPos+container.offsetWidth

if(elPos>=0){
elOne.style.left=0
elOne.style.zIndex=""
elTwo.style.left= -container.offsetWidth
nextPic--

if(nextPic<0){nextPic=pics.length-1}

elTwo.src=pics[nextPic]
clearTimeout(aniRight)

if(running==1){running=0}

divNum=2
}

}
else{
elTwo.style.left=elPos
elOne.style.left=elPos+container.offsetWidth

if(elPos>=0){
elTwo.style.left=0
elTwo.style.zIndex=""
elOne.style.left= -container.offsetWidth
nextPic--

if(nextPic<0){nextPic=pics.length-1}

elOne.src=pics[nextPic]
clearTimeout(aniRight)

if(running==1){running=0}

divNum=1
}

}

}
