//*******************************************************************************************
//****		This script is property of & copyrighted by AmarisIT Ltd		*****
//****		Do not use any part of this scripting without prior, 			*****
//****		written permission of the copyright holder				*****
//*******************************************************************************************


// Define imageHTML and initiate total image width
var imagesHtml='';
var totalImageWidth=0;

// Define arrays
var imageArray=new Array();	// stores image path
var linkArray=new Array();	// stores image link url
var titleArray=new Array();	// stores link title
var altArray=new Array();	// stores image alt text
var widthArray=new Array();	// stores image width

//*******************************************************************************************
//****                    Edit values of variables from here on                         *****	
//*******************************************************************************************

// Feel free to add more images to the arrays

// Give the full path of the image 
imageArray[0]='http://www.amarisit.co.uk//images/jump/software.gif';
imageArray[1]='http://www.amarisit.co.uk//images/jump/components.gif';
imageArray[2]='http://www.amarisit.co.uk//images/jump/gps.gif';
imageArray[3]='http://www.amarisit.co.uk//images/jump/networks.gif';
imageArray[4]='http://www.amarisit.co.uk//images/jump/computers.gif';
imageArray[5]='http://www.amarisit.co.uk//images/jump/controls.gif';
imageArray[6]='http://www.amarisit.co.uk//images/jump/storage.gif';
imageArray[7]='http://www.amarisit.co.uk//images/jump/monitors.gif';
imageArray[8]='http://www.amarisit.co.uk//images/jump/print.gif';
imageArray[9]='http://www.amarisit.co.uk//images/jump/projectors.gif';
imageArray[10]='http://www.amarisit.co.uk//images/jump/cameras.gif';
imageArray[11]='http://www.amarisit.co.uk//images/jump/bags.gif';
imageArray[12]='http://www.amarisit.co.uk//images/jump/audio.gif';
imageArray[13]='http://www.amarisit.co.uk//images/jump/warranty.gif';
imageArray[14]='http://www.amarisit.co.uk//images/jump/blackberrys.gif';
imageArray[15]='http://www.amarisit.co.uk//images/jump/Office_supply.jpg';
imageArray[16]='http://www.amarisit.co.uk//images/jump/ms_exchange.jpg';




// Give the full URL the image should link to. Note that linkArray[0] corresponds to imageArray[0] and so on.
linkArray[0]='http://www.amarisit.co.uk/main.asp?category=softwares';
linkArray[1]='http://www.amarisit.co.uk/main.asp?category=components';
linkArray[2]='http://www.amarisit.co.uk/main.asp?category=PDA%2C+GPS+%26+mobile';
linkArray[3]='http://www.amarisit.co.uk/main.asp?category=networks';
linkArray[4]='http://www.amarisit.co.uk/main.asp?category=computers';
linkArray[5]='http://www.amarisit.co.uk/main.asp?category=data%2Dentry+%26+controls';
linkArray[6]='http://www.amarisit.co.uk/main.asp?category=data+storage';
linkArray[7]='http://www.amarisit.co.uk/main.asp?category=monitors%2C+TVs';
linkArray[8]='http://www.amarisit.co.uk/main.asp?category=print+%26+scan';
linkArray[9]='http://www.amarisit.co.uk/main.asp?category=projectors';
linkArray[10]='http://www.amarisit.co.uk/main.asp?category=cameras';
linkArray[11]='http://www.amarisit.co.uk/main.asp?category=bags+%26+cases';
linkArray[12]='http://www.amarisit.co.uk/main.asp?category=audio+%26+video';
linkArray[13]='http://www.amarisit.co.uk/main.asp?category=warranty+%26+support';
linkArray[14]='http://www.amarisit.co.uk/main.asp?category=Blackberrys';
linkArray[15]='http://www.amarisit.co.uk/mcp/Office_Supply.html';
linkArray[16]='http://www.amarisit.co.uk/mcp/Services.html';




