
// JavaScript Document

window.onerror = function() { return true; }	// Silence any jscript errors

var pic = new Array();

function scrImage(fname, width, height, url, titlename){
	this.fname = fname;
	this.width = width;
	this.height = height;
	this.titlename = titlename;
	this.url = url;
	this.curleft = 0;
	this.obj = new Image();
   }

pic[0] = new scrImage("files/archorig.jpg",127,49,"http://www.archeryoriginals.co.uk","Pete Burgess - Custom made bow bags Etc");
pic[1] = new scrImage("files/ITFAS.jpg",127,49,"http://www.itfas.com","Irish Traditional Field Archery Society (ITFAS)");
pic[2] = new scrImage("files/LongEaton.gif",127,49,"http://www.lefa.org.uk","Long Eaton Field Archery Club");
pic[3] = new scrImage("files/merlinarch.gif",120,60,"http://www.merlinarcherycentre.co.uk","Merlin Archery Web Site");
pic[4] = new scrImage("files/NFAS.jpg",127,49,"http://www.nfas.net","National Field Archery Society(NFAS)");
pic[5] = new scrImage("files/Parcher.jpg",127,49,"http://www.primitivearcher.com","Primitive Archer");
pic[6] = new scrImage("files/quicks.jpg",142,49,"http://www.quicks.com","Quicks");
pic[7] = new scrImage("files/archersrestbanner.jpg",120,30,"http://www.archersrest.com","Archers Rest");
pic[8] = new scrImage("files/blackarrowlink.jpg",106,36,"http://www.blackarrowfac.org/","Black Arrow Field Archery Club");
pic[9] = new scrImage("files/maryroselogo.jpg",71,100,"http://www.maryrose.org/","Mary Rose ");
pic[10] = new scrImage("files/Royalarmlogo.jpg",120,22,"http://www.royalarmouries.org/","Royal Armouries");
pic[11] = new scrImage("files/salogo.jpg",130,34,"http://standard.archery.googlepages.com","Standard and Bespoke Leatherwork");
pic[12] = new scrImage("files/wales.jpg",85,85,"http://www.walesarchery.co.uk","Wales Archery");
pic[13] = new scrImage("files/clickersarchery.jpg",142,36,"http://www.clickersarchery.co.uk","Clickers");
pic[14] = new scrImage("files/perris.jpg",114,43,"http://www.perrisarchery.co.uk","Perris");
pic[15] = new scrImage("files/eclipse.jpg",142,89,"http://eclipsearchery.com","Eclipse");
pic[16] = new scrImage("files/flybow.jpg",88,18,"http://www.flybowshop.com","Flybow");
pic[17] = new scrImage("files/hermanski.jpg",142,14,"http://www.bogensportshop-hermanski.de","Hermanski");
pic[18] = new scrImage("files/bogenzeit.jpg",142,75,"http://www.langbogen.net/html/seminare.html","Bogenzeit");
pic[19] = new scrImage("files/silverarrow.jpg",85,71,"http://www.silverarrowarchery.co.uk","Silverarrow");
pic[20] = new scrImage("files/bowplus.jpg",142,47,"http://www.bow-plus.co.uk","Bowplus");

var scrollspeed = 30;

var num = pic.length;
var i;
var h;
var n;
var CIntervalTimer;		// function def
var CPauseTimer;
var scrollpause = true;		// Initally pause mode then scroll mode
var step = 2;
var defMargin = 3;	// Default margin between images
var scrollpauseMills = 1500;	// Default to 1.5 seconds (1500 milliseconds)

// Determine the initial left positions, and preload images
var	pos = 0;
try {
    for (i=0;i<num;i++){
        pic[i].obj.src = pic[i].name;
        pic[i].obj.width = pic[i].width;
        pic[i].curLeft = pos;
        // Advance the position (include offset for margin)
        pos = pos + pic[i].width + defMargin;
    }
} catch (e) {}

function InitialiseScroller(){
	scrollpause = false;
	window.clearInterval(CPauseTimer);
	CIntervalTimer = setInterval("ScrollCallback()",scrollspeed);
}	
	
function ScrollCallback(){
	try {
        for (i=0;i<num;i++){
            // Move the image left by the step amount
            pic[i].curLeft -= step;
        
            // If completely past the left margin, then move to the end of previous image in loop
            if (pic[i].curLeft <= -(pic[i].width)) {
                h = (i == 0 ? num - 1: i - 1);
                pic[i].curLeft = pic[h].curLeft + defMargin + pic[h].width;
            }	
            // Set the image left style to calc value
            document.getElementById('srcpic' + i).style.left = pic[i].curLeft + "px";
        }
    } catch (e) {}
}

function stop(){
	if (scrollpause)
		window.clearInterval(CPauseTimer);
	else
		window.clearInterval(CIntervalTimer);
	scrollpause = true;
}

function go() {
	if (scrollpause)
		CPauseTimer = setInterval("InitialiseScroller()",scrollpauseMills);
	else
		CIntervalTimer = setInterval("ScrollCallback()",scrollspeed);
}

// Start off the scroller
CPauseTimer = setInterval("InitialiseScroller()",scrollpauseMills);

function renderImages() {
	try {
        for (i=0;i<num;i++){
            document.getElementById('scrollcont').innerHTML += ('<a href="' + pic[i].url + '" target="_blank" title="' + pic[i].titlename + '"><img id="srcpic' + i + '" border="0" style="position:absolute;width:' + pic[i].width + 'px;height:' + pic[i].height + 'px;top:' + ((60 - pic[i].height) / 2) + 'px;left:' + pic[i].curLeft + 'px;" src="' + pic[i].fname + '" onmouseover="stop()" onmouseout="go()" alt="' + pic[i].titlename + '"></a>');
		}
    } catch (e) {}
}