﻿
function ShowWin(tit,url,w,h,isscroll,isiframe)
{
    //var eSrc=(document.all)?window.event.srcElement:arguments[1];
    var shield = document.createElement("div");
    shield.id = "shield";
    shield.style.position = "absolute";
    shield.style.left = "0px";
    shield.style.top = "0px";
    shield.style.width = "100%";
    shield.style.height = document.body.scrollHeight+"px";
    shield.style.background = "#333";
    shield.style.textAlign = "center";
    shield.style.zIndex = "10000";
    shield.style.filter = "alpha(opacity=0)";
    shield.style.opacity = 0;
    var alertFram = document.createElement("div");
    alertFram.id="alertFram";
    alertFram.style.marginLeft = "-"+w/2+"px" ;
    alertFram.style.marginTop = "-"+h/2+"px" ;
    alertFram.style.width = w+"px";
    alertFram.style.height = h+"px";
    alertFram.style.background = "#FFFFFF";
    alertFram.style.border = "1px solid #003366";    
    alertFram.style.textAlign = "center";
    alertFram.style.zIndex = "10001";
    strHtml = "<div style=\"margin:0px;padding:0px;width:100%;font-size:12px;background:#003366;\">\n";
    strHtml += "<div style=\"width:90%;color:#fff;height:20px;line-height:20px; \"><span style=\"float:left;\">"+tit+"</span><span onclick=\"doOk();\" style=\"cursor:pointer;float:right;\">[关闭]</span></div>\n";
    if(isiframe==1)
    {
       strHtml += "<div style=\"background:#FFFFFF;\"><iframe src=\""+url+"\" width=\""+(w)+"px\" height=\""+(h-23)+"px\" frameborder=\"0\" scrolling=\""+isscroll+"\"></iframe></div>\n"; 
    }
    else
    {
       strHtml += "<div style=\"background:#FFFFFF;height:"+(h-23)+";\">"+isiframe+"</div>\n"; 
    }   
    strHtml += "</div>\n";
    alertFram.innerHTML = strHtml;
    document.body.appendChild(alertFram);
    document.body.appendChild(shield);
    
    this.setOpacity = function(obj,opacity){
        if(opacity>=1)opacity=opacity/100;
        try{ obj.style.opacity=opacity; }catch(e){}
        try{ 
            if(obj.filters.length>0&&obj.filters("alpha")){
                obj.filters("alpha").opacity=opacity*100;
            }else{
                obj.style.filter="alpha(opacity=\""+(opacity*100)+"\")";
            }
        }catch(e){}
    }
    var c = 0;
    this.doAlpha = function(){
        if (++c > 20){clearInterval(ad);return 0;}
        setOpacity(shield,c);
    }
    var ad = setInterval("doAlpha()",1);
    this.doOk = function(){
        document.body.removeChild(alertFram);
        document.body.removeChild(shield);
        //eSrc.focus();
        document.body.onselectstart = function(){return true;}
        document.body.oncontextmenu = function(){return true;}
    }
    //eSrc.blur();
    document.body.onselectstart = function(){return false;}
    document.body.oncontextmenu = function(){return false;}
}

function CloseShowWin()
{
    document.body.removeChild(document.getElementById("alertFram"));
    document.body.removeChild(document.getElementById("shield"));    
    document.body.onselectstart = function(){return true;}
    document.body.oncontextmenu = function(){return true;}
}

function position_fixed(el, eltop, elleft){   
    // check is IE6   
    if(!window.XMLHttpRequest)   
    window.onscroll = function(){   
        el.style.top = (document.documentElement.scrollTop + eltop)+"px";   
        el.style.left = (document.documentElement.scrollLeft + elleft)+"px";   
    }   
    else el.style.position = "fixed";   
}