// Give the image alt text. Again, numbers correspond.
altArray[0]='Antivirus & security Software, CRM Software, Desktop Publishing software, Email Software, Multimedia software, Navigation sotware, Networking Software, Operating Systemsn, Computer Utilities, Presentation Software, Project Management Software, Office Suites, Spreadsheet software, Word Processors, Software Licenses/Upgrades, Burning Software, Financial Analysis software and Enterprise Resource Planning (ERP) software';
altArray[1]='Memory Modules, Motherboards, Processors, fans,Power supplies,Audio cards, video cards and interface compnonents at Amaris IT Limited';
altArray[2]='PDA, GPS & Mobile and Accessories at Amaris IT Limited';
altArray[3]='Telephones, Gateways/controllers, Firewalls, Bridges, Repeaters, Hubs, Switches, Routers, Modems, Network cards and adapters, Video networking equipment, VPN security equipments at Amaris IT Limited';
altArray[4]='Notebooks, Netbooks, Laptops, Desktops, Thin Client PCs, Blade PCs, Tablet PCs, Workstations, Servers and Mainframe Computers at Amaris IT Limited';
altArray[5]='Mouse, Keyboard, Gaming Controls, KVM switches, Light Pens, Media Presenter and other Input devices at Amaris It Limited';
altArray[6]='Card Readers, CD/DVD (Re)Writers, Data Storage Supplies, Flash Memory/Pen Drives, Hard Disk,Solid State Drives, Disk Arrays, Tape Arryas, Zip Drives, Tape Drives, Storage Servers and SAN solutions at Amaris IT Limited';
altArray[7]='Digital Photo frames, Flat Panel Dispalys, LCD TVs, Monitors, Plasma Panels, Touch Screen monitors, TV and Monitor accessories at Amaris IT Limited';
altArray[8]='Laser Printers, Inkjet Printers, Line Matrix Printers, Multifunctionals printers, Photo printers, Label Printers, Dot Matrix Printers, Copiers, Bar code readers, Scanners, Thermal printers, Printing supplies, Large format printers, print and scan accessories at Amaris IT Limited';
altArray[9]='Data Projectors, Film projectors, Overhead Projectors, Projection Lamps, Projection Lenses, Projection screen, Projector cases and Projector Accessories at Amaris IT Limited';
altArray[10]='Digital Cameras, Web Cameras, Hand-Held Camcorders, Camera Accessories and Supplies at Amaris IT Limited';
altArray[11]='Bagpacks, Camera Bagpacks and Cases, Equipment cases, MP3 Player cases, Notebook Bags and Cases, PDA Cases and Storage Media Cases at Amaris IT Limited';
altArray[12]='IPODs, MP3 / MP4 players and recorders, Audio Tuners, DVD players and recorders, Computer speakers, Headphones, Hifi Microphones, HOme Cinema systems, Home stereo sets, Loudspeakers, Media players, TV turners, Video Editors, Receivers/Amplifiers and more at Amaris IT Limited';
altArray[13]='Installation services, IT courses, software Books & Manuals, Warranty & Suppor extensions, Data Storage services and Co-Location Services at Amaris IT Limited';
altArray[14]='BlackBerry SIM Free Handsets, Blackberry Server Licensing and Blackberry Tech Support at Amaris IT Limited';
altArray[15]='Paper Cutters, Binding Machines, Sorters, Typewriters & Accessories, Laminators, Equipment Cleansing Kit, Drafting Supplies, Mail Supplies, Writing Intruments, Folders, Binders & Indexes, Writing Paper, Paper Shredders, Dust Covers, Office Furniture, Cleaning Wipes For office, Personal Safety & Protection and Hand Tools at Amaris IT Limited';
altArray[16]='Hosted Exchange services at Amaris It Limited';


// Give the url title test. Again, numbers correspond.
titleArray[0]='Antivirus & security Software, CRM Software, Desktop Publishing software, Email Software, Multimedia software, Navigation sotware, Networking Software, Operating Systemsn, Computer Utilities, Presentation Software, Project Management Software, Office Suites, Spreadsheet software, Word Processors, Software Licenses/Upgrades, Burning Software, Financial Analysis software and Enterprise Resource Planning (ERP) software';
titleArray[1]='Memory Modules, Motherboards, Processors, fans,Power supplies,Audio cards, video cards and interface compnonents at Amaris IT Limited';
titleArray[2]='PDA, GPS & Mobile and Accessories at Amaris IT Limited';
titleArray[3]='Telephones, Gateways/controllers, Firewalls, Bridges, Repeaters, Hubs, Switches, Routers, Modems, Network cards and adapters, Video networking equipment, VPN security equipments at Amaris IT Limited';
titleArray[4]='Notebooks, Netbooks, Laptops, Desktops, Thin Client PCs, Blade PCs, Tablet PCs, Workstations, Servers and Mainframe Computers at Amaris IT Limited';
titleArray[5]='Mouse, Keyboard, Gaming Controls, KVM switches, Light Pens, Media Presenter and other Input devices at Amaris It Limited';
titleArray[6]='Card Readers, CD/DVD (Re)Writers, Data Storage Supplies, Flash Memory/Pen Drives, Hard Disk,Solid State Drives, Disk Arrays, Tape Arryas, Zip Drives, Tape Drives, Storage Servers and SAN solutions at Amaris IT Limited';
titleArray[7]='Digital Photo frames, Flat Panel Dispalys, LCD TVs, Monitors, Plasma Panels, Touch Screen monitors, TV and Monitor accessories at Amaris IT Limited';
titleArray[8]='Laser Printers, Inkjet Printers, Line Matrix Printers, Multifunctionals printers, Photo printers, Label Printers, Dot Matrix Printers, Copiers, Bar code readers, Scanners, Thermal printers, Printing supplies, Large format printers, print and scan accessories at Amaris IT Limited';
titleArray[9]='Data Projectors, Film projectors, Overhead Projectors, Projection Lamps, Projection Lenses, Projection screen, Projector cases and Projector Accessories at Amaris IT Limited';
titleArray[10]='Digital Cameras, Web Cameras, Hand-Held Camcorders, Camera Accessories and Supplies at Amaris IT Limited';
titleArray[11]='Bagpacks, Camera Bagpacks and Cases, Equipment cases, MP3 Player cases, Notebook Bags and Cases, PDA Cases and Storage Media Cases at Amaris IT Limited';
titleArray[12]='IPODs, MP3 / MP4 players and recorders, Audio Tuners, DVD players and recorders, Computer speakers, Headphones, Hifi Microphones, HOme Cinema systems, Home stereo sets, Loudspeakers, Media players, TV turners, Video Editors, Receivers/Amplifiers and more at Amaris IT Limited';
titleArray[13]='Installation services, IT courses, software Books & Manuals, Warranty & Suppor extensions, Data Storage services and Co-Location Services at Amaris IT Limited';
titleArray[14]='BlackBerry SIM Free Handsets, Blackberry Server Licensing and Blackberry Tech Support at Amaris IT Limited';
titleArray[15]='Paper Cutters, Binding Machines, Sorters, Typewriters & Accessories, Laminators, Equipment Cleansing Kit, Drafting Supplies, Mail Supplies, Writing Intruments, Folders, Binders & Indexes, Writing Paper, Paper Shredders, Dust Covers, Office Furniture, Cleaning Wipes For office, Personal Safety & Protection and Hand Tools at Amaris IT Limited';
titleArray[16]='Hosted Exchange services at Amaris It Limited';



