﻿//************** Scripts for the featured client functionality - pulled from site.master

array1Length = fadeimages1.length - 1;
array2Length = fadeimages2.length - 1;
array3Length = fadeimages3.length - 1;
array4Length = fadeimages4.length - 1;

var highestNumber = array1Length;

if (array2Length > highestNumber) {
    highestNumber = array2Length;
}
if (array3Length > highestNumber) {
    highestNumber = array3Length;
}

if (array2Length < highestNumber) {
    fadeimages2[highestNumber] = ["images/blank-advert.gif", "RecruiterRegister.aspx"];
}

if (array3Length < highestNumber) {
    fadeimages3[highestNumber] = ["images/blank-advert.gif", "advertise_with_us.asp"];
}

if (array4Length < highestNumber) {
    fadeimages4[highestNumber] = ["images/blank-advert.gif", "advertise_with_us.asp"];
}

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;

// Duration of crossfade (seconds)
var crossFadeDuration = 3;

// =======================================
// do not edit anything below this line
// =======================================

var t1;
var t2;
var t3;
var t4;

var j1 = 0;
var j2 = 0;
var j3 = 0;
var j4 = 0;

var p1 = fadeimages1.length;
var p2 = fadeimages2.length;
var p3 = fadeimages3.length;
var p4 = fadeimages4.length;

var preLoad1 = new Array();
var preLoad2 = new Array();
var preLoad3 = new Array();
var preLoad4 = new Array();

//Preload all 4 arrays
for (var i = 0; i < p1; i++) {
    preLoad1[i] = new Image();
    preLoad1[i].src = fadeimages1[i][0];
}

for (var i = 0; i < p2; i++) {
    preLoad2[i] = new Image();
    preLoad2[i].src = fadeimages2[i][0];
}


for (var i = 0; i < p3; i++) {
    preLoad3[i] = new Image();
    preLoad3[i].src = fadeimages3[i][0];
}

for (var i = 0; i < p4; i++) {
    preLoad4[i] = new Image();
    preLoad4[i].src = fadeimages4[i][0];
}

function runSlideShow1() {

    if (document.all) {
        document.images.SlideShow1.style.filter = "blendTrans(duration=2)"
        document.images.SlideShow1.style.filter = "blendTrans(duration=crossFadeDuration)"
        document.images.SlideShow1.filters.blendTrans.Apply()
    }
    document.images.SlideShow1.src = preLoad1[j1].src
    document.getElementById('link_1').href = "" + fadeimages1[j1][1] + ""

    if (document.all) {
        document.images.SlideShow1.filters.blendTrans.Play()
    }
    j1 = j1 + 1
    if (j1 > (p1 - 1)) j1 = 0
    t1 = setTimeout('runSlideShow1()', slideShowSpeed)
}

function runSlideShow2() {

    if (document.all) {
        document.images.SlideShow2.style.filter = "blendTrans(duration=2)"
        document.images.SlideShow2.style.filter = "blendTrans(duration=crossFadeDuration)"
        document.images.SlideShow2.filters.blendTrans.Apply()
    }
    document.images.SlideShow2.src = preLoad2[j2].src
    document.getElementById('link_2').href = "" + fadeimages2[j2][1] + ""
    if (document.all) {
        document.images.SlideShow2.filters.blendTrans.Play()
    }
    j2 = j2 + 1
    if (j2 > (p2 - 1)) j2 = 0
    t2 = setTimeout('runSlideShow2()', slideShowSpeed)
}

function runSlideShow3() {

    if (document.all) {
        document.images.SlideShow3.style.filter = "blendTrans(duration=2)"
        document.images.SlideShow3.style.filter = "blendTrans(duration=crossFadeDuration)"
        document.images.SlideShow3.filters.blendTrans.Apply()
    }
    document.images.SlideShow3.src = preLoad3[j3].src
    document.getElementById('link_3').href = "" + fadeimages3[j3][1] + ""
    if (document.all) {
        document.images.SlideShow3.filters.blendTrans.Play()
    }
    j3 = j3 + 1
    if (j3 > (p3 - 1)) j3 = 0
    t3 = setTimeout('runSlideShow3()', slideShowSpeed)
}

function runSlideShow4() {

    if (document.all) {
        document.images.SlideShow4.style.filter = "blendTrans(duration=2)"
        document.images.SlideShow4.style.filter = "blendTrans(duration=crossFadeDuration)"
        document.images.SlideShow4.filters.blendTrans.Apply()
    }
    document.images.SlideShow4.src = preLoad4[j4].src
    document.getElementById('link_4').href = "" + fadeimages4[j4][1] + ""
    if (document.all) {
        document.images.SlideShow4.filters.blendTrans.Play()
    }
    j4 = j4 + 1
    if (j4 > (p4 - 1)) j4 = 0
    t4 = setTimeout('runSlideShow4()', slideShowSpeed)
}



//*****END Scripts for the featured client functionality - pulled from site.master