﻿// JScript 文件
        var Dialog_Visible = false;

        if(typeof(getWindowInfo) == "undefined")
        var getWindowInfo = function()
        {
            var scrollX=0,scrollY=0,width=0,height=0,contentWidth=0,contentHeight=0;
            if(typeof(window.pageXOffset)=='number')
            {
                scrollX=window.pageXOffset;
                scrollY=window.pageYOffset;
            }
            else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))
            {
                scrollX=document.body.scrollLeft;
                scrollY=document.body.scrollTop;
            }
            else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))
            {
                scrollX=document.documentElement.scrollLeft;
                scrollY=document.documentElement.scrollTop;
            }
            if(typeof(window.innerWidth)=='number')
            {
                width=window.innerWidth;
                height=window.innerHeight;
            }
            else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
            {
                width=document.documentElement.clientWidth;
                height=document.documentElement.clientHeight;
            }
            else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
            {
                width=document.body.clientWidth;
                height=document.body.clientHeight;
            }
            if(document.documentElement&&(document.documentElement.scrollHeight||document.documentElement.offsetHeight))
            {
                if(document.documentElement.scrollHeight>document.documentElement.offsetHeight)
                {
                    contentWidth=document.documentElement.scrollWidth;
                    contentHeight=document.documentElement.scrollHeight;
                }
                else
                {
                    contentWidth=document.documentElement.offsetWidth;
                    contentHeight=document.documentElement.offsetHeight;
                }
            }
            else if(document.body&&(document.body.scrollHeight||document.body.offsetHeight))
            {
                if(document.body.scrollHeight>document.body.offsetHeight)
                {
                    contentWidth=document.body.scrollWidth;
                    contentHeight=document.body.scrollHeight;
                }
                else
                {
                contentWidth=document.body.offsetWidth;
                contentHeight=document.body.offsetHeight;
                }
            }
            else
            {
                contentWidth=width;
                contentHeight=height;
            }
            if(height>contentHeight)
                height=contentHeight;
            if(width>contentWidth)
                width=contentWidth;
            var rect=new Object();
            rect.ScrollX=scrollX;
            rect.ScrollY=scrollY;
            rect.Width=width;
            rect.Height=height;
            rect.ContentWidth=contentWidth;
            rect.ContentHeight=contentHeight;
            return rect;
        }

        function InsertMessageBoxDiv(Message, CallBack)
        {
            var bExistBefore = document.getElementById("Div_Message_Box");
            if(bExistBefore != null)
                document.body.removeChild(bExistBefore);
            var Div_To_Insert = document.createElement("div");
            Div_To_Insert.id = "Div_Message_Box";
            Div_To_Insert.style.position = "absolute";
            Div_To_Insert.style.left = getWindowInfo().Width / 2 - 200 + "px";
            Div_To_Insert.style.top = getWindowInfo().Height / 2 - 100 + "px";
            Div_To_Insert.style.width = "400px";
            Div_To_Insert.style.height = "200px";
            Div_To_Insert.style.backgroundColor = "White";
            Div_To_Insert.style.zIndex = 20;
            Div_To_Insert.style.borderWidth = "1px";
            Div_To_Insert.style.borderStyle = "solid";
            Div_To_Insert.style.borderColor = "Black";
            Div_To_Insert.style.padding = "2px";
            //Div_To_Insert.style.cssText = Div_To_Insert.style.cssText + ";position:fixed!important;";
            
            if(CallBack != undefined)
            {
                CallBack = CallBack.replace(/'/g, "@danyinhao@");
            }
            
            var Message_Box_Context = "<div style=\"width:100%;background-image:url(/image/bg200710221508.gif);color:White;height:20px;padding-top:8px;font-size:12px;text-align:left;\"><b>　易扬网友情提示</b></div>";
            Message_Box_Context += "<div style=\"width:360px;padding:20px;font-size:12px;height:100px;\">" + Message + "</div>";
            Message_Box_Context += "<div style=\"width:385px;text-align:right;height:30px;padding-right:15px;\"><button style=\"width:80px;\" onclick=\"RemoveMessageBox('" + CallBack + "')\">确定</button></div>";
            Div_To_Insert.innerHTML = Message_Box_Context;
            document.body.appendChild(Div_To_Insert);
        }
        
        function InsertMessageBoxDivC(Message, CallBack)
        {
            var bExistBefore = document.getElementById("Div_Message_Box");
            if(bExistBefore != null)
                document.body.removeChild(bExistBefore);
            var Div_To_Insert = document.createElement("div");
            Div_To_Insert.id = "Div_Message_Box";
            Div_To_Insert.style.position = "absolute";
            Div_To_Insert.style.left = getWindowInfo().Width / 2 - 200 + "px";
            Div_To_Insert.style.top = getWindowInfo().Height / 2 - 100 + "px";
            Div_To_Insert.style.width = "400px";
            Div_To_Insert.style.height = "200px";
            Div_To_Insert.style.backgroundColor = "White";
            Div_To_Insert.style.zIndex = 20;
            Div_To_Insert.style.borderWidth = "1px";
            Div_To_Insert.style.borderStyle = "solid";
            Div_To_Insert.style.borderColor = "Black";
            Div_To_Insert.style.padding = "2px";
            //Div_To_Insert.style.cssText = Div_To_Insert.style.cssText + ";position:fixed!important;";
            
            var Message_Box_Context = "<div style=\"width:100%;background-image:url(/image/bg200710221508.gif);color:White;height:20px;padding-top:8px;font-size:12px;text-align:left;\"><b>　易扬网友情提示</b></div>";
            Message_Box_Context += "<div style=\"width:360px;padding:20px;font-size:12px;height:100px;\">" + Message + "</div>";
            Message_Box_Context += "<div style=\"width:385px;text-align:right;height:30px;padding-right:15px;\"><button style=\"width:80px;margin-right: 20px;\" onclick=\"RemoveMessageBox('" + CallBack + "')\">确定</button><button style=\"width:80px;\" onclick=\"RemoveMessageBox('')\">取消</button></div>";
            Div_To_Insert.innerHTML = Message_Box_Context;
            document.body.appendChild(Div_To_Insert);
        }
        
        
        // 添加背景框架
        function InsertMessageBoxFrame()
        {
            var Frame_To_Insert = document.createElement("iframe");
            Frame_To_Insert.id = "FrameMessageBox";
            var cssText = "position:absolute;width:404px;height:204px;background:White;border-style:none;";
            cssText += "left:" + document.getElementById("Div_Message_Box").style.left + ";";
            cssText += "top:" + document.getElementById("Div_Message_Box").style.top + ";";
            Frame_To_Insert.style.cssText = cssText;
            Frame_To_Insert.style.zIndex = 10;
            document.body.appendChild(Frame_To_Insert);
        }
        
        function alertd(Message, CallBack)
        {
            Dialog_Visible = true;
            var bExistBefore = document.getElementById("Div_New_Insert");
            if(bExistBefore != null)
                document.body.removeChild(bExistBefore);
            var Div_To_Insert = document.createElement("div");
            Div_To_Insert.id = "Div_New_Insert";
            Div_To_Insert.style.position = "absolute";
            Div_To_Insert.style.left = "0px";
                Div_To_Insert.style.top = "0px";         
            Div_To_Insert.style.width = document.body.clientWidth + "px";
            Div_To_Insert.style.height = document.body.clientHeight + 50 + "px";
            if(document.body.clientWidth < getWindowInfo().Width)
                Div_To_Insert.style.width = getWindowInfo().Width + "px";
            if(document.body.clientHeight < getWindowInfo().Height)
                Div_To_Insert.style.height = getWindowInfo().Height + "px";
            Div_To_Insert.style.zIndex = 10;
            Div_To_Insert.style.backgroundColor = "#ffffff";
            if (window.ActiveXObject)
                Div_To_Insert.style.filter = "alpha(opacity=50)";
            else
		        Div_To_Insert.style.opacity = "0.5";
            document.body.appendChild(Div_To_Insert);

            InsertMessageBoxDiv(Message, CallBack);
            InsertMessageBoxFrame(); 
        }
        
        function alertc(Message, CallBack)
        {
            Dialog_Visible = true;
            var bExistBefore = document.getElementById("Div_New_Insert");
            if(bExistBefore != null)
                document.body.removeChild(bExistBefore);
            var Div_To_Insert = document.createElement("div");
            Div_To_Insert.id = "Div_New_Insert";
            Div_To_Insert.style.position = "absolute";
            Div_To_Insert.style.left = "0px";
                Div_To_Insert.style.top = "0px";         
            Div_To_Insert.style.width = document.body.clientWidth + "px";
            Div_To_Insert.style.height = document.body.clientHeight + 50 + "px";
            if(document.body.clientWidth < getWindowInfo().Width)
                Div_To_Insert.style.width = getWindowInfo().Width + "px";
            if(document.body.clientHeight < getWindowInfo().Height)
                Div_To_Insert.style.height = getWindowInfo().Height + "px";
            Div_To_Insert.style.zIndex = 10;
            Div_To_Insert.style.backgroundColor = "#ffffff";
            if (window.ActiveXObject)
                Div_To_Insert.style.filter = "alpha(opacity=50)";
            else
		        Div_To_Insert.style.opacity = "0.5";
            document.body.appendChild(Div_To_Insert);

            InsertMessageBoxDivC(Message, CallBack);
            InsertMessageBoxFrame(); 
        }
        
        var alphaNumber;
        
        function MoveOutDiv(CallBack)
        {
            alphaNumber -= 10;
            if(alphaNumber == 0)
            {
                 document.body.removeChild(document.getElementById("Div_Message_Box"));
                 
                if(CallBack != undefined)
                {
                    CallBack = CallBack.replace(/@danyinhao@/g, "'");
                    eval(CallBack);
                }
                return;
            }
            document.getElementById("Div_Message_Box").style.filter = "alpha(opacity=" + alphaNumber + ")";
            if (window.ActiveXObject)
                document.getElementById("Div_Message_Box").style.filter = "alpha(opacity=" + alphaNumber + ")";
            else
                document.getElementById("Div_Message_Box").style.opacity = "0." + alphaNumber.toString();
            
            setTimeout("MoveOutDiv('" + CallBack + "')", 50);
        }
        
        function RemoveMessageBox(CallBack)
        {
            Dialog_Visible = false;
            document.body.removeChild(document.getElementById("FrameMessageBox"));
            document.body.removeChild(document.getElementById("Div_New_Insert"));
            alphaNumber = 100;
            MoveOutDiv(CallBack);
        }
        
        
        function ScrollBox()
        {
            if(Dialog_Visible)
            {
                Div_Message_Box.style.top = document.documentElement.scrollTop + getWindowInfo().Height / 2 - 100 + "px";
                var backFrame = document.getElementById("FrameMessageBox");
                backFrame.style.top = document.documentElement.scrollTop + getWindowInfo().Height / 2 - 100 + "px";
            }
        }

        if(document.all)/*IE*/
        {
            window.attachEvent("onscroll", function(){ScrollBox();});
        }
        else/*other browsers*/
        {
            window.addEventListener("scroll", function(){ScrollBox();}, false);
        }

        
        
         


        //提示层  message 内容 层长度 层高度 背景色 是否显示按扭,是否自动隐藏,是否显示加载gif
function show(ms,title,width,height,backgroundColor,mDviColor,showbuttom,autohidden,hiddengif)
{
            var WinWidth=document.documentElement.clientWidth?document.documentElement.clientWidth:document.documentElement.scrollWidth;
            var WinHeight=document.documentElement.clientHeight?document.documentElement.clientHeight:document.documentElement.scrollHeight;
            if(width==0)
                width=400;
            if(height==0)
                height=400;
            if(backgroundColor=='')
                backgroundColor='#FFFFFF';
            if(mDviColor=='')
                mDviColor='#FFFFFF';
            if(ms.length<=0)
                ms='正在执行当前操作, 请稍等...';
            if(title=='')
                title='操作提示';
            if($("background_div"))           
                document.body.removeChild($('background_div'));              
                
            var Div_To_Insert = document.createElement("div");
            Div_To_Insert.id = "background_div";
            Div_To_Insert.style.position = "absolute";
            Div_To_Insert.style.left = "0px";
            Div_To_Insert.style.top = "0px";         
            Div_To_Insert.style.width = document.body.clientWidth + "px";
            Div_To_Insert.style.height = document.body.clientHeight + 50 + "px";
             if(document.body.clientWidth < WinWidth)
                Div_To_Insert.style.width = WinWidth + "px";
            if(document.body.clientHeight < WinHeight)
                Div_To_Insert.style.height = WinHeight + "px";
            Div_To_Insert.style.zIndex = 10;
            Div_To_Insert.style.backgroundColor = backgroundColor;
            if (window.ActiveXObject)
                Div_To_Insert.style.filter = "alpha(opacity=50)";
            else
		        Div_To_Insert.style.opacity = "0.5";
            document.body.appendChild(Div_To_Insert);
            if($("success2"))           
                document.body.removeChild($("success2"));
            var Div_To_Insert = document.createElement("div");
            Div_To_Insert.id = "success2";
            Div_To_Insert.style.position = "absolute";
            Div_To_Insert.style.left = WinWidth / 2 - 200 + "px";
            Div_To_Insert.style.top = WinHeight / 2 - 100 + "px";
            Div_To_Insert.style.width = width+"px";
            Div_To_Insert.style.height = height+"px";
            Div_To_Insert.style.backgroundColor = mDviColor;
            Div_To_Insert.style.zIndex = 200;
            Div_To_Insert.style.borderWidth = "1px";
            Div_To_Insert.style.borderStyle = "solid";
            Div_To_Insert.style.borderColor = "Black";  
            var trText=(showbuttom==true)?"<div><button style='width:80px;' onclick=\"javacript:$('background_div').style.display='none';$('success2').style.display='none';\">确定</button></div>":"";  
            var imgtext=(hiddengif==true)?"<div style='float:left ;width:60px;margin-top:5px;'><img border=\"0\" src=\"upload/loading.gif\"  /></div>":"";
//            var text=" <div id=\"Layer2\" style=\"position:absolute;z-index:300;width:"+(width)+"px;height:"+(height)+"px;background-color: #FFFFFF;border:solid #000000 1px;font-size:14px;\"><div id=\"Layer4\" style=\"height:26px;background:#f1f1f1;line-height:26px;padding:0px 3px 0px 3px;font-weight:bolder;text-align:left;\">"+title+"</div><div id=\"Layer5\" style=\"height:"+(height-55)+"px;line-height:150%;padding:0px 3px 0px 3px;\" align=\"center\"><BR /> <table width=100% height=100% ><tr> "+imgtext+"<td id=\"tdd\" style=\"width:70%;\" valign=middle style=\"font-size: 14px;\" align=\"left\" >"+ms+"<BR /></td></tr>"+trText+"</table><BR /></div></div>";
//           Div_To_Insert.innerHTML=text;
           
           var ntitle="<div style=\"width:100%;background-color:#f1f1f1;height:20px;padding:6px;font-size:12px;text-align:left;\"><b>"+title+"</b></div>";
            ntitle+="<div style=\"width:100%;font-size:12px;height:auto;margin-top:10px;\">"+imgtext+"<div id=idDiv1 style='clear:right; text-align:left;text-indent:10px;line-height:150%;'>"+ms+"</div><BR /></div>";
            
            Div_To_Insert.innerHTML=ntitle;
           
            
           document.body.appendChild(Div_To_Insert);
           if(autohidden)
                autoHidden();
}
function $(id)
{
    return document.getElementById(id);
}
var bar=0;
function autoHidden()
{    
    bar=bar+2;
	if (bar<90) 
	{
		setTimeout("autoHidden()",100);
	} 
	else 
	{
	    bar=0;
	    $('background_div').style.display='none';
	    $('success2').style.display='none';	
		
	} 
}
       
       
        
 