title: Uncaught ReferenceError: resize_cnt is not defined
body: <p>I've got the following challenge on my website.</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: resize_cnt is not defined
        at loop (main.js:204)
        at init.js:201</p>
  </blockquote>
  
  <p>I've got embedded code on my website that opens modal window and the error only occurs on pages that have that modal included. That embedded code is a designstudio plugin where customer can design their own space and I've added woocommerce functions that collects the samples that customer requested and add them to the woocommerce basket. </p>
  
  <pre class="lang-js prettyprint-override"><code>// this is the main loop, always running
  function loop() {
      if (ao.sys.resize_enable == 1) {
      if (ao.sys.loading == 0) {
          ao.sys.global_loader.deact();
      } else {
          ao.sys.global_loader.act();
      }
      refresh_pos_size();
      if (typeof (appli_loop) == "function") {
          appli_loop();
      }
      if (typeof (cust_loop) == "function") {
          cust_loop();
      }
  
      if (typeof (ao.init.orientation_enable) != 'undefined'
          &amp;&amp; ao.init.orientation_enable == 1) {
          detect_orientation();
      }
      if (ao.sys.rendering == 0
          &amp;&amp; ($(window).height() != ao.sys.current_h || $(window).width() != ao.sys.current_w)) {
          ao.sys.current_w = $(window).width();
          ao.sys.current_h = $(window).height();
          resize_done = 1;
          resize_cnt = 0;
          if (current_room_id &gt; -1) {
          set_display();
          }
      } else {
          resize_cnt++;   /** here is where the error occurs **/
      }
      if ((resize_done == 1) &amp;&amp; (resize_cnt &gt; 10)
          &amp;&amp; (ao.sys.resize_enable == 1)) {
          if (ao.sys.comp_active == 1) {
          // btt_left_comp_func();
          }
          if (typeof (appli_loop_after_resize) == "function") {
          appli_loop_after_resize();
          }
          if (typeof (cust_loop_after_resize) == "function") {
          cust_loop_after_resize();
          }
  
          resize_done = 0;
          resize_cnt = 0;
          if (editor_mode != 0) {
          scale_to_view();
  </code></pre>
  
  
  
  <pre class="lang-js prettyprint-override"><code>function init_app() {
      ao.sys.init_cnt++;
      // alert(ao.sys.init_cnt);
      debug.log('init_app: ' + ao.sys.init_cnt + ' / 13');
  
      switch (ao.sys.init_cnt) {
      case 1:
      load_user();
      break;
      case 2:
      if (ao.cfg.phonegap == 1) {
          if (localStorage.getItem("country_" + ao.cfg.app_version) != null) {
          ao.sys.current_country = localStorage.getItem("country_"
              + ao.cfg.app_version);
          ao.cfg.language = localStorage.getItem("language_"
              + ao.cfg.app_version);
          }
          checkConnection();
          init_db();
      } else {
          init_app();
      }
      break;
      case 3:
      load_language();
      break;
      case 4:
      if (typeof load_catlist == 'function') {
          load_catlist();
      } else {
          init_app();
      }
      break;
      case 5:
      load_room_list();
      break;
      case 6:
      if (typeof load_prodlist_egger_vds_online == 'function') {
          load_prodlist_egger_vds_online();
      } else {
          if (typeof load_prodlist == 'function') {
          load_prodlist();
          } else {
          init_app();
          }
      }
      break;
      case 7:
      init_application();
      break;
      case 8:
      if ((ao.cfg.phonegap == 1)
          &amp;&amp; (localStorage.getItem("country_" + ao.cfg.app_version) == null)) {
          debug.log('load_settings call');
  
          load_settings();
      } else {
          init_app();
      }
      break;
      case 9:
      if (ao.cfg.phonegap == 1) {
          if (localStorage.getItem("country_" + ao.cfg.app_version) != localStorage
              .getItem("old_country_" + ao.cfg.app_version)) {
          localStorage.setItem("old_country_" + ao.cfg.app_version,
              ao.sys.current_country);
          debug.log('init_db2 call');
          init_db2();
          } else {
          init_app();
          }
      } else {
          init_app();
      }
      break;
      case 10:
      init_startscreen();
      break;
      case 11:
      if (typeof init_appli == 'function') {
          init_appli();
      } else {
          init_app();
      }
      break;
      case 12:
      if (typeof init_cust == 'function') {
          init_cust();
      } else {
          init_app();
      }
      break;
      case 13:
      ao.sys.loading = 0;
      window.setInterval(function() {
          loop();
      }, 40);
      if (ao.sys.phonegap == 1) {
          if ((ao.sys.device_plattform == "ios")
              &amp;&amp; (ao.sys.device_type == 'phone')) {
          window.setTimeout("check_iphone_landscape()", 150);
          }
      }
      if (ao.sys.phonegap == 1) {
          if (localStorage.getItem("country") == null) {
          load_settings();
          }
      }
      break;
      default:
      break;
      }
  }
  </code></pre>
  
  
  
  <p>Any ideas, solutions?</p>