if (!pp) var pp={};
var w3c=(document.getElementById)? true: false;
var agt=navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
pp.popwin={
	_win:null,
	_bodyWidth:0,
	_disabledZone:null,
	_top:0,
	_isShow:false,	
	ieTrueBody:function(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
	},
	getScrollTop:function() { 		
	    return ie ? pp.popwin.ieTrueBody().scrollTop : window.pageYOffset;
	},
	bodyHeight:function() {
		var cobj = document.body;
		while(cobj.scrollTop == 0 && cobj.parentNode)
		{
			if(cobj.tagName.toLowerCase() == 'html') break;
			cobj = cobj.parentNode;
		}
		return cobj.clientHeight;
	},
	_checkDisabledZone:function() {
		pp.popwin._disabledZone=$("disabledZone");
        if (!pp.popwin._disabledZone) {
            pp.popwin._disabledZone=document.createElement('div');
            pp.popwin._disabledZone.id="disabledZone";
            pp.popwin._disabledZone.style.cssText="background-color:#eee;-moz-opacity:0.7;filter:alpha(opacity=70);position:absolute;z-Index:9998;left:0px;top:0px;display:none";
            document.body.appendChild(pp.popwin._disabledZone);
        }
	},
	_fixDisabledZoneHeight:function() {
		pp.popwin._checkDisabledZone();
		if (window.attachEvent)  { //IE
            pp.popwin._disabledZone.style.width=document.body.clientWidth+"px";
            pp.popwin._disabledZone.style.height=Math.max(document.body.scrollHeight,document.body.clientHeight,pp.popwin.bodyHeight())+"px";
        }
        else  {  //firefox
            pp.popwin._disabledZone.style.width="100%";
            pp.popwin._disabledZone.style.height=Math.max(document.body.offsetHeight+16,document.body.clientHeight,pp.popwin.bodyHeight())+"px";
        }
	},
	show:function(_winId,_top,_width,_height,_left,_notShowDisableZone) {
		pp.popwin._fixDisabledZoneHeight();
		pp.popwin._bodyWidth=document.body.clientWidth;
		_notShowDisableZone=_notShowDisableZone || false;
		if (!_notShowDisableZone) pp.popwin._disabledZone.style.display="block";
		pp.popwin._win=$(_winId);
		with (pp.popwin._win.style) {
			position="absolute";
			zIndex=9999;			
			top=_top+"px";
			width=_width+"px";
			height="auto";
			left=(_left || (pp.popwin._bodyWidth-_width)/2)+"px";
			display="block";
		}
		pp.popwin._top=_top;
		pp.popwin._isShow=true;		
	},
	hide:function() {
		pp.popwin._win.style.display="none";
		pp.popwin._disabledZone.style.display="none";
		pp.popwin._isShow=false;		
	}
};

