// --------------------------------------------------------------------------------
/*
* All content in this page is developed by Ahmed Nasym for MTCC Plc
* unless otherwise stated explicitly, content adapted from other
* developers and authors are explicitly referenced.
* This script will load a random image
* This script may be copied, modified and used for non commercial purposes
* provided that all versions carrry this copyright information.
* Developed by Ahmed Nasym. All rights reserved 2004.
*/

// Set up the image files to be used.
var theImages = new Array()
var theRef = new Array()
var theAlt = new Array()
var ext = '.jpg';



//Generates image name
for (i = 0; i < 30; i++)
{
   theImages[i] = 'img' + (i+1) + ext;
}

//Generates Alt text
for (i = 0; i < 30; i++)
{
   //theAlt[i] = 'Product/Service ' + (i+1);
   theAlt[i] = 'Product/Service ';
}

// To add URLs files, continue with the
// pattern below, adding to the arrays.

theRef[0] = 'javascript:void'
theRef[1] = 'javascript:void'
theRef[2] = 'javascript:void'
theRef[3] = 'javascript:void'
theRef[4] = 'javascript:void'
theRef[5] = 'javascript:void'
theRef[6] = 'javascript:void'
theRef[7] = 'javascript:void'
theRef[8] = 'javascript:void'
theRef[9] = 'javascript:void'
theRef[10] = 'javascript:void'
theRef[11] = 'javascript:void'
theRef[12] = 'javascript:void'
theRef[13] = 'javascript:void'
theRef[14] = 'javascript:void'
theRef[15] = 'javascript:void'
theRef[16] = 'javascript:void'
theRef[17] = 'javascript:void'
theRef[18] = 'javascript:void'
theRef[19] = 'javascript:void'
theRef[20] = 'javascript:void'
theRef[21] = 'javascript:void'
theRef[22] = 'javascript:void'
theRef[23] = 'javascript:void'
theRef[24] = 'javascript:void'
theRef[25] = 'javascript:void'
theRef[26] = 'javascript:void'
theRef[27] = 'javascript:void'
theRef[28] = 'javascript:void'
theRef[29] = 'javascript:void'
theRef[30] = 'javascript:void'

var j = 0
var p = theImages.length;
var preBuffer = new Array()

//Pre-Loads images to memory for faster loading
for (i = 0; i < p; i++)
{
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}

//Generates random numbers within image arrays range
var num = Math.round(Math.random()*(p-1));

//Writes image to the document
function showImage()
{
document.write('<a href="'+theRef[num]+'"> <img border="0" height="250" width="750" lowsrc="images\\lowres_'+theImages[num]+'" align="center" src="images\\'+theImages[num]+'"  alt="'+theAlt[num]+'"></a>');
}

// --------------------------------------------------------------------------------
// that's all folks