﻿/*
 * Code added by Brandon to run slide show
 * modified 7/13/2007 - added PicLinks variable to also change slideshow link href 
 * destination to match each slideshow picture as it changes
 * modified 3/23/2009 - moved all to Default page and use insert to page via RegisterStartupScript function in .net
 */
 /*
    // Set slideShowSpeed (milliseconds)
    var slideShowSpeed = 5000;

    // Duration of crossfade (seconds)
    var crossFadeDuration = 3;

    // Specify the image files
    var Pic = new Array() ;
    Pic[0] = '../images/adrotator/currentads/rotatorcd.jpg?blah=2';
    Pic[1] = '../images/adrotator/currentads/rotatorchecking.jpg?blah=2';
    Pic[2] = '../images/adrotator/currentads/rotatorsavings.jpg?blah=2';

    var PicLinks = new Array();
    PicLinks[0] = "ibank.aspx?ID1=pp&ID2=Time+Deposits&ID3=Certificates+of+Deposit";
    PicLinks[1] = "ibank.aspx?ID1=pp&ID2=Checking&ID3=Interest+Checking";
    PicLinks[2] = "ibank.aspx?ID1=pp&ID2=Savings&ID3=Regular+Savings";

    var ApyText = new Array();
    ApyText[0] = "* Annual Percentage Yield effective 01/01/2009 and subject to change.  Penalty for early withdrawal.";
    ApyText[1] = "* Annual Percentage Yield effective 01/01/2009 and subject to change.";
    ApyText[2] = "* Annual Percentage Yield guaranteed through 03/15/09.  New Money to the bank required.";
var t;
var j = 0;
var p = Pic.length;

//Preload all the images in the background
var preLoad = new Array();
for (i = 0; i < p; i++)
{
   preLoad[i] = new Image();
   preLoad[i].src = Pic[i];
}
 */


//blending works on IE not mozilla
//function flow is do transition effect, change image and text, transition play, 
//set index to next image, make recursive call to runSlideShow utilizing setTimeout for delay
function runSlideShow()
{
    //if browser supports IE filters and it is defined on the object
    slideShowImageRef = document.getElementById("ctl00_ContentPlaceHolder1_ImageSlideShow");
    
    if (slideShowImageRef.filters) 
    {
          slideShowImageRef.style.filter="blendTrans(duration=2)";
          slideShowImageRef.style.filter="blendTrans(duration=2)";
          slideShowImageRef.style.filter="blendTrans(duration=crossFadeDuration)";
          slideShowImageRef.filters.blendTrans.Apply()      ;
    }
    
   //change slide show source image
   slideShowImageRef.src = preLoad[j].src;
   
   //change slide show link href to new image matching destination
   document.getElementById("ctl00_ContentPlaceHolder1_SlideShowLink").href=PicLinks[j];
   
   //change slide's matching APY text at page bottom
   document.getElementById("ctl00_apydisclaimer").innerHTML=ApyText[j];
	  
   slideShowImageRef.filters.blendTrans.Play();

   j = j + 1;
   if (j > (p-1)) j=0;
   
   //setTimeout(X,Y) calls function X after delay Y 
   //setTimeout returns an id of the timeout for later control if desired
   t = setTimeout('runSlideShow()', slideShowSpeed);
}