imgPlaces=2
imgWidth=360
imgHeight=240
imgSpacer=5

dir=0

newWindow=0



moz=document.getElementById&&!document.all

step=2
timer=""
speed=50
nextPic=0
initPos=new Array()
nowDivPos=new Array()

function initHIS3(){

for(var i=0;i<imgPlaces+1;i++){ 
newImg=document.createElement("IMG")
newImg.setAttribute("id","pic_"+i)
newImg.setAttribute("src","")
newImg.style.position="absolute"
newImg.style.width=imgWidth+"px"
newImg.style.height=imgHeight+"px"
newImg.style.border=0
newImg.alt=""
newImg.onmouseover=function(){stopHIS3()}
newImg.i=i
document.getElementById("display_area").appendChild(newImg)

var a = document.createElement('a');
a.href = '';
a.setAttribute("id","link_"+i)
a.rel = 'lightbox[gal]';
a.onclick=new Function('F','myLightbox.start(this); return false;'); // safari/ie fix
var txt = document.createTextNode('textnode');
a.appendChild( newImg );
var Ausgabebereich = document.getElementById("display_area");
Ausgabebereich.appendChild(a);

}

containerEL=document.getElementById("his3container")
displayArea=document.getElementById("display_area")
linkL=document.getElementById("scrollL")
linkR=document.getElementById("scrollR")
pic0=document.getElementById("pic_0")

containerBorder=(document.compatMode=="CSS1Compat"?0:parseInt(containerEL.style.borderWidth)*2)
containerWidth=(imgPlaces*imgWidth)+((imgPlaces-1)*imgSpacer)
containerEL.style.width=containerWidth+(!moz?containerBorder:"")+"px"
containerEL.style.height=imgHeight+(!moz?containerBorder:"")+"px"

displayArea.style.width=containerWidth+"px"
displayArea.style.clip="rect(0,"+(containerWidth+"px")+","+(imgHeight+"px")+",0)"
//displayArea.onmouseover=function(){stopHIS3()}
displayArea.onmouseout=function(){scrollHIS3(0)}
imgPos= -pic0.width

for(var i=0;i<imgPlaces+1;i++){
currentImage=document.getElementById("pic_"+i)
currentLink=document.getElementById("link_"+i)

if(dir==0){imgPos+=pic0.width+imgSpacer} 

initPos[i]=imgPos
if(dir==0){currentImage.style.left=initPos[i]+"px"}

if(dir==1){
document.getElementById("pic_"+[(imgPlaces-i)]).style.left=initPos[i]+"px"
imgPos+=pic0.width+imgSpacer
}

if(nextPic==data.length){nextPic=0}

currentImage.src=data[nextPic][0]
currentLink.href=data[nextPic][2]
currentLink.title=data[nextPic][1]
currentImage.i=nextPic
nextPic++
}

scrollHIS3(0)
}

timer=""

function scrollHIS3(dir){
clearTimeout(timer)
for(var i=0;i<imgPlaces+1;i++){
currentImage=document.getElementById("pic_"+i)
currentLink=document.getElementById("link_"+i)

nowDivPos[i]=parseInt(currentImage.style.left)

if(dir==0){nowDivPos[i]-=step}
if(dir==1){nowDivPos[i]+=step}

if(dir==0&&nowDivPos[i]<= -(pic0.width+imgSpacer) || dir==1&&nowDivPos[i]>containerWidth){

if(dir==0){currentImage.style.left=containerWidth+imgSpacer+"px"}
if(dir==1){currentImage.style.left= -pic0.width-(imgSpacer*2)+"px"}

if(nextPic>data.length-1){nextPic=0}

currentImage.src=data[nextPic][0]
currentLink.href=data[nextPic][2]
currentImage.alt=data[nextPic][1]
currentImage.i=nextPic

nextPic++

}
else{
currentImage.style.left=nowDivPos[i]+"px"
}

}
timer=setTimeout("scrollHIS3("+dir+")",speed)

}

function stopHIS3(){
clearTimeout(timer)
}

function scrollL(){
	stopHIS3()
	displayArea.onmouseout=function(){scrollHIS3(0)}
	timer=setTimeout("scrollHIS3(0)",speed)
}

function scrollR(){
	stopHIS3()
	displayArea.onmouseout=function(){scrollHIS3(1)}
	timer=setTimeout("scrollHIS3(1)",speed)
}

function his3Win(loc){
if(loc==""){return}
if(newWindow==0){
location=loc
}
else{
//window.open(loc)
newin=window.open(loc,'win1','left=430,top=340,width=300,height=300')
newin.focus()
}
}
