     func searchBarSearchButtonClicked(searchBar: UISearchBar){   //protocolの実装
         print("searchtextは \(search!.text!)")
         self.search?.userInteractionEnabled = false  //これしないと、以下全ての実行が2回呼ばれてしまう
-        
         self.showSearchModeAlert()
     }
     
     func searchInThisBook(){
         let pattern = "([a-zA-Z0-9]|.){0,10}\(search!.text!)([a-zA-Z0-9]|.){0,10}"  //それぞれの前後の文字列も確保?
         print("patternは \(pattern)")
-        //第1章から順に、章単位で検索(とりあえず途中10件まで表示?) → 結果表示
-        for(var j = 0; j < FolioReader.sharedInstance.readerCenter.totalPages; j++){
+        //第1章から順に、章単位で検索(とりあえず各章ずつ表示？→下に引っ張ってリロードでcell追加?) → 結果表示
+        for(var j = self.tempPage!; j < FolioReader.sharedInstance.readerCenter.totalPages; j++){
             let indexPath = NSIndexPath(forRow: j, inSection: 0)
             let resource = book.spine.spineReferences[indexPath.row].resource
             let html = try? String(contentsOfFile: resource.fullHref, encoding: NSUTF8StringEncoding)

    private var bodyHtml:String?
    private var bodyHtmlArray:[String] = []
    private var pageMappedArray:[Int] = []
    
    override func viewDidLoad() {
        super.viewDidLoad()
      
        //とりあえず本全体(全文検索?)ではなく章単位での検索にする
        self.bodyHtml = FolioReader.sharedInstance.readerCenter.currentPage.getHTMLBody()  //getHTMLBody()
        print("bodyHtmlは. \(self.bodyHtml)")
        
        barHeight = UIApplication.sharedApplication().statusBarFrame.size.height  //0
        displayWidth = self.view.frame.width
        displayHeight = self.view.frame.height

            let searchTagId = "search"
            let style = HighlightStyle.classForStyle(2)  //青色
            let tag = "<search id=\"\(searchTagId)\" class=\"\(style)\">\(search!.text!)</search>"
        
            if adjustedRange.location != NSNotFound {
                bodyHtmls = bodyHtmls.stringByReplacingCharactersInRange(adjustedRange, withString: tag)
                let resource = book.spine.spineReferences[thePage].resource
                FolioReader.sharedInstance.readerCenter.currentPage.webView.tag = 1  //didfinishLoad時に行移動させる為
                FolioReader.sharedInstance.readerCenter.currentPage.webView.alpha = 0
                
                if(FolioReader.sharedInstance.readerCenter.currentPage.pageNumber != thePage + 1){
                    FolioReader.sharedInstance.readerCenter.changePageWith(page: thePage + 1, animated: false, completion: { () -> Void in
                        let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(0.3 * Double(NSEC_PER_SEC)))
                        dispatch_after(delayTime, dispatch_get_main_queue()) {
                            var html = FolioReader.sharedInstance.readerCenter.currentPage.getHTML()
                            html! = html!.stringByReplacingOccurrencesOfString("<body>(.|[\n])*</body>", withString: bodyHtmls as String, options: .RegularExpressionSearch, range: nil)
                            print("body入れ替え後のhtmlは\(html)")
                            //それ読み込む(これはuiwebviewのメソッド使用)
                            //バグ修正:移動後にテキストハイライトが消えるのを直す
                            FolioReader.sharedInstance.readerCenter.currentPage.webView.loadHTMLString(html! as String, baseURL: NSURL(fileURLWithPath: (resource.fullHref as NSString).stringByDeletingLastPathComponent))
                        }
                    })
                }else{
                    print("その章内なら")
                    var html = FolioReader.sharedInstance.readerCenter.currentPage.getHTML()
                    html! = html!.stringByReplacingOccurrencesOfString("<body>(.|[\n])*</body>", withString: bodyHtmls as String, options: .RegularExpressionSearch, range: nil)
                    FolioReader.sharedInstance.readerCenter.currentPage.webView.loadHTMLString(html! as String, baseURL: NSURL(fileURLWithPath: (resource.fullHref as NSString).stringByDeletingLastPathComponent))
                }
            } else {
