//工具方法弹 Out蒙版 add by dning 2012-11-4
var MaskShow = (function () {
var Mask = null;
var curr = null;
var free = false;
var func = {
onresize: null,
onscroll: null
};
반환 함수(el, fre, Type) {
if (! 마스크) {
initMask();
}
free = !!fre;
if (el == null) {
show(curr, false);
표시(마스크 , false);
showSelects(true); //for ie6
curr = null;
if (!free) for (var s in func) {
window[s] = func[s > 통화 = $(el)[0 ];
checkVisib(curr);
rePos();
mask.style.zIndex = MaskShow.zIndexBack || 15;
curr.style.zIndex = MaskShow.zIndexFore || 20;
show(curr, true);
show(mask, true);
showSelects(false, el); //ie6
if (!free) for (var s in func) {
func[s] = window[s];
window[s] = rePos;
}
}
if (Type == 0) {
마스크 스타일.폭 = document.body.clientWidth 'px';
마스크 스타일. 높이 = document.body.clientHeight 'px';
if (el) el.style.position = "fixed";
} else {
mask.style.width = "0px";
mask.style.height = "0px";
if (el) el.style.position = "absolute";
}
};
function showSelects(b, box) {
if (!browser.IE6) return;
var sel = document.getElementsByTagName('select');
var vis = b ? 'visible': 'hidden';
for (var i = 0; i < sel.length; i ) {
if ((b || !childOf(sel[i], box)) && sel [i].currentStyle.visibility != vis) sel[i].style.visibility = vis;
}
}
function childOf(a, b) {
while (a && a ! = b) a = a.parentNode;
return a == b;
}
함수 initMask() {
/*
마스크=document.createElement('iframe');
마스크.src='://0';
*/
마스크 = document.createElement('div');
Mask.style.cssText = '배경색:{$c};border:none;position:absolute;visibility:hidden;opacity:{$a};filter: alpha(opacity={$A})'.replaceWith({
c: 마스크쇼.bgColor || '#000',
a: 마스크쇼.bgAlpha || '0.5',
A: 마스크쇼. bgAlpha ?parseInt(maskShow.bgAlpha * 100) : '50'
});
document.body.appendChild(mask);
마스크쇼.마스크 = 마스크;
}
function checkVisib(el) {
var sty = el.style;
sty.position = 'absolute';
sty.left = '-10000px';
sty.top = '-10000px';
sty.visibility = 'visible';
sty.display = 'block';
sty.zIndex = 10;
}
함수 rePos() {
if (!curr) return;
var ps = $pageSize('doc');
setRect(mask, ps);
var rc = centerPos(ps, curr.offsetWidth, curr.offsetHeight) ;
if (rc.left < ps.scrollLeft) rc.left = ps.scrollLeft;
if (rc.top < ps.scrollTop) rc.top = ps.scrollTop;
setRect(curr, rc);
}
function centerPos(ps, cw, ch) {
return {
left: ((ps.winWidth - cw) >> 1) ps.scrollLeft (maskShow.adjustX || 0),
top: ((ps.winHeight - ch) >> 1) ps.scrollTop (maskShow.adjustY || 0)
};
}
함수 setRect(el, ret) {
var sty = el.style;
sty.left = (ect.left || 0) 'px';
sty.top = (direct.top || 0) 'px';
if ( 직사각형의 '너비')
sty.width = ret.width 'px';
if (직사각형의 '높이')
sty.height = ret.height 'px';
}
함수 show(el, b) {
if (!el) return;
el.style.visibility = 'visible';
if (!b) {
el.style.left = -el.offsetWidth - 100 'px';
el.style.top = -el.offsetHeight - 100 'px';
}
}
})();