var speed = 4;		// scroll speed in pixels per 1/10 second
var sWidth = 580;	// width of the image slider
var sHeight = 98;	// height of the image slider


//*******************************************************************************************
//****                    No more editing after this point                              *****	
//*******************************************************************************************

// Define variables
var slider;		// variable that controls the slider div
var cmli = 0; 		// cmli = currentMostLeftImage
var mi = cmli;		// mi is used to keep track on at what number to start the image building loop
var loaded = false;	// loaded will determine if the start function has been called and prevent it from being 
			// called again. Firefox does this due to the onload function in the script instead of
			// the body tag.

function start()
{
	// Check if this function was executed before, and if so, dont do it again
	if(loaded==true) 
		return;
	else
	{
		loaded = true;

		slider = document.getElementById('slider');
		slider.style.left = 0;
		slider.style.textAlign = 'left';

		// determine and store width each image
		for (i=0; i<imageArray.length; i++)
		{
			widthArray[i] = document.getElementById('image'+i).width;
		}

		imagesHthmFill();
		scroll();
	}
}


// Determine how many/which images to put into the imagesHtml.
// The must equal in lenght at least the width of the frame div + the current most left image (cmli)
function imagesHthmFill()
{
	// Set imagesHtml to empty & totalImageWidth to 0 & get the width of the cmli
	imagesHtml = '';
	totalImageWidth = 0;
	cmliWidth = widthArray[cmli];		// width of most left image
	visibleWidth = (sWidth+cmliWidth);	// width of visible area + cmli


	// Get sWidth (= frame div width) + the cmli width and compare to width of 
	// all images currently displayed.
	for (mi; visibleWidth > totalImageWidth; mi++)
	{
		// create imagesHtml
		imagesHtml=imagesHtml+'<a href="'+linkArray[mi]+'" title="'+titleArray[mi]+'"><img id="image'+mi+'" src="'+imageArray[mi]+'" alt="'+altArray[mi]+'" border=0></a>';
					
		// put images into slider div (needed to get width of latest image
		slider.innerHTML = '<nobr>'+imagesHtml+'</nobr>';


		// determine total width of displayed images
		totalImageWidth = totalImageWidth + widthArray[mi];


		// check if mi needs to be set back to the start (0). However, the loop increases
		// mi with 1 when it ends, so set mi here to -1 and the ending of the loop makes it 0
		if((mi+1) >= imageArray.length)
		{
			mi = -1;
		}
	}
}


function scroll()
{
	// Check if the cmli is completely out of sight. That means that the next image
	// is precisely at the utter left of the frame div
				
	if(parseInt(slider.style.left)<=-cmliWidth)
	{
		// check if cmli needs to be set back to the start (0)
		if((cmli+1) >= imageArray.length)
		{
			cmli = 0;
			mi = cmli;

			// Initialize and display first image to get it's width 
			// (not doing so give null for its properties and an error in javascript.
			imagesHtml=imagesHtml+'<a href="'+linkArray[cmli]+'" title="'+titleArray[cmli]+'"><img id="image0" src="'+imageArray[cmli]+'" alt="'+altArray[cmli]+'" border=0></a>';
			slider.innerHTML = '<nobr>'+imagesHtml+'</nobr>';
		}
		else
		{
			cmli = cmli+1;
			mi = cmli;
		}
					
		// Fill the imagesHtml 
		imagesHthmFill();

		// Set the div back to it's original position
		slider.style.left = 0;
		scroll();
	}
	else
	{
		slider.style.left = parseInt(slider.style.left)-speed;
		setTimeout("scroll()",100);
	}
}

