function setCookie(Name,Value,Duration){
  now = new Date();
  expiration = new Date(now.getTime()+Duration*86400000);
  document.cookie=Name+"="+Value+";expires="+expiration.toGMTString()+";";
}

function readCookie(Name){
  var searchname = Name + "=";
  var cookies = document.cookie.split(';');
  for(var i=0;i< cookies.length;i++){
   var singelcookie = cookies[i];
   while (singelcookie.charAt(0)==' ') singelcookie = singelcookie.substring(1,singelcookie.length);
     if(singelcookie.indexOf(searchname) == 0)
      return singelcookie.substring(searchname.length,singelcookie.length);
  }
  return null;
}

if(document.cookie){
    if(readCookie("width") == null || readCookie("height") == null){
        setCookie("width",screen.width,1);
        setCookie("height",screen.height,1);
        location.reload();
    }
}else{
    setCookie("width",screen.width,1);
    setCookie("height",screen.height,1);
    location.reload();
}
