$(window).load(function() {
  //取得電腦解析度寬度
  var $browserwidth = $('body').width();
  //網站預設寬度值
  var $webwidth = $browser == 'Edg' ? "1417" : "1423";
  var $zoomsize = $browserwidth / $webwidth;
  if ($zoomsize < "1") {
    $(window).scroll(function() {
      var $divh = ($("#toplayerdiv").height() * $zoomsize);
      $("#bodybox").css({
        "height": $divh + "px",
        "overflow": "hidden"
      });
    });
    $(this).click(function() {
      var $divh = ($("#toplayerdiv").height() * $zoomsize);
      $("#bodybox").css({
        "height": $divh + "px",
        "overflow": "hidden"
      });
    });
  }
  if (($zoomsize != $zoomff)) {
    if ($zoomsize >= "1") {
      if ($browser == 'FF') {
        $("#toplayerdiv").css({
          "transform": "scale(" + $zoomsize + ")",
          "transform-origin": "center top"
        });
        $("#fixmenu").css({
          "transform": "scale(" + $zoomsize + ")",
          "transform-origin": "right top"
        });
        $("#lowerrightadbox").css({
          "transform": "scale(" + $zoomsize + ")",
          "transform-origin": "right bottom"
        });
      } else {
        $("#toplayerdiv").css({
          "zoom": $zoomsize
        });
        $("#fixmenu").css({
          "zoom": $zoomsize
        });
        $("#lowerrightadbox").css({
          "zoom": $zoomsize
        });
      }
    }
    if ($zoomsize < "1") {
      $("#bodybox").css({
        "width": "calc(" + $webwidth + "/" + $zoomsize + ")",
        "min-width": "calc(" + $webwidth + "/" + $zoomsize + ")"
      });
      if ($browser == 'FF') {
        $("#toplayerdiv").css({
          "transform": "scale(" + $zoomsize + ")",
          "transform-origin": "left top"
        });
        $("#fixmenu").css({
          "transform": "scale(" + $zoomsize + ")",
          "transform-origin": "right top"
        });
        $("#lowerrightadbox").css({
          "transform": "scale(" + $zoomsize + ")",
          "transform-origin": "right bottom"
        });
      } else {
        $("#toplayerdiv").css({
          "zoom": $zoomsize
        });
        $("#fixmenu").css({
          "zoom": $zoomsize
        });
        $("#lowerrightadbox").css({
          "zoom": $zoomsize
        });
      }
    }
    $.ajax({
      url: xoopsjsurl + '/modules/neothemesadmin/ajax.php',
      type: 'POST',
      data: {
        id: '8',
        zoomsize: $zoomsize
      },
      success: function(response) {
        $("#toplayerdiv").attr('zoom', $zoomsize);
      },
      error: function() {
        console.log('ajax error!');
      }
    })
  }
});