// Note: this file requires the inclusion of "content/code/global_functions.js"
// Globals
var __cookieNameWidth = "screen_width";
var __cookieNameHeight = "screen_height";
var __backupName = "_last";

// Use real screen width x height not available width x height
var __screenWidth = window.screen.width;
var __screenHeight = window.screen.height;

// Global Functions
// Store Screen Height and Width
function createScreenResolutionCookie(){	
	createCookie(__cookieNameWidth, __screenWidth, 1);
	createCookie(__cookieNameHeight, __screenHeight, 1);
}

// Backup Screen Height and Width
function backupScreenResolutionCookie(){
	if(readCookie(__cookieNameWidth) != null)
		createCookie(__cookieNameWidth +__backupName, readCookie(__cookieNameWidth), 1);
	
	if(readCookie(__cookieNameHeight) != null)
		createCookie(__cookieNameHeight +__backupName, readCookie(__cookieNameHeight), 1);
}

// Create Cookie/ and Backup Cookie of screen resolution
backupScreenResolutionCookie();
createScreenResolutionCookie();

//  Reload page if the screen size has been changed
if(readCookie(__cookieNameWidth +__backupName) && readCookie(__cookieNameWidth) != readCookie(__cookieNameWidth +__backupName))
	document.location = document.location;
