
/*
 * This is used to generate new iframe buffers on demand.
 * IE seems to lose the onclick events when this is not done,
 * when the contents of the frame are very similar.  This avoids that.
 */
function BufferFactory(){  
    var Cnt;
    
    this.Cnt = 0;
    this.NewBuffer = NewBuffer;
    this.DisposeBuffer = DisposeBuffer;
    
    function NewBuffer(url){
        var Buff;
        if(document.all)
            Buff = document.createElement('<iframe name="BUF'+this.Cnt+'" id="BUF'+this.Cnt+'">'); 
        else{
            Buff = document.createElement('iframe'); 
            Buff.name = 'BUF'+this.Cnt;
        }
        Buff.style.display = 'none';
        Buff.name = 'BUF'+this.Cnt;
        Buff.src = url;
        window.document.body.appendChild(Buff); 
        this.Cnt = this.Cnt + 1;
        return Buff;
    }
    /*
     * Apparently changing the src or removing the buffer also causes IE to 
     * lose events that came from it.  There is probably something wrong with importNode.js.
     * For now, just don't remove it.
     */
    function DisposeBuffer(Buff){
        //Buff.src = '';
        //window.document.body.removeChild(Buff);
    }
}
