function getWindowSize () {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE (FF)
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;

  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode' (IE6, IE7)
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;

  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible (IE5.5)
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [myWidth, myHeight]
}

function menuResize(menu_live, menu_offset) {
  var myWidth = getWindowSize()[0];
  var myHeight = getWindowSize()[1];
  if (myWidth < 798) {myWidth = 798;}
  if (myHeight < 510) {myHeight = 510;}
  var y = Math.floor((( myHeight - 81-60) - (menu_live * menu_offset))/2);
  document.getElementById( "side-left" ).style.height = ( menu_live * menu_offset ) +"px";
  document.getElementById( "side-left" ).style.top = ( y ) +"px";
}

function innerResize() {
  var myWidth = getWindowSize()[0];
  var myHeight = getWindowSize()[1];
  if (myWidth < 798) {myWidth = 798;}
  if (myHeight < 510) {myHeight = 510;}

  var tabtextdiv = document.getElementById("tabtextdiv");
  var n = tabtextdiv ? 7 : 6;

  var widthArray = new Array();
  for (i=0; i <n; i++) {
    widthArray[i] = new Array(2);
  }
  widthArray[0][0] = "belso0";   widthArray[0][1] = 0;
  widthArray[1][0] = "belso1";   widthArray[1][1] = 185;
  widthArray[2][0] = "belso2";   widthArray[2][1] = 185 + 40;
  widthArray[3][0] = "belso_kf"; widthArray[3][1] = 185 + 80;
  widthArray[4][0] = "belso_ka"; widthArray[4][1] = 185 + 80;
  widthArray[5][0] = "belso_kk"; widthArray[5][1] = 185 + 80;
  if (tabtextdiv) {
    widthArray[6][0] = "tabtextdiv"; widthArray[6][1] = 185 + 30;
  }

  for (i=0; i <widthArray.length; i++) {
    document.getElementById( widthArray[i][0] ).style.width= ( myWidth - widthArray[i][1] ) +"px";
  }

  var heightArray = new Array();
  for (i=0; i <n; i++) {
    heightArray[i] = new Array(2);
  }
  heightArray[0][0] = "belso0";   heightArray[0][1] = 81;
  heightArray[1][0] = "belso1";   heightArray[1][1] = 81 + 60;
  heightArray[2][0] = "belso2";   heightArray[2][1] = 81 + 60 + 30;
  heightArray[3][0] = "belso_kb"; heightArray[3][1] = 81 + 60 + 80;
  heightArray[4][0] = "belso_kj"; heightArray[4][1] = 81 + 60 + 80;
  heightArray[5][0] = "belso_kk"; heightArray[5][1] = 81 + 60 + 80;
  if (tabtextdiv) {
    heightArray[6][0] = "tabtextdiv"; heightArray[6][1] = 81 + 60 + 30 + 40;
  }

  for (i=0; i <heightArray.length; i++) {
    document.getElementById( heightArray[i][0] ).style.height= ( myHeight - heightArray[i][1] ) +"px";
  }
}

function nyitoResize() {
  var myWidth = getWindowSize()[0];
  var myHeight = getWindowSize()[1];
  w_Width = document.getElementById('nyito_top_left').offsetWidth + document.getElementById('nyito_top_right').offsetWidth;
  w_Height = document.getElementById('nyito_top_left').offsetHeight + document.getElementById('nyito_bottom_left').offsetHeight;
  if (myWidth < w_Width) { myWidth = w_Width; }
  if (myHeight < 450) { myHeight = 490; }
  document.getElementById('nyito_top_right').style.left = (myWidth - document.getElementById('nyito_top_right').offsetWidth) +"px";
  document.getElementById('nyito_bottom_left').style.top = (myHeight - 60 - document.getElementById('nyito_bottom_left').offsetHeight) +"px";
}

function ResizeImage(image, max_w, max_h) {
return;
    img = document.getElementById(image);
    old_w = img.width;
    old_h = img.height;
    if (old_w > max_w) {
      new_w = max_w;
      new_h = max_w * (old_h / old_w);
    } else {
      new_w = old_w;
      new_h = old_h;
    }
    if (new_h > max_h) {
      new_h = max_h;
      new_w = max_h * (old_w / old_h);
    }
    if (new_w < old_w || new_h < old_h) {
      img.width = Math.round(new_w);
      img.height = Math.round(new_h);
    }
}
