
if(screen.width != getCookie("users_resolution_w"))
{
	if (document.cookie.indexOf("testcookie") != -1)
	{
		deleteCookies();
		writeCookie();
	}
}

if(screen.height != getCookie("users_resolution_h"))
{
	if (document.cookie.indexOf("testcookie") !=-1 )
	{
		deleteCookies();
		writeCookie();
	}
}

function getCookie(name)
{
	var cname = name + "=";
	var dc = document.cookie;
	if(dc.length > 0)
	{
		begin = dc.indexOf(cname);
		if(begin != -1)
		{
			begin += cname.length;
			end = dc.indexOf(";", begin);
			if(end == -1)	end = dc.length;
			return unescape(dc.substring(begin,end));
		}
	}	
	return null;
}

function deleteCookies() 
{
 var today = new Date();
 var the_date = new Date("December 31, 2000");
 var the_cookie_date = the_date.toGMTString();
 var the_cookie_w = "users_resolution_w=" + screen.width;
 var the_cookie_w = the_cookie_w + ";expires=" + the_cookie_date;
 var the_cookie_h = "users_resolution_h=" + screen.height;
 var the_cookie_h = the_cookie_h + ";expires=" + the_cookie_date;

 the_cookie_w = the_cookie_w + ";path=/";
 the_cookie_h = the_cookie_h + ";path=/";

 document.cookie=the_cookie_w;
 document.cookie=the_cookie_h;
}

function writeCookie() 
{
 var today = new Date();
 var the_date = new Date("December 31, 2023");
 var the_cookie_date = the_date.toGMTString();
 var the_cookie_w = "users_resolution_w=" + screen.width;
 var the_cookie_w = the_cookie_w + ";expires=" + the_cookie_date;
 var the_cookie_h = "users_resolution_h=" + screen.height;
 var the_cookie_h = the_cookie_h + ";expires=" + the_cookie_date;

 the_cookie_w = the_cookie_w + ";path=/";
 the_cookie_h = the_cookie_h + ";path=/";

 document.cookie=the_cookie_w;
 document.cookie=the_cookie_h;

 location = '/';
}

