/* these are all populated in the calling .asp file
var pix = new Array();
pix[1]=new Image();
pix[1].src='../graphics/homefader1.jpg';
var nPix=12;
*/

var timePreFirstFade = 1
var intSecsBwFades = 2;

var pass=1;
var whichTopLeft = 1;
var whichTopRight = 6;
var whichBottomLeft = 11;
var whichBottomRight = 16;
var openingScreen=true;
var nLoaded;
var i;

function Fade4Pix()
         {
         // no images, so quit
         if (!document.images)
            return 

         // check if all loaded: if not, wait 1 sec & look again
         nLoaded = 0
         for (i=1;i<nPix+1;i++)			 
           if (pix[i].complete == true)
              nLoaded++
       if (nLoaded < nPix)
            {
            setTimeout("Fade4Pix()", 1000);
            return;
            }

         // opening screen, so wait timePreFirstFade secs before starting
         if (openingScreen==true)
            {
            openingScreen=false;
            setTimeout("Fade4Pix()",timePreFirstFade*1000);
            return;
            }

         // NN only - apply fade
         if (document.all)
            {
            if (pass % 4 == 3)
               slideTopLeft.filters.blendTrans.apply()
            else
                if (pass % 4 == 2)
                   slideTopRight.filters.blendTrans.apply()
            	else
                	if (pass % 4 == 1)
                   		slideBottomLeft.filters.blendTrans.apply()
                	else
                    	slideBottomRight.filters.blendTrans.apply()
            }
         // top left's turn
         if (pass % 4 == 3)
            {
            whichTopLeft = whichTopLeft + 1
			if (whichTopLeft > nPix) whichTopLeft = 1 // 1, 2, 3...
            document.images.slideTopLeft.src=pix[whichTopLeft].src
            document.images.slideTopLeft.alt=alt[whichTopLeft]
            }
		else
             // top right's turn
			if (pass % 4 == 2)
                {
                whichTopRight = whichTopRight + 1
			    if (whichTopRight > nPix) whichTopRight = 1 // 6, 7, 8...
                document.images.slideTopRight.src=pix[whichTopRight].src
                document.images.slideTopRight.alt=alt[whichTopRight]
                }
         	else
				// bottom left's turn
             	if (pass % 4 == 1)
                	{
                	whichBottomLeft = whichBottomLeft + 1
			        if (whichBottomLeft > nPix) whichBottomLeft = 1 // 11, 12, 13...
                	document.images.slideBottomLeft.src=pix[whichBottomLeft].src
                	document.images.slideBottomLeft.alt=alt[whichBottomLeft]
                	}
             	else
					// bottom right's turn
                 	{
                 	whichBottomRight = whichBottomRight + 1
			        if (whichBottomRight > nPix) whichBottomRight = 1 // 16, 17, 18...
                 	document.images.slideBottomRight.src=pix[whichBottomRight].src
                 	document.images.slideBottomRight.alt=alt[whichBottomRight]
                 	}

         // NN only - apply fade
         if (document.all)
            {
            if (pass % 4 == 3)
               slideTopLeft.filters.blendTrans.play()
            else
                if (pass % 4 == 2)
                   slideTopRight.filters.blendTrans.play()
                else
                	if (pass % 4 == 1)
                   		slideBottomLeft.filters.blendTrans.play()
                	else
                    	slideBottomRight.filters.blendTrans.play()
            }

         // increment pass
         if (pass<nPix)
            pass++
         else
             pass=1

         //  timeout
         setTimeout("Fade4Pix()", intSecsBwFades*1000)
}
Fade4Pix();


