/* Dissolving images - shuffle to come  by pixelriot.com  Peter Mackey */


   		var interval=4000; //ms, not less than the fade timing, 1200ms
   		
   		var imgList = new Array();
   		var imgAsize = 5; //--------------------EDIT
	
		function imgPreload() {	//onLoad
        	    for(i=0; i<imgAsize; i++) {
     			imgList[i]=new Image();
			}
			
			imgList[0].src="imgshome/260.jpg";//A  must hardcode this into the <div>
			imgList[1].src="imgshome/005.jpg";  	//B 
			imgList[2].src="imgshome/006.jpg"; 		//C
			imgList[3].src="imgshome/012.jpg";  		//D
			imgList[4].src="imgshome/london_911.jpg";
			/* ="imgshome/026.jpg";	 */		//E
			/* imgList[5].src="ssimgs/sidecollage.jpg";		//F */
			
			goNext(); //to force load of BG layer after preload
			setInterval ( "goNext()", interval ); 
		}

		/* you need a randomizer on each new page load */

		function getImgsrc(i) {
			return imgList[i].src;
		}
		
		
		var layerswap=0;
		var iNum=0; //counter thru imgList, start at 0 please
		
		function goNext() {
				
				switch (layerswap) {
					case 0: //only used in startup
						setTimeout ( "nextImg()", 400 ); //only cause the background layer to load, avoids blink during preload sort'a
						break;
					case 1:
						$(".imageboxfront").fadeOut(1200);
						setTimeout ( "nextImg()", 1200 ); 
						break;
				     case 2:
						$(".imageboxfront").fadeIn(1200);
						setTimeout ( "nextImg()", 1200 ); 
						break;
				}
			 }
    			  
		function nextImg() {
				iNum++;
				if (iNum>imgAsize-1){iNum=0;}
				
				switch (layerswap) {
					case 0: //only used in startup
						document.rearimgbox.src = imgList[1].src;  //B
						layerswap++;
						break;
					case 1:
						document.frontimgbox.src = imgList[iNum].src;  //C
						layerswap++;
						break;
					case 2:
						document.rearimgbox.src = imgList[iNum].src;  //D
						layerswap=1;
						break;
			}
		}

