﻿function LoadLayers() {
    runSlideShow();
}

//Code to control alternating content frame----------------------------------
// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 9000;
//-------------------------------------------

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = .035;
//-------------------------------------------
var Picture1 = new Array(); // don't change this
var link = new Array(); // don't change this

//images here---------------------------------
Picture1[1] = '/images/chick.jpg';
Picture1[2] = '/images/cow.jpg';
Picture1[3] = '/images/dog.jpg';
Picture1[4] = '/images/horse.jpg';
Picture1[5] = '/images/pig.jpg';
Picture1[6] = '/images/public-health.jpg';
//Picture1[7] = '/images/lynx.jpg';
//-------------------------------------------
//links here---------------------------------
link[1] = "/Products/ProductsForAvian.aspx";
link[2] = "/Products/ProductsForLivestock.aspx ";
link[3] = "/Products/ProductsForDogs.aspx";
link[4] = "/Products/ProductsForEquine.aspx";
link[5] = "/Products/ProductsForSwine.aspx";
link[6] = "/Products/ProductsForVeterinaryPublicHealth.aspx";
//link[7] = "/DidYouKnow.aspx";
//--------------------------------------------


var tss;
var iss;
var Lo = 1
var Hi = 6
var ranNum = (getCookie('cobrand') * 1)
if (ranNum != '' && ranNum != null) {
    ranNum = ranNum + 1
}
else {
    ranNum = 1
}
if (ranNum > Hi) ranNum = 1;
setCookie('cobrand', ranNum);
var jss = ranNum;
var pss = Picture1.length - 1;
var preLoad1 = new Array();
for (iss = 1; iss < pss + 1; iss++) {
    preLoad1[iss] = new Image();
    preLoad1[iss].src = Picture1[iss];
}



function runSlideShow() {
    if (document.all) {
        document.images.PictureBox1.style.filter = "blendTrans(duration=" + CrossFadeDuration + ")";
        document.images.PictureBox1.filters.blendTrans.Apply();
        
    }
    document.images.PictureBox1.src = preLoad1[jss].src;
    document.getElementById('piclink').href = link[jss];    
    CrossFadeDuration = .35
    if (document.all) document.images.PictureBox1.filters.blendTrans.Play();   
    jss = jss + 1;
    if (jss > (pss)) jss = 1;
    tss = setTimeout('runSlideShow()', SlideShowSpeed);
}





function getCookie(name) { // use: getCookie("name");
    var objCookie = document.cookie;
    var index = objCookie.indexOf(name + "=");
    if (index == -1) return null;
    index = objCookie.indexOf("=", index) + 1; // first character
    var endstr = objCookie.indexOf(";", index);
    if (endstr == -1) endstr = objCookie.length; // last character
    return unescape(objCookie.substring(index, endstr));
}


function setCookie(name, value) {
    var days = 365;
    if (!days) days = 1; // default to 1 day if empty 
    var expdate = new Date();
    expdate.setTime(expdate.getTime() + days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + "; expires=" + expdate.toGMTString();
} 