// Please note, this is "no loop" version!
// means i.e. aMenuImagesLeft.length=aMenuImagesRight.length=itemsCount-1! 

//TODO pre-loading "text images"

var aTextImgSrc = new Array("/jsp/clipart/history/text_1992.gif","/jsp/clipart/history/text_1993.gif","/jsp/clipart/history/text_1994.gif","/jsp/clipart/history/text_1997.gif","/jsp/clipart/history/text_1998.gif","/jsp/clipart/history/text_2000.gif","/jsp/clipart/history/text_2001.gif","/jsp/clipart/history/text_2002.gif","/jsp/clipart/history/text_2003.gif","/jsp/clipart/history/text_2004.gif","/jsp/clipart/history/text_2005.gif","/jsp/clipart/history/text_2006.gif","/jsp/clipart/history/text_2007.gif","/jsp/clipart/history/text_2008.gif","/jsp/clipart/history/text_2009.gif","/jsp/clipart/history/text_plans.gif");
var aTextImages = new Array();
//var currIdx = 0; important! must be set manually on all pages with new menu! and customized ie currIdx=1 for CRT
var itemsCount = 16;

var ARROW_LEFT_OFF = 0;
var ARROW_LEFT_OVER = 1;
var ARROW_RIGHT_OFF = 2;
var ARROW_RIGHT_OVER = 3;

// pre-loading images
var aMenuImagesRight = new Array("/jsp/clipart/history/nav_1993_R.gif","/jsp/clipart/history/nav_1994_R.gif","/jsp/clipart/history/nav_1997_R.gif","/jsp/clipart/history/nav_1998_R.gif","/jsp/clipart/history/nav_2000_R.gif","/jsp/clipart/history/nav_2001_R.gif","/jsp/clipart/history/nav_2002_R.gif","/jsp/clipart/history/nav_2003_R.gif","/jsp/clipart/history/nav_2004_R.gif","/jsp/clipart/history/nav_2005_R.gif","/jsp/clipart/history/nav_2006_R.gif","/jsp/clipart/history/nav_2007_R.gif","/jsp/clipart/history/nav_2008_R.gif","/jsp/clipart/history/nav_2009_R.gif","/jsp/clipart/history/nav_plans_R.gif");
var aMenuImagesLeft = new Array("/jsp/clipart/history/nav_1992_L.gif","/jsp/clipart/history/nav_1993_L.gif","/jsp/clipart/history/nav_1994_L.gif","/jsp/clipart/history/nav_1997_L.gif","/jsp/clipart/history/nav_1998_L.gif","/jsp/clipart/history/nav_2000_L.gif","/jsp/clipart/history/nav_2001_L.gif","/jsp/clipart/history/nav_2002_L.gif","/jsp/clipart/history/nav_2003_L.gif","/jsp/clipart/history/nav_2004_L.gif","/jsp/clipart/history/nav_2005_L.gif","/jsp/clipart/history/nav_2006_L.gif","/jsp/clipart/history/nav_2007_L.gif","/jsp/clipart/history/nav_2008_L.gif","/jsp/clipart/history/nav_2009_L.gif");
var aaImages = new Array();
aaImages[0] = new Array(); //left
aaImages[1] = new Array(); //center
var aImagesArrow = new Array();
aImagesArrow[0] = new Image();
aImagesArrow[0].src = '/jsp/clipart/history/arrow_L_off.gif';
aImagesArrow[1] = new Image();
aImagesArrow[1].src = '/jsp/clipart/history/arrow_L_over.gif';
aImagesArrow[2] = new Image();
aImagesArrow[2].src = '/jsp/clipart/history/arrow_R_off.gif';
aImagesArrow[3] = new Image();
aImagesArrow[3].src = '/jsp/clipart/history/arrow_R_over.gif';
 
for (i = 0; i < itemsCount-1; i++) {
    aaImages[0][i] = new Image();
    aaImages[1][i] = new Image();
    aaImages[0][i].src = aMenuImagesLeft[i];
    aaImages[1][i].src = aMenuImagesRight[i];
}

for (j = 0; j < itemsCount; j++) {
    aTextImages[j] = new Image();
    aTextImages[j].src = aTextImgSrc[j];
}

//pre-loading images - END

function arrowOnOff(imgId, imgIdx)
{
   document.getElementById(imgId).src = aImagesArrow[imgIdx].src;
}

function menuPrev()
{
    if (currIdx == 0) {
        return;
    }
    currIdx--;
    document.getElementById("idBanner").src = aaImages[0][currIdx].src;
    changeContent();
}

function menuNext()
{
    currIdx++;
    if (currIdx == itemsCount) {
        currIdx = itemsCount-1;
        return;
    }
    document.getElementById("idBanner").src = aaImages[1][currIdx-1].src;
    changeContent();
}

function changeContent()
{
    document.getElementById("text_img").src = aTextImages[currIdx].src;
}
