
var crossFade = { 
    which: '01', 
    numTimes: 0,
    maxTimes: 4,
    /* this runs on page load, and triggers ... */ 
    init: function() { 

        setTimeout('crossFade.imageSwap()',3000) ;
   //     this.fadeOut() ;as
    }, 

    /* this, which *hides* the two divs before they start doing their thing 
     * because they don't contain images yet (and we want them to load the 
     * images while hidden) */ 
 //   fadeOut: function() { 
//        fadeOne = new YAHOO.util.Anim('fish-head-img-one',{opacity:{to:0}},0.1) ;
//        fadeTwo = new YAHOO.util.Anim('fish-head-img-two',{opacity:{to:0}},0.1) ;
//        fadeOne.animate() ;
//        fadeTwo.animate() ;
//        fadeTwo.onComplete.subscribe(paperFish.fishHeadLoad) ;
//    }, 
 
    /* this counts three seconds, then triggers a swap */ 
    swapTrigger: function() { 
    	if (crossFade.numTimes++ < crossFade.maxTimes) {
        	setTimeout('crossFade.imageSwap()',3000) ;
        }
    },
    
    /* this fades in a new banner over three seconds
     */ 
    imageSwap: function() { 
        fadeIn = new YAHOO.util.Anim('header_banner_'+crossFade.which,{opacity:{to:1}},3) ;
        fadeIn.animate() ;
        
        crossFade.which = ( crossFade.which == '01' ) ? '02' : '01' ;
        fadeOut = new YAHOO.util.Anim('header_banner_'+crossFade.which,{opacity:{to:0}},3) ;
        fadeOut.animate() ;
        fadeOut.onComplete.subscribe(crossFade.swapTrigger) ;
    }
     
};
 
/* tells YUI to fire off crossFade.init() when the page loads */
YAHOO.util.Event.on(window, 'load', crossFade.init) ;
 
