Skipp,
спасибо за помощь сделал так:
function opacity(e)
{
var opacity = document.getElementById('opacity');
var form = document.getElementById('form');
if(e == true)
{
opacity.removeAttribute('class');
form.removeAttribute('class');
var width = (document.documentElement.clientWidth - form.offsetWidth)/2;
var height = (document.documentElement.clientHeight - form.offsetHeight)/2;
form.style.top = height + 'px';
form.style.left = width + 'px';
resize(true);
}
else
{
opacity.setAttribute('class', 'hidden');
form.setAttribute('class', 'hidden');
resize(false);
}
}
function resize(e)
{
if(e == true) window.onresize = function () { opacity(1); }
else window.onresize = function () { opacity(0); }
}