if (top != self)
    top.location.href = "/";

var frameWidth = 0;

function setFrameSize() {
  var isMini = (top.location.href.toLowerCase().indexOf('mini.php') > -1 || top.location.href.toLowerCase().indexOf('handy.php') > -1 || top.location.href.toLowerCase().indexOf('iphone.php') > -1);
  var isMedium = (top.location.href.toLowerCase().indexOf('medium.php') > -1);
  var isMaxi = 1;
  var myWidth = top.innerWidth || top.document.body.clientWidth || top.document.getElementById('gesamt').clientWidth;
  var myHeight = top.innerHeight || top.document.body.offsetHeight || top.document.getElementById('gesamt').clientHeight;
  try { grnav.wHeight = myHeight } catch (e) { };
  if (myWidth == 0 || myWidth == frameWidth)
    return;
  else
    frameWidth = myWidth;
  var fWidth = 0;

  if (((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) && !isMini) {
    top.location.replace('/handy.php');
  } else {
    if (myWidth > 999 || navigator.userAgent.match(/iPad/i) != null) {
      if (isMini || isMedium) {
        top.location.replace('/'); //maxi
      }
    } else if (myWidth > 608) {
      if (!isMedium) {
        top.location.replace('/medium.php'); //medium.php
      }
    } else {
      if (!isMini) {
        top.location.replace('/mini.php');
      }
    }
  }
}

