
/* global variables */
var intPages = arrResponse.length - 1;
var intCurrent = 0;

/* initialize the flyer by loading the array of images and setting up global info */
/* called from <body> */
function initializeFlyer() {

	var imgFlyer = document.getElementById('flyerImage');
	var strPromo = document.getElementById('promoText');

	if (!blnActive) {
		imgFlyer.src = strActiveImg;
		strPromo.innerHTML = '';
		intPages = 0;
	} else {
		imgFlyer.src = arrResponse[0];
		strPromo.innerHTML = strPromoMessage;
	}

	var strPageNumMaxTop = document.getElementById('pageNumMaxTop');
	var strPageNumMaxBot = document.getElementById('pageNumMaxBot');
	
	strPageNumMaxTop.innerText = intPages + 1
	strPageNumMaxBot.innerText = intPages + 1

}

/* go to next image if not at the end */
function NextPage() {

	if (intCurrent != intPages) 
		DisplayImage( 1 );

}

/* go to prev image if not at the beginning */
function PreviousPage() {

	if (intCurrent != 0)
		DisplayImage( -1 );

}

function DisplayImage( x ) {
	var imgFlyer = document.getElementById('flyerImage');
	var strPageNumTop = document.getElementById('pageNumTop');
	var strPageNumBot = document.getElementById('pageNumBot');
	
	/* update the current image based on direction (prev/next) */
	intCurrent += x;

	/* update the flyer image */
	imgFlyer.src = arrResponse[intCurrent];

	/* update the current page [X] of [Y] */
	strPageNumTop.innerText = intCurrent + 1;
	strPageNumBot.innerText = intCurrent + 1;
	
}

/* future??
function simplePreload()

{ 

  var args = simplePreload.arguments;

  document.imageArray = new Array(args.length);

  for(var i=0; i<args.length; i++)

  {

    document.imageArray[i] = new Image;

    document.imageArray[i].src = args[i];

  }
}

*/
