window.onresize = resize;
window.onload = setsize;

function setCookieML(c_name,value,expiredays)
{
 var waznosc=new Date();
 var tresc=value;
 tresc=escape(tresc);
 waznosc.setTime(waznosc.getTime()+1000*60*60*24*expiredays);
 document.cookie=c_name+"=" + tresc + ";expires=" + waznosc.toGMTString();
}
function resize()
{
 setCookieML("aWidth",document.body.clientWidth,30)
 setCookieML("aHeight",document.body.clientHeight,30)
}
function getCookieML(c_name)
{
 c_name+="=";
 startCookie=document.cookie.indexOf(c_name);
 if (startCookie==-1) {return ""}
 startCookie+=c_name.length;
 if (document.cookie.indexOf(";",startCookie)==-1)
 {
  koniecCookie=document.cookie.length;
 }
 else
 {
  koniecCookie=document.cookie.indexOf(";",startCookie);
 }
 textCookie=document.cookie.substring(startCookie,koniecCookie);
 textCookie=unescape(textCookie);
 return textCookie;
}
function setsize()
{
 var tmpWidth = getCookieML("aWidth")
 var tmpHeight = getCookieML("aHeight")
 if(tmpWidth!="" && tmpHeight!="")
 {
  window.resizeTo(tmpWidth,tmpHeight)
  var dW =  document.body.clientWidth - tmpWidth;
  var dH =  document.body.clientHeight - tmpHeight;
  window.resizeBy(-dW,-dH);
 }
}
