san256,
Так - Пойдёт ?
<!--анимация фона-->
var aImages = new Array();
var iPrev = -1;
aImages[0] = "images/1.jpg";
aImages[1] = "images/2.jpg";
aImages[2] = "images/3.jpg";
aImages[3] = "images/4.jpg";
aImages[4] = "images/5.jpg";
aImages[5] = "images/6.jpg";
aImages[6] = "images/7.jpg";
var TimmmerID;
$(document).ready(function st() {
$("img#bg").load(function()
{
$("img#bg").fadeTo(2000,1);
TimmmerID=setTimeout(function()
{
$("img#bg").fadeOut(2000);
setTimeout(LoadImages,2500);
}
,5000);
}
)
setTimeout(LoadImages,1000);
});
function LoadImage(iNr)
{
$("img#bg").attr("src", aImages[iNr]);
};
function LoadImages()
{
/* Select a random image number and make sure this is not equal to the previous image */
while(iPrev == iRnd)
{
iRnd = Math.floor(Math.random()*aImages.length);
}
/* Show the selected image */
LoadImage(iRnd);
iPrev = iRnd;
};
<!-- on galery-->
function openGal () {
clearTimeout(TimmmerID);
};
<!-- off galery-->
function closedGal() {
$("img#bg").load();
};