var POPUP = {
    getH:function(){
        if (window.innerHeight && window.scrollMaxY) {
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){
            yScroll = document.body.scrollHeight;
        } else {yScroll = document.body.offsetHeight;}
        return yScroll;       
    },
    //pw:function(el){
		pw:function(el,v,AdminName,ViewEdit){
        if(!document.getElementById(el)){return false;}
        if(!document.createElement){return false;}
		////////////////////////////////////		
		document.getElementById("DidIframe").src="Order/OrderView.asp?VE="+ViewEdit+"&OrderID="+v;
		if(AdminName!="0"){document.getElementById("DidUser").innerHTML="<a ><font color=red>" + AdminName + "</font> 正在处理该订单...</a>";}
		document.getElementById("DidClose").innerHTML="<a href=\"javascript:top.DidIframe.window.print()\">打 印</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"document.getElementById('DidIframe').src='Order/OrderView.asp?VE="+ViewEdit+"&Task=UnLock&OrderID="+v+"';document.getElementById('frmright').src=document.getElementById('frmrightsrc').value;POPUP.cw('bigFram');\">关 闭</a>"
		////////////////////////////////////
        POPUP.cpw(el);
        if(POPUP.hasSlt()){POPUP.cifr();}
    },
	pw_I:function(el,v,AdminName,ViewEdit){
        if(!document.getElementById(el)){return false;}
        if(!document.createElement){return false;}
		////////////////////////////////////		
		document.getElementById("DidIframe").src="Order/OrderViewI.asp?VE="+ViewEdit+"&OrderID="+v;
		if(AdminName!="0"){document.getElementById("DidUser").innerHTML="<a ><font color=red>" + AdminName + "</font> 正在处理该订单...</a>";}
		document.getElementById("DidClose").innerHTML="<a href=\"javascript:top.DidIframe.window.print()\">打 印</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"document.getElementById('DidIframe').src='Order/OrderViewI.asp?VE="+ViewEdit+"&Task=UnLock&OrderID="+v+"';document.getElementById('frmright').src=document.getElementById('frmrightsrc').value;POPUP.cw('bigFram');\">关 闭</a>"
		////////////////////////////////////
        POPUP.cpw(el);
        if(POPUP.hasSlt()){POPUP.cifr();}
    },
	pw_menpiao:function(el,v,AdminName,ViewEdit){
        if(!document.getElementById(el)){return false;}
        if(!document.createElement){return false;}
		////////////////////////////////////		
		document.getElementById("DidIframe").src="menpiao/OrderView.asp?VE="+ViewEdit+"&OrderID="+v;
		if(AdminName!="0"){document.getElementById("DidUser").innerHTML="<a ><font color=red>" + AdminName + "</font> 正在处理该订单...</a>";}

		document.getElementById("DidClose").innerHTML="<a href=\"javascript:top.DidIframe.window.print()\">打 印</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"document.getElementById('DidIframe').src='menpiao/OrderView.asp?VE="+ViewEdit+"&Task=UnLock&OrderID="+v+"';document.getElementById('frmright').src=document.getElementById('frmrightsrc').value;POPUP.cw('bigFram');\">关 闭</a>"
		////////////////////////////////////
        POPUP.cpw(el);
        if(POPUP.hasSlt()){POPUP.cifr();}
    },
    cpw:function(el){
        el= document.getElementById(el);       
        el.className = "popupdiv";
        el.style.marginLeft = "-" + el.clientWidth/2 + "px";
        pwb = document.createElement('div');
        pwb.setAttribute('id','popupbg');
        ph =el.clientHeight;
        sh = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ?        document.body.offsetHeight:document.documentElement.clientHeight;
        bh = POPUP.getH();
        if(ph>bh){
            el.style.marginTop = "-280px";
            pwb.style.height = ph+180+"px";
        }else{
            if(ph>sh){
                pwb.style.height = bh>ph?bh+'px':ph+'px';
                el.style.marginTop = '-280px';
            }else{       
                el.style.marginTop = "-" + ph/2 + 'px';
                pwb.style.height = sh>bh?sh+'px':bh+'px';
            }   
        }
        return document.body.appendChild(pwb);
    },
    cifr:function(){
        if(!document.createElement("iframe")){return false;};
        ifr = document.createElement("iframe");
        ifr.setAttribute("id","divshim");
        ifr.setAttribute("src","javascript:void(0);");
        ifr.setAttribute("scrolling","no");
        ifr.setAttribute("frameborder","0");
        ifr.setAttribute("allowtransparency","true");
        POPUP.insertAfter(ifr,pwb);
        ifr.className = "popupifra";
        ifr.style.height = pwb.style.height;
        ifr.style.width = pwb.style.width;       
    },
    insertAfter:function(nEl,tEl) {
      var p = tEl.parentNode;if (p.lastChild == tEl) {p.appendChild(nEl);
      } else {p.insertBefore(nEl,tEl.nextSibling); }
    },
    hasSlt:function(){
        var a = document.getElementsByTagName('*');
        var hasSlt = false;
        for(var i=a.length-1;i>=0;i--){
            if(a.nodeName == 'SELECT'){hasSlt = true;break;}
        }
        return hasSlt;
    },
    attr:function(el,name,value){
        if(!name || name.constructor != String){return '';}
        name = {'for':'htmlFor','class':'className'}[name] || name;
        if(typeof value != 'undefined'){
            el[name] = value;
            if(el.setAttribute){el.setAttribute(name,value);}
            return el[name] || el.getAttribute(name) || '';
        }
    },
    cw:function(el){
    pwb.className = "hidden";
    document.getElementById(el).className = "hidden";   
    if(POPUP.hasSlt()){ifr.className="hidden"}
    }
}
function addLoadEvent(func){var oldonload = window.onload;if(typeof window.onload != 'function'){window.onload = func;}else{window.onload = function(){oldonload();func();}}}
addLoadEvent(POPUP.getH);