// save window size for duration of session
function Get_Cookie(name) {
   var start = document.cookie.indexOf(name + "=");
   var len = start + name.length + 1;
   if ((!start) && (name != document.cookie.substring(0, name.length))) return null;
   if (start == -1) return null;
   var end = document.cookie.indexOf(";", len);
   if (end == -1) end = document.cookie.length;
   return unescape(document.cookie.substring(len, end));
}

var wWidth = 0;
wWidth = window.innerWidth != null? window.innerWidth:
  document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:
  document.body != null? document.body.clientWidth:
  null;

var wHeight = 0;
wHeight = window.innerHeight != null? window.innerHeight:
  document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:
  document.body != null? document.body.clientHeight:
  null;

if (wWidth != Get_Cookie("windowWidth")){
  document.cookie = "windowWidth=" + wWidth + ";";
  document.cookie = "windowHeight=" + wHeight + ";";
  var dir = location.href.substring(0, location.href.lastIndexOf('/') + 1);
  var url = location.href.substring(dir.length, location.href.length + 1);
  if (url.lastIndexOf('?') != -1) var page = url.substring(0, url.lastIndexOf('?'));
  else page = url;
  if (page = "detail.php") window.location.reload(true);
}
