I want to toggle between interstitial ads and rewarded video ads in my game html use it construct 2 every time loading layout like if first runtime show interstitial and if loading again show rewarded video ads and repeat this every time .
SysActs.prototype.GoToLayout = function(to) {
  showInterstitialAd();
  showRewardedVideoAd();
  if (this.runtime.isloading)
    return; // cannot change layout while loading on loader layout
  if (this.runtime.changelayout)
    return; // already changing to a different layout
  ;
  this.runtime.changelayout = to;
};
my testcode aftert toggle between two functions automatically
    SysActs.prototype.GoToLayout = function (to)
    {
  if($(this).data('toggleAds') == 1) {
    toggleAds = 0;
    
        if (this.runtime.isloading || showRewardedVideoAd()) 
            return; 
        if (this.runtime.changelayout )
            return;
;
        this.runtime.changelayout = to;
  }
  else {
    toggleAds = 1;
    
        if (this.runtime.isloading || showInterstitialAd() )
            return;
        if (this.runtime.changelayout )
            return;
;
        this.runtime.changelayout = to;
        showInterstitialAd();
  }
  $(this).data('toggleAds', toggleAds);
  return false;
};i try this but is not work?
 
    