function BGCycler(image_src_array){
    var self = this;
    
    
    self.bg_image_array = [];
    for(var i=0, length = image_src_array.length; i< length; i++){
        self.bg_image_array.push( new Image() );
        self.bg_image_array[self.bg_image_array.length - 1].src = image_src_array[i];        
    }
    
    
    self.image_index = 0;
    return true;
}
BGCycler.prototype.bg_image_array = null;
BGCycler.prototype.image_index = null;

BGCycler.prototype.cycle_image = function(){
    var self = this;
    self.image_index = (self.image_index == self.bg_image_array.length - 1)  ? 0 : self.image_index + 1;

    /*
        bg 1 gets the bg image
        bg 2 opacity animates to 0
            callback: 
                bg2 gets image
                bg2 opacity to 1
    */
    var
        self = this,
        $img1 = $('#bg_image1'),
        $img2 = $('#bg_image2'),
        current_image = self.bg_image_array[self.image_index];
    
    if(current_image.complete){
        $img1.attr({
            'src':self.bg_image_array[self.image_index].src
        });
        $img2.animate({'opacity':0},3000,function(){
            //make sure both images have same src
            $img2.attr({
                'src':self.bg_image_array[self.image_index].src
            });
            //return opacity to 1
            $img2.css({
                'opacity':'1'
            });
        });    
    }
}


BGCycler.prototype.run_cycle = function(){
    var self = this;
    self.cycle_image();
    setInterval(function(){
        self.cycle_image();
    }, 7000);
}
