/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
acc = {};
acc.counter = 0;
acc.files = ["splash.jpg","splash2.jpg"];
acc.loaded=[];
acc.waitTime = 10000;
acc.fadeTime = 500;

acc.animateSplash = function(){
    this.counter++;
    if(this.counter>=this.files.length){
        this.counter=0;
    }
    var nextImg =  $("<img></img>");
    $(nextImg).attr("src","./gfx/nolags/"+acc.files[acc.counter]);
    $(nextImg).unbind("load");
    if(acc.loaded[acc.files[acc.counter]]==1){
	acc.animateSplash2()
    }else{
	$(nextImg).bind("load",function(){
	    acc.animateSplash2();
	});
    }
}

acc.animateSplash2 = function(){
    acc.loaded[acc.files[acc.counter]]=1;
    $('#splash2').stop(true,true).hide(0,function(){
	    $('#splash2').attr('src',"./gfx/nolags/"+acc.files[acc.counter]);
	    $('#splash2').fadeIn(acc.fadeTime ,function(){
		    $('#splash1').attr('src',"./gfx/nolags/"+acc.files[acc.counter]);
		    $('#splash2').hide(0);
	    });

    });
    setTimeout("acc.animateSplash()", acc.waitTime);
}

$(document).ready(function(){
    setTimeout('acc.animateSplash()', acc.waitTime);
});
