function iframe_extension(){
        var ifr = arguments[0];
        if(ifr.tagName.toLowerCase() != 'iframe'){
                alert('not iframe');
                return null;
        }
        ifr.get_body_elem = function(){
                 return this.contentWindow.document.getElementsByTagName('body')[0];
        };
        ifr.$ = function(){
                var element = arguments[0];
                if (typeof element == 'string'){
                        element = this.contentWindow.document.getElementById(element);
                }
                return element;
        };
        ifr.is_loaded = function(){
                return (this.contentWindow.document.getElementsByTagName('body')[0]) ? true : false;
        }
        ifr.getElementsByTagName = function(tagname){
                return this.contentWindow.document.getElementsByTagName(tagname);
        }
        ifr.set_body = function(){
                var content = arguments[0];
                var opt = (arguments[1] || {});

                if(this.is_loaded()){// iframeがキャッシュされると、再読込み時にonloadイベントが起きない(firefox)
                        this.contentWindow.document.getElementsByTagName('body')[0].innerHTML = content;
                        opt.afterFinish && opt.afterFinish(this);
                }else{
                        Event.observe(ifr,'load',function(){
                                this.contentWindow.document.getElementsByTagName('body')[0].innerHTML = content;
                                opt.afterFinish && opt.afterFinish(this);
                        }.bind(this),false);
                }
        };
}