function resizeAndCenter(targetwidth,targetheight){

function winWid(){ return (ns4||ns6) ? window.innerWidth:document.body.clientWidth; }
function winHei(){ return (ns4||ns6) ? window.innerHeight:document.body.clientHeight; }
function centerX(){ return (ns4||ns6) ? parseInt((screen.width/2)-(width/2)):parseInt((screen.availWidth/2)-(width/2)); }
function centerY(){ return (ns4||ns6) ? parseInt((screen.height/2)-(height/2)):parseInt((screen.availHeight/2)-(height/2)); }
var ns4 = (document.layers) ? 1 : 0;
var ie4 = (document.all) ? 1 : 0;
var ns6 = (document.getElementById && !document.all) ? 1 : 0;
top.resizeTo(targetwidth,targetheight);
var width=winWid();
var height=winHei();
var difx=targetwidth-winWid();
var dify=targetheight-winHei();
width+=(difx*2);
height+=(dify*2);
top.resizeTo(width,height);
top.moveTo(centerX(),centerY());
}

