var Discover = {
  width : window.innerWidth,
  
  initialise : function() {
    Discover.discover();
  },
  
  discover : function() {
    Discover.setDeviceCookie("".concat(
        "w~",(window.innerWidth>0)?window.innerWidth:screen.width,"|", 
        "h~",(window.innerHeight>0)?window.innerHeight:screen.height,"|" 
    ));
  },

  getDeviceCookie : function() {
    var i=document.cookie.indexOf("device=");
    if (i!=-1) {
      j=document.cookie.indexOf(";",i);
      if (j==-1) j=document.cookie.length;
      return document.cookie.substring(i+7,j);
    }
    return "";
  },
  
  setDeviceCookie : function(deviceCookie) {    
    document.cookie = "device=" + deviceCookie + ";path=/";
  },
  
  clearDeviceCookie : function(deviceCookie) {
    var cookieDate = new Date ( );
    cookieDate.setTime ( cookieDate.getTime() - 1 );
    document.cookie = "device=;path=/;expires=" + cookieDate.toGMTString();
  },
  
  reloadPage : function() {
    Discover.discover();
    window.location.reload(true);
  }  
}

  Discover.initialise();

