var totalImages = 10;
var imageShowing = 1;
var layerRef="";
var styleSwitch="";

function init(ti){
        if (navigator.appName == 'Netscape'){
                layerRef = 'document.layers';
                styleSwitch = '';
        }
        else{
                layerRef = 'document.all';
                styleSwitch = '.style';
        }
        if (ti > 10)
           totalImages = ti;
        hideLayer('loading');
        if (ti > 0)
            showLayer('controls');
        showLayer('image1');
        preloadimages();
}

function showNextLayer(){
var showThisImage = imageShowing + 1;
        if (showThisImage > totalImages){
                showThisImage = 1;
        }

if (showThisImage == 6)
    showLayer('iwy');
else if (showThisImage == 16)
    hideLayer('iwy');

hideLayer(eval('"image' + imageShowing + '"'));
showLayer(eval('"image' + showThisImage + '"'));
imageShowing = showThisImage;
}

function doRightLayer(image_number){

if (image_number != imageShowing)
{
   if (image_number != 1)
      hideLayer('image1');
   hideLayer(eval('"image' + imageShowing + '"'));
   showLayer(eval('"image' + image_number + '"'));
   imageShowing = image_number;
}
}

function showPreviousLayer(){
var showThisImage = imageShowing - 1;
        if (showThisImage < 1){
                showThisImage = totalImages;
        }

if (showThisImage == 15)
    showLayer('iwy');
else if (showThisImage == 5)
    hideLayer('iwy');

hideLayer(eval('"image' + imageShowing + '"'));
showLayer(eval('"image' + showThisImage + '"'));
imageShowing = showThisImage;
}

function hideLayer(layerID){
eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="hidden"');
}

function showLayer(layerID){
eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="visible"');
}


