function writeCookie(){
	var w = 0;
	var h = 0;
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth; myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth; myHeight = document.body.clientHeight;
	}

	var today = new Date();
	var the_date = new Date("December 31, 2023");
	var the_cookie_date = the_date.toGMTString();
	var the_cookie = "screensize="+myWidth+", "+myHeight;
	var the_cookie = the_cookie + ";expires=" + the_cookie_date;
	document.cookie=the_cookie;
	location = location.href;
}

function dejaCookie(myWidth, myHeight){
	
	/*
	var expiration = new Date();
	expiration.setTime(expiration.getTime() + 5000); //5 segundos
	setCookie("screensize", myWidth+", "+myHeight, expiration);
	location = location.href;*/
	var today = new Date();
	var the_date = new Date("December 31, 2023");
	var the_cookie_date = the_date.toGMTString();
	var the_cookie = "screensizereymar="+myWidth+", "+myHeight;
	var the_cookie = the_cookie + ";expires=" + the_cookie_date;
	document.cookie=the_cookie;
	location = location.href;
}

function comparaCookie(w_actual, h_actual){

	var w = 0;
	var h = 0;
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth; myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth; myHeight = document.body.clientHeight;
	}

	if(w_actual!= myWidth || h_actual != myHeight){
		//alert("w_actual: "+w_actual+" myWidth:"+myWidth+" h_actual:"+h_actual+" myHeight:"+myHeight);
		dejaCookie(myWidth, myHeight);
	}
}


