
//change value of img_width to width of images used
var img_width = 151
//change value of img_spacing to any margin or padding given to the images
var img_spacing = 20

//change value of width and height to match required container
document.write("<div style='position:relative; width:690px; height:85px;overflow:hidden;float:left'>")

//
var dwidth = (img.length*img_width)+(img.length*img_spacing);

document.write("<div id='dummy1' style='position: absolute; float:left; width:"+dwidth+"px'>")
for (i=0; i<img.length; i++)
document.write("<img src='"+img[i]+"' alt='' class='image' />")
document.write("</div>")
document.write("<div id='dummy2' style='position: absolute; float:left; width:"+dwidth+"px'>")
for (i=0; i<img.length; i++)
document.write("<img src='"+img[i]+"' alt='' class='image' />")
document.write("</div>")
document.write("</div>")

var d1 = document.getElementById("dummy1")
var d2 = document.getElementById("dummy2")
d1.style.left = "0px"
d2.style.left = dwidth + "px"

function moveleft() {
	d1.style.left = (parseInt(d1.style.left)+5)+"px"
	d2.style.left = (parseInt(d2.style.left)+5)+"px"
	if (parseInt(d1.style.left) >= dwidth)
	d1.style.left = -dwidth+"px"
	if (parseInt(d2.style.left) >= dwidth)
	d2.style.left = -dwidth+"px"
	timer = setTimeout(moveleft, 20);
}

function moveright() {
	d1.style.left = (parseInt(d1.style.left)-5)+"px"
	d2.style.left = (parseInt(d2.style.left)-5)+"px"
	if (parseInt(d1.style.left) <= -dwidth)
	d1.style.left = dwidth +"px"
	if (parseInt(d2.style.left) <= -dwidth)
	d2.style.left = dwidth +"px"
	timer = setTimeout(moveright, 20);
}

