//Array Of Image, [URL, width of Image, LinkTo, Title/Alt]
var t;
var StepTime=10;
var StepPixel=0.5;
var ImgPadding=6;
var ParentDivLen=700;
var Img = new Array();
/*
["/images/retailer-logos/large/findmeamobile.gif", 161, "/findmeamobile.html", "FindMeAMobile"], 
["/images/retailer-logos/large/mobiles2yourdoor.gif", 161, "/mobiles2yourdoor.html", "Mobiles2YourDoor"], 
["/images/retailer-logos/large/buymobilephones.gif", 161, "/buymobilephones.net.html", "BuyMobilePhones.net"], 
["/images/retailer-logos/large/dialaphone.gif", 161, "/dialaphone.html", "Dialaphone"], 
["/images/retailer-logos/large/phones4u.gif", 161, "/phones-4u.html", "Phones 4U"], 
["/images/retailer-logos/large/mobiles.gif", 161, "/mobiles.co.uk.html", "Mobiles.co.uk"], 
["/images/retailer-logos/large/orange.gif", 161, "/orange-shop.html", "Orange Shop"], 
["/images/retailer-logos/large/vodafone.gif", 161, "/vodafone-shop.html", "Vodafone Shop"], 
["/images/retailer-logos/large/3store.gif", 161, "/3-store.html", "3 Store"], 
["/images/retailer-logos/large/t-mobile.gif", 161, "/t-mobile-shop.html", "T-Mobile Shop"], 
["/images/retailer-logos/large/thelink.gif", 161, "/the-link.html", "The Link"], 
["/images/retailer-logos/large/new-vanilla-mobile2.gif", 161, "/the-phonespot.com.html", "The Phonespot.com"], 
["/images/retailer-logos/large/woolworths.gif", 161, "/woolworths.html", "Woolworths"], 
["/images/retailer-logos/large/tesco.gif", 161, "/tesco.html", "Tesco"], 
["/images/retailer-logos/large/argos.gif", 161, "/argos.html", "Argos"], 
["/images/retailer-logos/large/o2.gif", 161, "/o2-shop.html", "O2 Shop"], 
["/images/retailer-logos/large/affordablemobiles.gif", 161, "/affordable-mobiles.html", "Affordable Mobiles"], 
["/images/retailer-logos/large/virgin-mobile.gif", 161, "/virgin-mobile-shop.html", "Virgin Mobile Shop"], 
["/images/retailer-logos/large/mobilephonecentral.gif", 161, "/mobile-phone-central.html", "Mobile Phone Central"]);
*/
var Pos=0;
var Len=0;

var DivWidth=0;
var MoreImage=0; 

function goURL(URLS)
{
	document.location.href=URLS;
}

function getE(id)
{
	return document.getElementById(id);
}

function Dr_Img(IMG)
{
	return '<a title="' + IMG[3] + '" href="' + IMG[2] + '"><img alt="' + IMG[3] + '" src="'+ IMG[0] + '"></a>';
}

function Dr_ImgArr()
{
	var str='';
	for(i=0;i<Len;i++) str += Dr_Img(Img[i]);
	for(i=0;i<MoreImage;i++)str += Dr_Img(Img[i]);
	document.getElementById('ChildDiv').innerHTML = str;
}

function DoSlide()
{
	if(Pos==0)Pos=-1;
	divtg=getE('ChildDiv');
	Pos-=StepPixel;
	if(Pos<-DivWidth)Pos=0;
	divtg.style.left=Pos +'px';
	t=setTimeout('DoSlide()',StepTime);
}

function SlideStop()
{
    clearTimeout(t);
}
function setmouse(id)
{
    if(id==1)
    {
        DoSlide();
    }
    else
    {
        SlideStop();
    }
}

addLoadListener(function()
{
	if(document.getElementById("ChildDiv"))
	{
		init();
		Dr_ImgArr();
		DoSlide();
	
		div = document.getElementById('ChildDiv');
		attachEventListener(div, "mouseover", SlideStop, false);
		attachEventListener(div, "mouseout", DoSlide, false);
	}
});

function init() {
	childDiv = document.getElementById("ChildDiv");
	links = childDiv.getElementsByTagName("a");
	imgs = childDiv.getElementsByTagName("img");

	for(var i=0; i<links.length; i++) {
		Img[i] = new Array(imgs[i].src,161,links[i].href, links[i].title);
	}
	
	Len = Img.length;
	
	for(i=0;i<Len;i++)
	{
		DivWidth+=Img[i][1] + ImgPadding*2;
		if(MoreImage==0 && DivWidth>ParentDivLen)MoreImage=i+1;
	}
}