﻿// JScript 文件

//获取ID
function $id(id){
    return document.getElementById(id);
}
function ShowMsg(){
	document.writeln("<div class=\"sysWin\"  style=\"position: absolute; z-index: 999; left: 322px; top: 154px;\" id=\"msgdiv\" canmove=\"true\" forid=\"msgdiv\"> </div>");
    //document.writeln("<div id=\"msgdiv\" style=\"position:absolute;display:none;border:2px solid #AFCEF9;\"><\/div>");
    //document.writeln("<div id=\"overdiv\" class=\"fLe\ canmove=\"true\" style=\"position:absolute;display:none;\"></div>");
   document.writeln("<div id=\"overdiv\" style=\"position:absolute;display:none;\"></div>");
    //document.writeln("</div>");
    var alllist = new Array();
    this.showlist = function(type)
    {
        var count = document.all.length;
        if(type==0)
        {
            var j=0;        
            for(var i=0;i<count;i++)
            {
                if(document.all(i).tagName=="SELECT")
                {
                    var select = document.all(i); 
			        if (select.style.display=="")
			        {
			            select.style.display="none";
			            alllist[j] = select;
			            j++;
			        }
                }
            }
        }
        else
        {
            for(var i=0;i<alllist.length;i++)
            {
                if(alllist!=null)
                {
                    if(alllist[i]!=null)
                    {
                        alllist[i].style.display = "";
                        alllist[i] = null;
                    }
                }
            }
        }
    }
    this.reffunction =null;
    this.returnFun = function()
    {
    
    
        ShowMsgo.resertwindow();
        if(ShowMsgo.reffunction!=null)
        {
            ShowMsgo.reffunction();
            
       }
        ShowMsgo.showlist(1); 
    }
    this.show=function(msgtitle,msgcontent,selecttype){
        var tempobj1=$id("msgdiv");
        var tempobj2=$id("overdiv");
        tempobj2.style.filter="alpha(opacity=10)";
        tempobj2.style.MozOpacity = 30/100;
        tempobj2.style.backgroundColor = "#000000";
        tempobj2.style.display = '';
        tempobj2.style.zIndex= 100;
        tempobj2.style.height= screen.availHeight+"px";
        tempobj2.style.width= screen.availWidth+"px";
        tempobj2.style.left=0;
        tempobj2.style.top=0;
        tempobj1.style.display="none";
        tempobj1.style.left=(screen.width - 400) / 2 +"px";
        tempobj1.style.top= (screen.height - 500) / 2+"px";
        tempobj1.style.display= '';
        
        var OutStr = "";
        //OutStr="<div style=\"font-weight:bolder;text-align:center;height:20px;font-size:14px;background-color:#6088D2;cursor:move\" canmove=\"true\" forid=\"msgdiv\">"+msgtitle+"</div>"
        //OutStr="OutStr+"<div style=\"height:200px;text-align:center;font-size:12px;\">"+msgcontent+"</div>"
        //OutStr="<div class=\"sysWin\" style=\"position: absolute; z-index: 999; left: 322px; top: 154px;\" id=\"sysMsgWin\" canmove=\"true\"forid=\"msgdiv\">";
		//OutStr=	"<div class=\"sysWin\" id=\"msgdiv\" canmove=\"true\" forid=\"msgdiv\" style=\"position: absolute; z-index: 999; left: 322px; top: 154px;\">";
		//OutStr+="	<div id=\"overdiv\" canmove=\"true\" style=\"position: absolute;background:#FFFFFF;\" forid=\"msgdiv\">";
		OutStr+="		<h2 canmove=\"true\" forid=\"msgdiv\">";
		OutStr+="			<div class=\"fLe\"></div>";
		OutStr+="			<b class=\"icoSw\" id=\"icoSw\"></b>";
		OutStr+="			<span>"+msgtitle+"</span>";
		OutStr+="			<div class=\"fRi\"></div>";
		OutStr+="			<a href=\"#\" title=\"关闭\" class=\"clsWin\"  onclick=\"ShowMsgo.isclose = true;ShowMsgo.resertwindow()\"> </a>";
	    OutStr+="		 </h2>";
		//OutStr+="	</div>";
		OutStr+="	<div class=\"bdy\">";
		OutStr+="		<div class=\"bdyCtn\">";
		OutStr+="		<table class=\"swTb\"><tbody>";
		OutStr+="		<tr><th><b class=\"icoIfo\" id=\"icoIfo\"></b></th>";
		OutStr+="		<td><span id=\"contextSpan\" class=\"swTit\">"+msgcontent+"</span></td>";
		OutStr+="		</tr>";
		OutStr+="		</tbody>";
		OutStr+="		 </table>";
		OutStr+="		</div>";
		OutStr+="	</div>";
		OutStr+="	<div class=\"bot\">";;
		OutStr+="	<div class=\"fLe\"></div>";
		if(selecttype==1)
		{
            //OutStr=OutStr+"<div style=\"text-align:center;font-size:12px;\"><input type=\"button\" value=\"确定\" onclick=\"ShowMsgo.returnFun();\">&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\"取消\" onclick=\"ShowMsgo.isclose = true;ShowMsgo.resertwindow()\"></div>"
        	OutStr+="<input value=\"取 消\" class=\"syBtn\" id=\"btnSysMsgCancel\" type=\"button\"  onclick=\"ShowMsgo.isclose = true;ShowMsgo.resertwindow()\"><input value=\"确 定\" class=\"syBtn\" id=\"btnSysMsgOk\" type=\"button\" onclick=\"ShowMsgo.returnFun();\">";
		
		}
		else if(selecttype==2)
		{
            //OutStr=OutStr+"<div style=\"text-align:center;font-size:12px;\"><input type=\"button\" value=\"确定\"  onclick=\"ShowMsgo.returnFun();\"></div>"
       		OutStr+="<input value=\"确 定\" class=\"syBtn\" id=\"btnSysMsgOk\" type=\"button\" onclick=\"ShowMsgo.returnFun();\">";
	    }
		//OutStr+="	<input value=\"取 消\" class=\"syBtn\" id=\"btnSysMsgCancel\" type=\"button\"><input value=\"确 定\" class=\"syBtn\" id=\"btnSysMsgOk\" type=\"button\">";
		OutStr+="	<div class=\"fRi\"></div>";
		OutStr+="	</div>";
		//OutStr+="</div>";
		//OutStr+="<input value=\"取 消\" class="syBtn" id="btnSysMsgCancel" type="button"><input value="确 定" class="syBtn" id="btnSysMsgOk" type="button">";

        tempobj1.innerHTML=OutStr;
        var md=false,mobj,ox,oy
        document.onmousedown=function(ev){
            var ev=ev||window.event;
            var evt=ev.srcElement||ev.target;
            if(typeof(evt.getAttribute("canmove"))=="undefined"){
                return;
                 }
                 if(evt.getAttribute("canmove")){
                md = true;
                mobj = document.getElementById(evt.getAttribute("forid"));
                ox = mobj.offsetLeft - ev.clientX;
                oy = mobj.offsetTop - ev.clientY;
                 }
             }
             document.onmouseup= function(){md=false;}
             document.onmousemove= function(ev){
            var ev=ev||window.event;

            if(md){
                mobj.style.left= (ev.clientX + ox)+"px";
                mobj.style.top= (ev.clientY + oy)+"px";
            }
        }
        ShowMsgo.showlist(0);
    }
    this.resertwindow=function(){
            $id('msgdiv').style.display='none';
            $id('overdiv').style.display='none';
    }
}
var ShowMsgo=new ShowMsg();
