<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
.images {
position:absolute;z-Index:101;left:100px;top:100px;width:400px;height:300px;border:solid red 1px;
}
.images IMG {
width:200px;height:150px;float:left;border-Width:0px;
}
.images .large {
position:absolute;z-Index:101;left:0px;top:0px;width:400px;height:300px;border:solid red 1px;
}
/*]]>*/
</style></head>
<body>
<div class="images" id="tst" >
<a><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="img" /></a>
<a><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="img" /></a>
<a><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg" alt="img" /></a>
<a><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg" alt="img" /></a>
</div>
<script type="text/javascript">
/*<![CDATA[*/
var zxcImageRandom={
init:function(o){
var id=o.ID,ary=o.ImageArray,lary=o.LargeImageArray,f=o.LargeFrequency,days=o.DaysPersistence,days=typeof(days)=='number'?days:-1,obj=document.getElementById(id),imgs=obj.getElementsByTagName('IMG'),lst=this.cookie(id+'='),use,a,img,z0=0;
f=Math.floor(Math.random()*f);
use=this.shuffle(f!=0?ary:lary);
while (use.length>1&&use[0][0].substring(use[0][0].lastIndexOf('/')+1)==lst.substring(lst.lastIndexOf('/')+1)){
use=this.shuffle(use);
}
if (f!=0){
for (;z0<imgs.length;z0++){
a=use[z0%use.length];
imgs[z0].src=a[0];
if (a[1]){
imgs[z0].title=a[1];
}
if (a[2]){
imgs[z0].parentNode.href=a[2];
}
}
document.cookie=id+'='+use[0][0]+';'+'expires='+(new Date(new Date().getTime()+days*86400000).toGMTString())+';path=/';
}
else {
img=document.createElement('IMG');
img.src=use[0][0];
img.className='large';
a=document.createElement('A');
if (a[1]){
img.title=a[1];
}
if (a[2]){
a.href=a[2];
}
a.appendChild(img);
obj.appendChild(a);
}
},
cookie:function(nme){
var re=new RegExp(nme+'[^;]+','i');
if (document.cookie.match(re)){
return document.cookie.match(re)[0].split("=")[1];
}
return null;
},
shuffle:function(ary){
for (var r,t,z0=0;z0<ary.length;z0++){
r=Math.floor(Math.random()*ary.length);
t=ary[z0];
ary[z0]=ary[r];
ary[r]=t;
}
return ary;
}
}
zxcImageRandom.init({
ID:'tst', // the unique ID name of the carousel parent DIV. (string)
ImageArray:[ // an array of arrays defining the images SRCs, titles and HREFs. (array)
// field 0 = the URL of the image.
// field 1 = the image title.
// field 2 = the image link href.
// field 3 = (optional) the parameter to pass to the function.
['http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg','Egypt 5','#'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg','Egypt 6','#'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg','Egypt 7','#'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg','Egypt 8','#'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt9.jpg','Egypt 9','#']
],
LargeImageArray:[ // an array of arrays defining the images SRCs, titles and HREFs. (array)
['http://www.vicsjavascripts.org.uk/StdImages/WinterPalace.jpg','Winter Palace','#'],
['http://www.vicsjavascripts.org.uk/StdImages/Egypt10.jpg','Egypt 10','#']
],
LargeFrequency:10, // the frequency to show the large image. (number)
DaysPersistence:1 //(optional) number = the number of days to remember the last image. (number, default = -1 = no persistence)
});
/*]]>*/
</script>
</body>
</html>