// ********** Editing beyond this line is not required **********

first_img_num-- // adjust for javascript count 
last_img_num-- // adjust for javascript count 
if(first_img_num== -1){ // check for javascript count 
first_img_num=0
}
if(last_img_num>data.length-1){
last_img_num=data.length-1
}
display_width=(img_places*img_width)+(img_places*img_spacer)
initpos=new Array()
nowdivpos=new Array()
next_right=""
nextpic=first_img_num
run_rate=10

function init(){
if(scroll_all_images==1){
nextpic=0
}
document.write("<div id=\"display\" style=\"position:absolute; left:"+display_left+"; top:"+display_top+"; width:"+(display_width+display_border*2)+"px; height:"+(img_height+display_border*2)+"px; border:"+display_border+"px "+border_type+" "+border_colour+";background-color:"+display_bgcol+"\">")

if(display_center==1){
document.getElementById("display").style.left=(document.body.clientWidth/2)-(document.getElementById("display").offsetWidth/2)
}

document.write("<div  id=\"center_div\" style=\"position:absolute; left:0; top:0; width:"+display_width+"px; height:"+img_height+"px; clip:rect(0,"+display_width+","+img_height+",0)\" onmouseover=\"stopme()\" onmouseout=\"move_right()\">")

for(i=0;i<img_places+1;i++){
document.write("<div id=\"div_"+[i]+"\" style=\"position:absolute\">")
document.write("<a id=\"loc"+[i]+"\" href=\"\" onclick=\"newwin('changer',this.location);return false\"><img src=\"\" id=\"pic_"+[i]+"\" width="+img_width+" height="+img_height+" alt=\"Image Slides\" border=\"0\"></a></div>")
}
document.write("</div>")
document.write("</div>")
el_center=document.getElementById("center_div")
elpos=-document.getElementById("pic_0").width//parseInt(el_center.style.width)-document.getElementById("pic_0").width

for(i=0;i<img_places+1;i++){
elpos+=(document.getElementById("pic_0").width)+img_spacer
initpos[i]=elpos
document.getElementById("div_"+[i]).style.left=initpos[i]

if(scroll_all_images==0&&nextpic>last_img_num){
nextpic=first_img_num
document.getElementById("loc"+[i]).location=data[nextpic][1]
document.getElementById("pic_"+[i]).src=data[nextpic++][0]
}
else{
document.getElementById("loc"+[i]).location=data[nextpic][1]
document.getElementById("pic_"+[i]).src=data[nextpic++][0]
}

}

move_right()
}

function move_right(){
for(i=0;i<img_places+1;i++){
nowdivpos[i]=parseInt(document.getElementById("div_"+i).style.left)
nowdivpos[i]-=speed

if(nowdivpos[i]<= -document.getElementById("pic_0").width){
document.getElementById("div_"+[i]).style.left=parseInt(el_center.style.width)+img_spacer

if(scroll_all_images==0&&nextpic>last_img_num){
nextpic=first_img_num
document.getElementById("loc"+[i]).location=data[nextpic][1]
document.getElementById("pic_"+[i]).src=data[nextpic++][0]
}
else{
if(nextpic>data.length-1){
nextpic=0
}
document.getElementById("loc"+[i]).location=data[nextpic][1]
document.getElementById("pic_"+[i]).src=data[nextpic++][0]
}

}
else{
document.getElementById("div_"+[i]).style.left=nowdivpos[i]
}

}
next_right=setTimeout("move_right()",run_rate)

}

function stopme(){
clearTimeout(next_right)
}

function newwin(imgnam,loc){
document.images[imgnam].src = loc
{return}
//window.open(loc)
//-- window.open(loc,'','left=200,top=200,width=300,height=300') // use for specific size and positioned window
}

// add onload="init()" and style="overflow-x:hidden" to the opening BODY tag

// place <script>init()</script> after the opening BODY tag

// -->
