// Jeff
//www.huntingground.freeserve.co.uk


/**
*
* Image preload
* http://www.webtoolkit.info/
*
**/

function ImagePreload() {
if (typeof(arguments) != 'undefined') {
for (i=0; i<arguments.length; i++ ) {
if (typeof(arguments[i]) == "object") {
for (k=0; k<arguments[i].length; k++) {
var oImage = new Image;
oImage.src = arguments[i][k];
}
}

if (typeof(arguments[i]) == "string") {
var oImage = new Image;
oImage.src = arguments[i];
}
}
}
}


pause = 5 // seconds
fadeSpeed = 2
pause3 = 8 // seconds
fadeSpeed3 = 3

opac1=100
opac2=0
opac3=100
opac4=0
nextPic=2
nextLink=0
nextPic3=2
nextLink3=0
running=0
running3=0

function initISF2(){
elOpic1=document.getElementById("opic1")
elOpic2=document.getElementById("opic2")
lnkLoc=images[nextLink][1]
document.getElementById("mylink").onclick=function(){isf2Link()}
document.getElementById("mylink").style.cursor="pointer"

setTimeout("fadeISF2()",pause*1000)
}

function initISF3(){
elOpic3=document.getElementById("opic3")
elOpic4=document.getElementById("opic4")
lnkLoc3=images3[nextLink3][1]
document.getElementById("mylink3").onclick=function(){isf3Link()}
document.getElementById("mylink3").style.cursor="pointer"

setTimeout("fadeISF3()",pause3*1000)
}

function fadeISF2(){
running=1

opac1 -= fadeSpeed
opac2 += fadeSpeed

if("filters" in document.body && "alpha" in document.body.filters){
elOpic1.filters.alpha.opacity=opac1
elOpic2.filters.alpha.opacity=opac2
}
else{
elOpic1.style.opacity=(opac1/100)-0.001
elOpic2.style.opacity=(opac2/100)-0.001
}

if(opac1<=0||opac2<=0){

if(opac1<=0){elOpic1.src=images[nextPic][0]}
else{elOpic2.src=images[nextPic][0]}

nextPic++
if(nextPic==images.length){nextPic=0}

nextLink++
if(nextLink==images.length){nextLink=0}

fadeSpeed= -fadeSpeed

running=0
}

if(opac1>=100||opac2>=100){
lnkLoc=images[nextLink][1]
}

if(running==0){
setTimeout("fadeISF2()",pause*1000)
}
else{
setTimeout("fadeISF2()",50)
}

}


function fadeISF3(){
running3=1

opac3 -= fadeSpeed3
opac4 += fadeSpeed3

if("filters" in document.body && "alpha" in document.body.filters){
elOpic3.filters.alpha.opacity=opac3
elOpic4.filters.alpha.opacity=opac4
}
else{
elOpic3.style.opacity=(opac3/100)-0.001
elOpic4.style.opacity=(opac4/100)-0.001
}

if(opac3<=0||opac4<=0){

if(opac3<=0){elOpic3.src=images3[nextPic3][0]}
else{elOpic4.src=images3[nextPic3][0]}

nextPic3++
if(nextPic3==images3.length){nextPic3=0}

nextLink3++
if(nextLink3==images3.length){nextLink3=0}

fadeSpeed3= -fadeSpeed3

running3=0
}

if(opac3>=100||opac4>=100){
lnkLoc3=images3[nextLink3][1]
}

if(running3==0){
setTimeout("fadeISF3()",pause3*1000)
}
else{
setTimeout("fadeISF3()",50)
}

}

function isf2Link(){
if(running==1){return}
if(images[nextLink][1]){
//location=lnkLoc
newWin=window.open(lnkLoc,'lnk_win','left=200,top=200,width=300,height=300')
newWin.focus()
}
}

function isf3Link(){
if(running3==1){return}
if(images3[nextLink3][1]){
//location=lnkLoc
newWin=window.open(lnkLoc3,'lnk_win','left=200,top=200,width=300,height=300')
newWin.focus()
}
}