if
($(
"#cont1"
).css(
"position"
)!=
"fixed"
){
$(
"#cont1"
).css(
"position"
,
"absolute"
);
var
dw = $(window).width();
var
ow = $(
"#cont1"
).outerWidth();
var
dh = $(window).height();
var
oh = $(
"#cont1"
).outerHeight();
var
l = (dw - ow) / 2;
var
t = (dh - oh) / 2 > 0 ? (dh - oh) / 2 : 10;
var
lDiff = $(
"#cont1"
).offset().left - $(
"#cont1"
).position().left;
var
tDiff = $(
"#cont1"
).offset().top - $(
"#cont1"
).position().top;
l = l + $(window).scrollLeft() - lDiff;
t = t + $(window).scrollTop() - tDiff;
$(
"#cont1"
).css(
"left"
,l +
"px"
);
$(
"#cont1"
).css(
"top"
,t +
"px"
);
}