// RIL1.0 :: Random image link
// ***********************************************
// DOM scripting by brothercake -- http://www.brothercake.com/
// Original concept by Andy Clarke -- http://www.stuffandnonsense.co.uk/
// Create element and attributes based on a method by beetle -- http://www.peterbailey.net/
// Modified by TMB
//************************************************

function randomImageLink() {

var button = new imageLink('rdm_autorep');

//add possibilities ('href', 'title text', 'src', 'width', 'height', 'alt text')

 button.addLink("autom_FordUSArep06.html","New","../afb/HA/C26609.jpg");
 button.addLink("autom_Chevroletrep12.html","New","../afb/HA/C28430.jpg");
 button.addLink("autom_Chevroletrep09.html","New","../afb/HA/C28430.jpg");
 button.addLink("autom_Infinityrep.html","New","../afb/HA/C52200.jpg");
 button.addLink("autom_Nissanrep.html","New","../afb/HA/C52200.jpg");
 button.addLink("autom_Toyotarep10.html","New","../afb/HA/C68650.jpg");
 button.addLink("autom_Peugeotrep04.html","New","../afb/ET/24023.jpg");
 button.addLink("autom_Mgrep06.html","New","../afb/BL/MGFEM.jpg");
 button.addLink("autom_Toyotarep02.html","New","../afb/HA/92009.jpg");
 button.addLink("autom_Lexusrep02.html","New","../afb/HA/92009.jpg");
 button.addLink("autom_Triumphrep02.html","New","../afb/BL/T153HH.jpg");
 button.addLink("autom_Fordrep02.html","New","../afb/HA/4900.jpg");
 button.addLink("autom_BMWrep12.html","New","../afb/HA/4901.jpg");
 button.addLink("autom_Fordrep10.html","New","../afb/HA/4907.jpg");
 button.addLink("autom_BMWrep02.html","New","../afb/HA/4918.jpg");
 button.addLink("autom_Toyotarep.html","New","../afb/HA/4921.jpg");
 button.addLink("autom_Peugeotrep16.html","New","../afb/HA/4923.jpg");
 button.addLink("autom_Fordrep13.html","New","../afb/PP/03133.jpg");
 button.addLink("autom_Fiatrep10.html","New","../afb/PP/03255.jpg");
 button.addLink("autom_Vwrep39.html","New","../afb/PP/03321.jpg");
 button.addLink("autom_Skodarep3.html","New","../afb/PP/20678.jpg");
 button.addLink("autom_Vwrep18.html","New","../afb/PP/20698.jpg");
 button.addLink("autom_Vwrep18.html","New","../afb/PP/20694.jpg");
 button.addLink("autom_Vwrep35.html","New","../afb/PP/20697.jpg");
 button.addLink("autom_AlfaRomeorep04.html","New","../afb/ET/23151.jpg");
 button.addLink("autom_BMWrep02.html","New","../afb/ET/23152.jpg");
 button.addLink("autom_Fiatrep07.html","New","../afb/ET/23153.jpg");
 button.addLink("autom_Opelrep12.html","New","../afb/ET/23156.jpg");
 button.addLink("autom_Renaultrep25.html","New","../afb/ET/23157.jpg");
 button.addLink("autom_Citroenrep22.html","New","../afb/ET/23661.jpg");
 button.addLink("autom_Vwrep35.html","New","../afb/ET/23662.jpg");
 button.addLink("autom_Fiatrep10.html","New","../afb/ET/23663.jpg");
 button.addLink("autom_Renaultrep21.html","New","../afb/ET/23664.jpg");
 button.addLink("autom_Suzukirep.html","New","../afb/ET/23665.jpg");
 button.addLink("autom_Citroenrep23.html","New","../afb/ET/23666.jpg");
 button.addLink("autom_Peugeotrep21.html","New","../afb/ET/23679.jpg");
 button.addLink("autom_MercedesBenzrep12.html","New","../afb/ET/23680.jpg");
 button.addLink("autom_Renaultrep29.html","New","../afb/ET/23683.jpg");
 button.addLink("autom_Oldsmobilerepm.html","New","../afb/BL/SA172.jpg");
 button.addLink("autom_Oldsmobilerepm.html","New","../afb/BL/SA186.jpg");
 button.addLink("autom_Daimlerrepm.html","New","../afb/BL/SA186.jpg");
 button.addLink("autom_Chevroletrepm6.html","New","../afb/BL/SA186.jpg");
 button.addLink("autom_Jaguarrepm.html","New","../afb/BL/SA186.jpg");
 button.addLink("autom_Pontiacrepm2.html","New","../afb/BL/SA186.jpg");
 button.addLink("autom_Cadillacrepm.html","New","../afb/BL/SA186.jpg");
 button.addLink("autom_Buickrepm.html","New","../afb/BL/SA186.jpg");
 button.addLink("autom_Chevroletrepm3.html","New","../afb/BL/SA198.jpg");
 button.addLink("autom_Pontiacrepm.html","New","../afb/BL/SA200.jpg");
 button.addLink("autom_Chevroletrepm5.html","New","../afb/BL/SA203.jpg");
 button.addLink("autom_Jaguarrep.html","New","../afb/BL/J11WB.jpg");
 button.addLink("autom_Fiatrep03.html","New","../afb/BL/FI13WE.jpg");
 button.addLink("autom_Fiatrep05.html","New","../afb/BL/FI28WE.jpg");
 button.addLink("autom_Fiatrep03.html","New","../afb/BL/FI60WE.jpg");
 button.addLink("autom_Audirep08.html","New","../afb/BL/AUA42WP.jpg");
 button.addLink("autom_BMWrep04.html","New","../afb/BL/BMW84WP.jpg");
 button.addLink("autom_BMWrep05.html","New","../afb/BL/BMW92WP.jpg");
 button.addLink("autom_BMWrep10.html","New","../afb/BL/BMW86WP.jpg");
 button.addLink("autom_BMWrep13.html","New","../afb/BL/BM7WP.jpg");
 button.addLink("autom_FordUSArep05.html","New","../afb/BL/FOM5.jpg");
 button.addLink("autom_Porscherep4.html","New","../afb/BL/PORBWP.jpg");
 button.addLink("autom_Toyotarep10.html","New","../afb/BL/TOYPWP.jpg");


button.selectLink();
};

function imageLink(linkid)
{
	//set link object
	this.link = document.getElementById(linkid);

	//create an empty array of possible links
	this.possibles = [];
};

imageLink.prototype.addLink = function()
{
	//store arguments in possible links array
	this.possibles[this.possibles.length] = arguments;
};

imageLink.prototype.selectLink = function()
{
	if(this.link != null)
	{

		this.rnd = this.possibles[Math.floor(Math.random() * this.possibles.length)];
		this.link.href = this.rnd[0];
		this.link.title = this.rnd[1];
		this.img = this.link.getElementsByTagName('img')[0];
		if(this.img != null)
		{
			this.img.src = this.rnd[2];
		}
	}
};

if(typeof document.getElementById != 'undefined') { randomImageLink(); }

