var isScrolling = false;
//首頁物件觸發
if ($animationcss == 'animationtrue' && !$contentstrue) {
  $(window).scroll(function() {
    if (!isScrolling) {
      isScrolling = true;
      setTimeout(function() {
        var $scrollTopa = $(window).scrollTop();
        var $zoom=($("#toplayerdiv").attr("zoom") == '') ? "1" : $("#toplayerdiv").attr("zoom");     
        var $scrollTopb = $scrollTopa + (850 * $zoom); //觸發位置
        //說明區塊
        var $defaultbox = $("#defaultbox").offset(); //件為位置	
        if (typeof($defaultbox) != 'undefined') {
          $(".indexpage  #defaultbox").css("display", "none");
        }
        //左右區塊
        var $sidedivbox = $("#sidedivbox").offset(); //件為位置	
        if (typeof($sidedivbox) != 'undefined') {
          if ($scrollTopb > $sidedivbox.top) {
            $(".indexpage #sidedivbox").css({
              "animation-name": "leftbox",
              "left": "0px",
              "opacity": "1"
            });
          }
        }
        //中間迴圈	
        $("#centertpldiv .blockboxeach,#bottompage .blockboxeach").each(function(index) {
          var $centerboxeach = '.box' + $(this).attr("name");
          var $divx = $($centerboxeach).offset(); //件為位置
          if (typeof($divx) != 'undefined') {
            if ($scrollTopb > $divx.top) {
              $($centerboxeach).css({
                "animation-name": "center",
                "top": "0px",
                "opacity": "1"
              });
            }
          }
        });
        //中間上左區塊
        var $toplefttpldiv = $("#toplefttpldiv").offset(); //件為位置		
        if (typeof($toplefttpldiv) != 'undefined') {
          if ($scrollTopb > $toplefttpldiv.top) {
            $(".indexpage #toplefttpldiv").css({
              "animation-name": "centerboxl",
              "left": "0px",
              "opacity": "1"
            });
          }
        }
        //中間上右區塊
        var $toprighttpldiv = $("#toprighttpldiv").offset(); //件為位置		
        if (typeof($toprighttpldiv) != 'undefined') {
          if ($scrollTopb > $toprighttpldiv.top) {
            $(".indexpage #toprighttpldiv").css({
              "animation-name": "centerboxr",
              "left": "0px",
              "opacity": "1"
            });
          }
        }
        //中間下左區塊
        var $bottomlefttpldiv = $("#bottomlefttpldiv").offset(); //件為位置		
        if (typeof($bottomlefttpldiv) != 'undefined') {
          if ($scrollTopb > $bottomlefttpldiv.top) {
            $(".indexpage #bottomlefttpldiv").css({
              "animation-name": "centerboxl",
              "left": "0px",
              "opacity": "1"
            });
          }
        }
        //中間下右區塊
        var $bottomrighttpldiv = $("#bottomrighttpldiv").offset(); //件為位置		
        if (typeof($bottomrighttpldiv) != 'undefined') {
          if ($scrollTopb > $bottomrighttpldiv.top) {
            $(".indexpage #bottomrighttpldiv").css({
              "animation-name": "centerboxr",
              "left": "0px",
              "opacity": "1"
            });
          }
        }
        //全國據點
        if ($("#neiladdress_block").length == '1') {
          var $ddressbox = $("#neiladdress_block").offset(); //件為位置		
          if (typeof($ddressbox) != 'undefined') {
            if ($scrollTopb > $ddressbox.top) {
              setTimeout(function() {
                neothemesadmin_addressfunction();
              }, 120);
            }
          }
        }
        //簡介區塊
        if ($("#neiltextblock_block").length == '1') {
          var $textblock = $("#neiltextblock_block").offset(); //件為位置		
          if (typeof($textblock) != 'undefined') {
            if ($scrollTopb > $textblock.top) {
              setTimeout(function() {
                neothemesadmin_textblockfunction();
              }, 120);
            }
          }
        }
        //商品展示
        if ($("#neilproduct1_block").length == '1'  &&  $('#neilproduct1_block .at_true').length == '1') {
          var $product1_block = $("#neilproduct1_block").offset(); //件為位置		
          if (typeof($product1_block) != 'undefined') {
            if ($scrollTopb > $product1_block.top) {
              setTimeout(function() {
                neilproduct1_block_function();
              }, 120);
            }
          }
        }
        //人氣商品
        if ($("#neilproduct2_block").length == '1' &&  $('#neilproduct2_block .at_true').length == '1') {
          var $product2_block = $("#neilproduct2_block").offset(); //件為位置		
          if (typeof($product2_block) != 'undefined') {
            if ($scrollTopb > $product2_block.top) {
              setTimeout(function() {
                neilproduct2_block_function();
              }, 120);
            }
          }
        }
        //裝飾花
        var $bottombox = $("#bottombox").offset(); //件為位置		
        if (typeof($bottombox) != 'undefined') {
          if ($scrollTopb > $bottombox.top) {
            setTimeout(function() {
              $(".indexpage #bottombox .decorationimg").css({
                "animation-name": "decorationimg",
                "top": "-177px",
                "opacity": "1"
              });
            }, 700);
          }
        }
        //底區塊
        var $bottompage = $("#bottompage").offset(); //件為位置		
        if (typeof($bottompage) != 'undefined') {
          if ($scrollTopb > $bottompage.top) {
            $(".indexpage #bottompage").css({
              "animation-name": "center",
              "left": "0px",
              "opacity": "1"
            });
          }
        }
        //頁腳
        var $footer = $("#footer").offset(); //件為位置
        if (typeof($footer) != 'undefined') {
          if ($scrollTopb > $footer.top) {
            setTimeout(function() {
              $(".indexpage #footer").css({
                "animation-name": "center",
                "top": "0px",
                "opacity": "1"
              });
            }, 300);
          }
        }
        //關於我們 
        if ($("#neilaboutusboxblock").length == '1') {
          var $aboutus = $("#neilaboutusboxblock").offset(); //件為位置		
          if (typeof($aboutus) != 'undefined') {
            if ($scrollTopb > $aboutus.top) {
              setTimeout(function() {
                neothemesadmin_aboutusboxblock();
              }, 120);
            }
          }
        }
        //聯絡我們       
        if ($("#onlineconsultationblock").length == '1') {
          var $aboutus = $("#onlineconsultationblock").offset(); //件為位置		
          if (typeof($aboutus) != 'undefined') {
            if ($scrollTopb > $aboutus.top) {
              setTimeout(function() {
                neothemesadmin_consultationblock();
              }, 120);
            }
          }
        }
        //左右區塊迴圈-上	
        if ($tlayout == '4') {
          var $bottomrlbox = $("#bottomrlbox").offset(); //件為位置
          if (typeof($bottomrlbox) != 'undefined') {
            if ($scrollTopb > $bottomrlbox.top) {
              $(".indexpage #bottomrlbox").css({
                "animation-name": "center",
                "top": "0px",
                "opacity": "1"
              });
              setTimeout(function() {
                sameheightfunction(divid = '#bottomrlbox');
              }, 100);
            }
          }
        }
        //底左右區塊迴圈-下	
        var $bottomrlbox2 = $("#bottomrlbox2").offset(); //件為位置
        if (typeof($bottomrlbox2) != 'undefined') {
          if ($scrollTopb > $bottomrlbox2.top) {
            $(".indexpage #bottomrlbox2").css({
              "animation-name": "center",
              "top": "0px",
              "opacity": "1"
            });
            setTimeout(function() {
              sameheightfunction(divid = '#bottomrlbox2');
            }, 100);
          }
        }
        isScrolling = false;
      }, 100); // 設定節流的時間間隔
    }
  });
}

//內容頁物件觸發
/*
if ($xoopsdirname == 'neilmfdcms' && $("#about").length == 1) {
window.addEventListener('scroll', function() {
  if (!isScrolling) {
    isScrolling = true;
    setTimeout(function() {
      var $scrollTopa = $(window).scrollTop();
        var $zoom=($("#toplayerdiv").attr("zoom") == '') ? "1" : $("#toplayerdiv").attr("zoom");   
        var $scrollTopb = $scrollTopa + (550 * $zoom); //觸發位置
        $("#about .conrent_each").each(function(index) {
          if (index !== 0) {
            var $box_id = '#' + $(this).attr("id");
            var $divx = $($box_id).offset();
            
            if ($divx !== undefined && $scrollTopb > $divx.top) {
              $($box_id).css({
                "animation-name": "aboutcenter",
                "top": "0px",
                "opacity": "1"
              });
            }
          }
        });      
      isScrolling = false;
    }, 100); // 設定節流的時間間隔
  }
});
}
*/