// JavaScript Document
var bScrollLeft = false;
var bScrollRight = false;
var bSlideShow = true;
var nCounter = 0;
tss = setInterval('TimerEvent()', 10);

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 15000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var Picture = new Array(); // don't change this
var PicLink = new Array(); // don't change this
var PicTitle = new Array(); // don't change this
//var PicSnippet = new Array(); // don't change this
var Caption508 = new Array(); // don't change this
var Thumb = new Array(); // don't change this

// Specify the image files (Picture)... To add more images, just continue the pattern, adding to the array below.
// Caution: The number of Pictures *must* equal the number of Captions!
// Be sure to update the path and filenames that match your locally hosted environment.

Picture[1]  = 'images/stoploss.jpg';
Picture[2]  = 'images/diversity1new.jpg';
Picture[3]  = 'images/new_benefits.jpg';
Picture[4]  = 'images/diversity2new.jpg';

// Specify the hyperlinks (PicLink)... To add more links, just continue the pattern, adding to the array below.
// Caution: The number of PicLink *must* equal the number of Pictures!
// The links below need to be updated to the URLs of the sites you want each of your pictures to link to.

PicLink[1] = 'http://www.vetcenter.va.gov/Retroactive_Stop_Loss_Pay_RSLSP.asp';
PicLink[2] = 'http://www.oefoif.va.gov/WhatCanVADoForMe.asp#ITEM5';
PicLink[3] = 'http://www.oefoif.va.gov/HowDoIGetHelp.asp';
PicLink[4] = 'http://www.oefoif.va.gov/WelcomeHomeOutreach.asp';

// Specify the titles (PicTitle)... To add more titles, just continue the pattern, adding to the array below.
// Caution: The number of PicTitle *must* equal the number of Pictures!
// Be sure to update the picture titles for the accessible version below to properly reflect the picture titles you want to display.

PicTitle[1] = 'Retroactive Stop Loss Pay';
PicTitle[2] = 'Women Veterans';
PicTitle[3] = 'Call 1-866-606-8216 for health care benefits information';
PicTitle[4] = 'Welcome home events and outreach';

// Specify the short descriptions (PicSnippet)... To add more descriptions, just continue the pattern, adding to the array below.
// Caution: The number of PicSnippet *must* equal the number of Pictures!

//PicSnippet[1] = 'Those eligible for Retroactive Stop Loss Pay must submit their claim by Dec. 2, 2010.';
//PicSnippet[2] = 'Women Veterans can contact Program Managers for help and advice.';
//PicSnippet[3] = 'If you are an OEF/OIF Veteran and have NOT been contacted by VA about health care benefits, please call 1-866-606-8216.';
//PicSnippet[4] = 'Welcome home events and outreach are available to you.';

// Specify the captions (Caption508)... To add more captions, just continue the pattern, adding to the array below.
// Caution: The number of Caption508 *must* equal the number of Pictures!
// Be sure to update the captions below to the captions of your choice associated to each picture that will appear when a user mouse-overs the picture.

Caption508[1] = 'Retroactive Stop Loss Pay form';
Caption508[2] = 'Women service members on a plane';
Caption508[3] = 'Call 1-866-606-8216 for health care benefits information';
Caption508[4] = 'Veterans greeting veterans';

var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;

var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}

function playNpause(cntrlStatus)
{
	if (cntrlStatus.length == 4) {
		if (cntrlStatus.toLowerCase() == "play") {
			if (!bSlideShow) {
				bSlideShow = true;
				manualSwap(jss);
			}
		}
	}

	if (cntrlStatus.length == 5) {
		if (cntrlStatus.toLowerCase() == "pause") {
			if (bSlideShow) {
				bSlideShow = false;
			}
		}
	}
}

function pictureText(pNbr)
{
	var linkText = "";
	/*linkText += '<a href="' + PicLink[pNbr] +'" style="font-weight:bold; text-decoration:underline;" title="' + PicTitle[pNbr] + '">' + PicTitle[pNbr] + '<\/a>';
	linkText += '<div style="color:#000000; margin:0px; width:365px;">' + PicSnippet[pNbr] + '<\/div>';*/
	linkText += '<\/div>';
	//if (document.getElementById) document.getElementById("va_CaptionBox").innerHTML= linkText;
	
	var linkText = "";
	for (picNum = 1; picNum < Picture.length; picNum++)
	{
		if (picNum == pNbr) {
			linkText += '<a href="' + PicLink[picNum] +'" title="' + PicTitle[picNum] + '" style="margin-right:15px; font-weight:bold; border:1px solid #ffffff; color:#ffffff; padding-left:2px; padding-right:2px;">' + picNum + '<\/a>';
		} else if (picNum == Picture.length) {
			linkText += '<a href="javascript:manualSwap(' + picNum +')" title="' + PicTitle[picNum] + '" style="text-decoration:none; border:1px solid #808080; background-color:#585858; color:#ffffff; padding-left:2px; padding-right:2px; font-weight:bold;">' + picNum + '<\/a>';
		} else {
			linkText += '<a href="javascript:manualSwap(' + picNum +')" title="' + PicTitle[picNum] + '" style="margin-right:15px; text-decoration:none; border:1px solid #808080; background-color:#585858; color:#ffffff; padding-left:2px; padding-right:2px; font-weight:bold;">' + picNum + '<\/a>';
		}
	}
	if (document.getElementById) document.getElementById("va_Controls").innerHTML = linkText;
}

function runSlideShow()
{
	if (document.all&&!window.opera){
		document.images.va_PictureBox.style.filter="blendTrans(duration=2)";
		document.images.va_PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
		document.images.va_PictureBox.filters.blendTrans.Apply();
	}
	document.images.va_PictureBox.src = preLoad[jss].src;
	document.images.va_PictureBox.alt = Caption508[jss];
	document.images.va_PictureBox.title = Caption508[jss];
	document.getElementById("img_link").href = PicLink[jss];
	
	pictureText(jss);
	
	if (document.all&&!window.opera) document.images.va_PictureBox.filters.blendTrans.Play();
	jss = jss + 1;
	if (jss > (pss)) jss=1;
//	tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

function isNumber(parm)
{
	var numb = '0123456789';
	
	if (parm == "") return false;
	
	for (i=0; i<parm.length; i++) {
		if (val.indexOf(parm.charAt(i),0) == -1) return false;
	}
	return true;
}

function manualSwap(nIndex)
{
	if (isNumber(nIndex)) {
		jss = nIndex;
	} else {
		jss = 1;
		nIndex = 1;
	}

	document.images.va_PictureBox.src = preLoad[nIndex].src;
	document.images.va_PictureBox.title = Caption508[nIndex];
	document.getElementById("img_link").href = PicLink[nIndex];

	pictureText(nIndex);

	//bSlideShow = false;
}

function TimerEvent()
{
	// Increment counter
	nCounter = nCounter + 10;

/*
	// Test for scroll event
	if (bScrollLeft)
	{
		// Scroll to the left
		document.getElementById('divContainer').scrollLeft -= 2;
	}
	else if (bScrollRight)
	{
		// Scroll to the right
		document.getElementById('divContainer').scrollLeft += 2;
	}
*/	
	// Test for slideshow change
	if ((nCounter % SlideShowSpeed == 0) && (bSlideShow))
		// Switch slideshow image
		runSlideShow();
}

