function writeCookie() 
{ 
var today = new Date(); 
var the_date = new Date("December 31, 2023"); 
var the_cookie_date = the_date.toGMTString(); 
var the_cookie = "users_res="+ screen.width +"x"+ screen.height; 
var the_cookie = the_cookie + ";expires=" + the_cookie_date; 
document.cookie=the_cookie;
} 


function checkRes(width, height) { 
    if(width != screen.width || height != screen.height) { 
        writeCookie(); 
    } else { 
        return true; 
    } 
} 

function adios() {
    //window_handle = window.close('hi1');
	//window_handle.close(); // <---- this clode no longer works since winxp sp2
	mainwindow = window.self; 
	mainwindow.opener = window.self; 
	mainwindow.close(); 
	}


function centerWindow()
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	else return; // don't do anything ...script failure...wrong browser
	
	
	if (self.screen.width > frameWidth) //only move if screensize allows it
	{
		if (self.screen.height <= frameHeight) { frameHeight = self.screen.height; } 

		newTop = (self.screen.height - frameHeight)/2 - 50;
		newLeft = (self.screen.width - frameWidth)/2;// - 20;
		
		if (newTop < 0) newTop = 0;
		if (newLeft < 0) newLeft = 0;
		
		parent.window.moveTo(newLeft,newTop); //alter this line
		//parent.window.resizeTo(new_width,new_height);
	} 
	else
	{
		//alert('No resize necessary');
		//	parent.window.resizeTo(new_width,new_height);
	}
}